moved from static DNS provider to a dynamic Docker variable and env file

This commit is contained in:
Bryan Joshua Pedini 2022-08-02 12:03:51 +02:00
parent 64e726391a
commit 4633927204
3 changed files with 6 additions and 4 deletions

View File

@ -11,7 +11,7 @@ services:
- --api.dashboard=true
# configure Let's Encrypt automatic certificates
- --certificatesresolvers.${TRAEFIK_CERTRESOLVER}.acme.dnschallenge=true
- --certificatesresolvers.${TRAEFIK_CERTRESOLVER}.acme.dnschallenge.provider=hetzner
- --certificatesresolvers.${TRAEFIK_CERTRESOLVER}.acme.dnschallenge.provider=${TRAEFIK_DNSPROVIDER}
- --certificatesresolvers.${TRAEFIK_CERTRESOLVER}.acme.email=${LETSENCRYPT_EMAIL}
- --certificatesresolvers.${TRAEFIK_CERTRESOLVER}.acme.keytype=RSA4096
- --certificatesresolvers.${TRAEFIK_CERTRESOLVER}.acme.storage=/certs.json
@ -30,8 +30,8 @@ services:
# should not need, but just in case, a folder for dynamic config files is also configured
- --providers.file.directory=/config
- --providers.file.watch=true
environment:
- HETZNER_API_KEY=${HETZNER_API_KEY}
env_file:
- ${TRAEFIK_DNSPROVIDER_ENVFILE}
labels:
# expose Træfik using Træfik (dashboard)
- traefik.enable=${TRAEFIK_ENABLED}

1
env.dnsprovider.example Normal file
View File

@ -0,0 +1 @@
HETZNER_API_KEY=

View File

@ -11,7 +11,8 @@ TRAEFIK_PILOT_TOKEN=
TRAEFIK_TLSENABLED=true
# Certificate provider
HETZNER_API_KEY=
TRAEFIK_DNSPROVIDER=hetzner
TRAEFIK_DNSPROVIDER_ENVFILE=./.env.dnsprovider
LETSENCRYPT_EMAIL=admin@mydomain.com
# Debugging