This repository contains a modular Docker-based environment to manage various services on a VPS using Docker Compose, Traefik, Watchtower, and more. Each service (analytics, registry, Dozzle, etc.) has its own docker-compose.yml file and is auto-discovered by the Makefile.
.
├── Makefile
├── README.md
├── .env.example
├── analytics/
│ └── docker-compose.yml
├── dozzle/
│ └── docker-compose.yml
├── example-app/
│ └── docker-compose.yml
├── registry/
│ └── docker-compose.yml
├── traefik/
│ └── docker-compose.yml
├── watchtower/
│ └── docker-compose.yml
- Debian 12 (or compatible Linux distro)
- Docker and Docker Compose
htpasswdinstalled (apache2-utilsorhttpd-tools)
Install it on Debian-based systems:
sudo apt install apache2-utilsCopy .env.example to .env and update values as needed:
cp .env.example .envUse the Makefile to manage all services at once:
make helpmake upThis will automatically detect all subdirectories with a docker-compose.yml and start them.
make downGracefully stops all containers from all discovered services.
make create-htpasswdInteractively prompts for usernames and passwords for:
- Traefik
- Dozzle
- Registry
And saves them to the appropriate paths:
traefik/auth/htpasswddozzle/auth/htpasswdregistry/auth/htpasswd
To add a new service to your Docker environment, follow these steps:
Create a new directory in the root of the project, for example:
mkdir my-appInside this folder, create a docker-compose.yml file.
Here’s a basic template for a new service that will be routed by Traefik and monitored by Watchtower:
services:
example_app:
image: ${REGISTRY_DOMAIN}/my_app
container_name: hosted_my_app
labels:
- "traefik.enable=true"
- "traefik.http.routers.hosted_my_app.rule=Host(`${MY_APP_DOMAIN}`)"
- "traefik.http.routers.hosted_my_app.entrypoints=websecure"
- "traefik.http.routers.hosted_my_app.tls.certresolver=myresolver"
- "com.centurylinklabs.watchtower.enable=true"
networks:
- web
networks:
web:
external: trueMake sure your domain is defined in the .env file at the project root:
MY_APP_DOMAIN=my-app.mydomain.comUse the Makefile to automatically detect and launch the new service:
make upYour app will now be available at https://my-app.mydomain.com.
- Make sure to secure your VPS with tools like
fail2ban, firewall rules, SSH keys, and regular updates. - The
.envfile should never be committed if it contains secrets.
- Add
fail2banautomation. - TLS certificate backup / restore.
Happy hosting! 🚀