Skip to content

Instantly share code, notes, and snippets.

@felipecwb
Last active September 3, 2018 17:54
Show Gist options
  • Save felipecwb/49018bd8d75a6722c6d926f2dbfc2771 to your computer and use it in GitHub Desktop.
Save felipecwb/49018bd8d75a6722c6d926f2dbfc2771 to your computer and use it in GitHub Desktop.
Traefik and Portainer infrastructure-definition.yml
version: "3.7"
services:
reverse-proxy:
image: traefik
command:
- "--docker"
- "--docker.swarmMode"
- "--docker.watch"
- "--docker.exposedbydefault=false"
# - "--docker.domain=localhost"
# - "--defaultentrypoints=http,https"
# - "--entrypoints=Name:https Address::443 TLS:/usr/certs/localhost.crt,/usr/certs/localhost.key"
- "--web"
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
networks:
- frontend
volumes:
- ./certs/:/usr/certs
- /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: global
update_config:
parallelism: 2
delay: 10s
order: start-first
restart_policy:
condition: any
placement:
constraints: [node.role == manager]
labels:
- "traefik.enable=true"
- "traefik.port=8080"
- "traefik.frontend.rule=Host:proxy.localhost"
depends_on:
- reverse-proxy
portainer:
image: portainer/portainer
command: -H unix:///var/run/docker.sock
networks:
- frontend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- data_portainer:/data
deploy:
mode: global
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: any
delay: 5s
placement:
constraints: [node.role == manager]
labels:
- "traefik.enable=true"
- "traefik.port=9000"
- "traefik.frontend.rule=Host:portainer.localhost"
whoami:
image: emilevauge/whoami
networks:
- frontend
deploy:
replicas: 1
restart_policy:
condition: any
max_attempts: 3
delay: 5s
labels:
- "traefik.enable=true"
- "traefik.port=80"
- "traefik.frontend.rule=Host:localhost;PathPrefix:/_whoami"
networks:
frontend:
external: true
volumes:
data_portainer:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment