Skip to content

Instantly share code, notes, and snippets.

@jk
Created January 9, 2025 14:30
Show Gist options
  • Save jk/5f8de416f459679b56708c80b4e192a8 to your computer and use it in GitHub Desktop.
Save jk/5f8de416f459679b56708c80b4e192a8 to your computer and use it in GitHub Desktop.
IPv64 provider and secrets handling
version: "3.8"
services:
traefik:
image: traefik:v3.1
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
# - 443:443/tcp # Uncomment if you want HTTP3
# - 443:443/udp # Uncomment if you want HTTP3
environment:
IPV64_API_KEY_FILE: /run/secrets/ipv64_api_key # note using _FILE for docker secrets
# CF_DNS_API_TOKEN: ${IPV64_API_KEY} # if using .env
TRAEFIK_DASHBOARD_CREDENTIALS: ${TRAEFIK_DASHBOARD_CREDENTIALS}
secrets:
- ipv64_api_key
env_file: .env # use .env
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/traefik.yml:ro
- ./data/acme.json:/acme.json
# - ./data/config.yml:/config.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.local.mydomain.tld`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_DASHBOARD_CREDENTIALS}"
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.local.mydomain.tld`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=ipv64"
- "traefik.http.routers.traefik-secure.tls.domains[0].main=local.mydomain.tld"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.local.mydomain.tld"
- "traefik.http.routers.traefik-secure.service=api@internal"
secrets:
ipv64_api_key:
file: ./ipv64_api_key.txt
networks:
proxy:
external: true
api:
dashboard: true
debug: true
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
serversTransport:
insecureSkipVerify: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
# file:
# filename: /config.yml
certificatesResolvers:
ipv64:
acme:
email: [email protected]
storage: acme.json
# caServer: https://acme-v02.api.letsencrypt.org/directory # prod (default)
caServer: https://acme-staging-v02.api.letsencrypt.org/directory # staging
dnsChallenge:
provider: ipv64
delayBeforeCheck: 30s
resolvers:
- "159.69.110.93:53"
- "167.235.231.182:53"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment