Skip to content

Instantly share code, notes, and snippets.

@nirui
Last active March 1, 2021 11:01
Show Gist options
  • Save nirui/a60269466436ff5956f0d7e0352129c7 to your computer and use it in GitHub Desktop.
Save nirui/a60269466436ff5956f0d7e0352129c7 to your computer and use it in GitHub Desktop.
# Modified based on https://blog.creekorful.com/2019/10/how-to-install-traefik-2-docker-swarm/
# Hope it helps :)
version: '3'
services:
reverse-proxy:
image: traefik:v2.4.3
command:
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=traefik-public"
- "--api=true"
- "--api.dashboard=true"
- "--api.insecure=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.websecure.http.tls=true"
- "--entrypoints.websecure.http.tls.domains.main=cubie0.svc.lan"
- "--entrypoints.websecure.http.tls.domains.sans=*.cubie0.svc.lan"
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- traefik-public
deploy:
placement:
constraints:
- node.role == manager
labels:
- "traefik.enable=true"
- "traefik.http.services.traefik.loadbalancer.server.port=888"
- "traefik.http.routers.traefik.rule=Host(`traefik.cubie0.svc.lan`)"
- "traefik.http.routers.traefik.entrypoints=web,websecure"
- "traefik.http.routers.traefik.service=api@internal"
volumes:
traefik-certificates:
networks:
traefik-public:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment