Traefik Config Review for Blue/Green Deploys

Suggestions and comments welcomed on this setup of a blue/green deploy with Traefik and docker compose please.

Traefik file configuration:

## Dynamic configuration
[http.services]
  [http.services.app]
    [[http.services.app.weighted.services]]
      name = "green_service@docker"
      weight = 4
    [[http.services.app.weighted.services]]
      name = "blue_service@docker"
      weight = 1

docker-compose service config. I have another for service_blue:

  service_green:
    build: .
    labels:
      - traefik.enable=true
      - traefik.http.services.service_green.loadbalancer.server.port=3000
      - traefik.http.routers.service_green.rule=Host(`service.com`)
      - traefik.http.routers.service_green.tls.certresolver=le
      - traefik.http.routers.service_green.entrypoints=websecure
    logging:
      driver: awslogs
      options:
        awslogs-region: us-east-2
        awslogs-group: service_green

Express app on another container provides webhook endpoints to Github and AWS CloudWatch Alarms. Start and stop containers with docker-compose npm. Checkout new or previous commit prior to build with simple-git npm.

Hey @urgent

A long time ago I've prepared an example for canary deployment using Swarm. it is no longer maintained by me but maybe you will have some insights into that example.

it is worth also implementing the order how contained are being restarted as it is configured at that example.

Thank you

1 Like