Skip to content

Instantly share code, notes, and snippets.

@ratnose
Created October 15, 2021 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ratnose/5e5b4525d128f1a25994f3b17ffff1ba to your computer and use it in GitHub Desktop.
Save ratnose/5e5b4525d128f1a25994f3b17ffff1ba to your computer and use it in GitHub Desktop.
docker-compose-file:
version: '3.9'
services:
traefik:
image: traefik
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- 80:80
- 443:443
environment:
- CF_API_EMAIL=$CLOUDFLARE_EMAIL
- CF_DNS_API_TOKEN=$CF_APITOKEN_SCOPED
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./appdata/traefik/traefik.yml:/traefik.yml:ro
- ./appdata/traefik/acme.json:/acme.json
- ./appdata/traefik/config.yml:/config.yml:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`$TRAEFIK_DASHBOARD`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=ratnose:$$apr1$$0wW1ATIx$$ii6Fib9YcCUjLuWT.D7EL0"
- "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`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
- "traefik.http.routers.traefik-secure.tls.domains[0].main=$LANDOMAINNAME"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.$LANDOMAINNAME"
- "traefik.http.routers.traefik-secure.service=api@internal"
networks:
proxy:
external: true
------
traefik.yml
api:
dashboard: true
debug: true
entryPoints:
http:
address: ":80"
https:
address: ":443"
serversTransport:
insecureSkipVerify: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
file:
filename: /config.yml
certificatesResolvers:
cloudflare:
acme:
email: my.emial@domain.com
storage: acme.json
dnsChallenge:
provider: cloudflare
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
@ratnose
Copy link
Author

ratnose commented Oct 16, 2021

So I added log to the traefik.yml:

api:
  dashboard: true
  debug: true
entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"
serversTransport:
  insecureSkipVerify: true
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
  file:
    filename: /config.yml
log:
  level: DEBUG
  filePath: /traefik.log
certificatesResolvers:
  cloudflare:
    acme:
      email: my.email@domain.com
      storage: acme.json
      dnsChallenge:
        provider: cloudflare
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment