Loading repository data…
Loading repository data…
tysker / repository
Traefik setup that includes https certification, redirect and watchtower for CI. The rest-api image inside the docker-compose file is build on Javalin(Java). For testing the endpoints check out the http file inside the project.)
A template for deploying applications on a remote server using Traefik, Docker, Docker Compose, and DigitalOcean. Provides automatic HTTPS, routing, PostgreSQL, and optional frontend hosting.
| Technology | Purpose |
|---|---|
| Reverse proxy, HTTPS, routing | |
| Containerization | |
| Hosting | |
| Database | |
| Optional frontend hosting |
✔ Fully functional reverse proxy ✔ Automatic SSL certificates (Let’s Encrypt) ✔ Traefik dashboard with password protection ✔ Docker-based backend + database ✔ Optional frontend deployment (React/Vue/etc.) ✔ Works on any DigitalOcean Docker Droplet ✔ Clean environment variable setup ✔ Simple debugging instructions
DigitalOcean account
Docker Droplet (from Marketplace)
Docker Hub account
A domain name
Domain pointing to DigitalOcean nameservers
Wildcard DNS record:
*.yourdomain.com
git clone https://github.com/tysker/traefik_setup_remote.git
(Optional cleanup: remove .git, rename folder, init new repo.)
Create one here: https://cloud.digitalocean.com/account/api/tokens
sudo apt-get install apache2-utils
Generate hashed credentials:
echo $(htpasswd -nb <username> <password>) | sed -e s/\\$/\\$\\$/g
chmod 600 ./acme
chmod 600 ./acme/acme.json
.envPROVIDER=digitalocean
EMAIL=<your_email>
DO_AUTH_TOKEN=<your_digitalocean_token>
TRAFIK_DOMAIN=traefik.<your_domain>
DASHBOARD_AUTH=<htpasswd_output>
API_DOMAIN=api.<your_domain>
POSTGRES_USER=<user>
POSTGRES_PASSWORD=<pw>
REPO_USER=<dockerhub_username>
REPO_PASS=<dockerhub_password>
(Plus optional API settings.)
Start:
docker-compose up -d
Stop:
docker-compose down
Traefik dashboard:
https://traefik.<your_domain>
API:
https://api.<your_domain>/api
Reset DB:
docker-compose down -v
sudo rm -rf ./data
(Using Nginx + multi-stage Docker build)
Add nginx.conf + Dockerfile (as provided in earlier message) to your frontend root.
Push your image to Docker Hub and update docker-compose.yml.
docker ps -a — check running containers
docker-compose config — verify env vars
docker logs <container> — inspect logs
Check wildcard DNS record
Check DigitalOcean DNS nameservers
chmod 600 acme.json is required
Run without -d to see live logs:
docker-compose up
┌───────────────────────────┐
│ Client Browser │
│ https://api.domain.com │
└──────────────┬────────────┘
│
▼
┌───────────────────────────┐
│ Traefik │
│ - Reverse Proxy │
│ - Let's Encrypt TLS │
│ - Routing / Middleware │
└───────┬─────────┬────────┘
│ │
│ │
┌────────────▼─┐ ┌───▼────────────────┐
│ Backend │ │ Traefik Dashboard │
│ (REST API) │ │ traefik.domain.com │
└──────┬────────┘ └─────────┬──────────┘
│ │
│ │
┌──────▼────────┐ │
│ PostgreSQL │ │
│ Database │ │
└───────────────┘ │
│
(optional) │
┌─────────────────────────────▼─┐
│ Frontend │
│ (React/Vue via Nginx) │
│ https://app.domain.com │
└────────────────────────────────┘