Skip to content

Instantly share code, notes, and snippets.

@typewriter
Last active March 4, 2024 19:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typewriter/82ebed0df1fc6f7c1e360cfbf8d9b903 to your computer and use it in GitHub Desktop.
Save typewriter/82ebed0df1fc6f7c1e360cfbf8d9b903 to your computer and use it in GitHub Desktop.
Zero downtime deployment reproduction using traefik
version: "3"
services:
traefik:
image: "traefik:v2.2"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
command:
- "--providers.docker=true"
- "--api.insecure=true"
- "--entryPoints.web.address=:80"
- "--serversTransport.forwardingTimeouts.dialTimeout=1s"
- "--serversTransport.forwardingTimeouts.responseHeaderTimeout=5s"
nginx-blue:
image: "nginx:alpine"
stop_signal: SIGQUIT
labels:
- "traefik.http.routers.nginx-bg.rule=Host(`localhost`)"
- "traefik.http.routers.nginx-bg.middlewares=nginx-retry"
- "traefik.http.services.nginx-bg.loadbalancer.server.port=80"
- "traefik.http.middlewares.nginx-retry.retry.attempts=4"
nginx-green:
image: "nginx:alpine"
stop_signal: SIGQUIT
labels:
- "traefik.http.routers.nginx-bg.rule=Host(`localhost`)"
- "traefik.http.routers.nginx-bg.middlewares=nginx-retry"
- "traefik.http.services.nginx-bg.loadbalancer.server.port=80"
- "traefik.http.middlewares.nginx-retry.retry.attempts=4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment