Skip to content

Instantly share code, notes, and snippets.

@tamtakoe
Last active October 26, 2023 14:00
Show Gist options
  • Save tamtakoe/06cdbc3acf8aa47b33111b3fcd9d5d39 to your computer and use it in GitHub Desktop.
Save tamtakoe/06cdbc3acf8aa47b33111b3fcd9d5d39 to your computer and use it in GitHub Desktop.
```jaml
version: '3.9'
services:
traefik:
image: traefik:v2.10
ports:
- 80:80
- 443:443
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.certificate-storage == true
- node.role == manager
labels:
- traefik.enable=true
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
- traefik.http.routers.traefik-public-http.rule=Host(`traefik.example.com`)
- traefik.http.routers.traefik-public-http.entrypoints=http
- traefik.http.routers.traefik-public-http.middlewares=https-redirect
- traefik.http.routers.traefik-public-https.rule=Host(`traefik.example.com`)
- traefik.http.routers.traefik-public-https.entrypoints=https
- traefik.http.routers.traefik-public-https.tls=true
- traefik.http.routers.traefik-public-https.tls.certresolver=le
- traefik.http.routers.traefik-public-https.tls.domains[0].main=example.com
- traefik.http.routers.traefik-public-https.tls.domains[0].sans=*.example.com
- traefik.http.routers.traefik-public-https.service=api@internal
- traefik.http.services.traefik.loadbalancer.server.port=8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik-public-certificates:/certificates
command:
- --providers.docker
- --providers.docker.exposedbydefault=false
- --providers.docker.swarmmode
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
- [email protected]
- --certificatesresolvers.le.acme.storage=/certificates/acme.json
- --certificatesresolvers.le.acme.tlschallenge=true
networks:
- traefik-public
volumes:
traefik-public-certificates:
networks:
traefik-public:
driver: overlay
attachable: true
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment