Docker container for running Traefik reverse-proxy using Cloudflare as DNS
The example user is test//test.
Create hashed passwords using bcrypt with htpasswd -bnBC 15 "" <PASSWORD> | tr -d ':\n' (note the leading space to avoid it showing up in shell history, requires apache2-utils).
Add to usersfile as user:<hash>.
- Create an A record for your domain name
- Create another A record with the name "*" that's pointing to the same IP as the record above (suggestion: use ddclient to keep DNS records up to date)
- Add your user to
usersfile(don't forget to remove the example user!) - Input your domain name in
.env - Input your Cloudflare API email in
secrets/CF_API_EMAIL.secret - Go to the Cloudflare dashboard to create an API token.
- Create a
Custom tokenand select the following permissions:- Zone->DNS - Edit
- Zone->Zone - Read
- Input your Cloudflare API token in
secrets/CF_DNS_API_TOKEN.secret - Ensure that
cert/acme.jsonhas 600 permissions - Create proxy network for communication with other applications,
docker network create traefik - Run
docker-compose upand check logs
- Generate a bouncer API key by running:
docker compose exec crowdsec cscli bouncers add traefik-bouncer - Copy the generated key and put it under
LAPI_KEYin.env - Restart the
traefikcontainer to have it load the new env var:docker compose up -d --force-recreate traefik