Blue-Green-Deployment with Traefik

Hi,

I am working in a legacy environment including:

  • Varnish as HTTP cache
  • Traefik as LB / HA-Proxy replacement
  • Rancher v1 (cattle) for container orchestration

We are using a rancher stack containing a scaled number of containers shared across different nodes to serve a website. Routing / load balancing is done using docker labels and Traefik.

To solve various issues, we'd like to implement a blue/green-style deployment:

  • having one rancher stack of the website being productive
  • having one rancher stack of the website inactive

During deploy, we check which is the inactive stack and upgrade its respective containers. As soon as this stack is upgraded and tested, we want to switch this stack to be the active/productive one and make the other one inactive.

This switch needs to be atomic:

From this point on, only containers from the upgraded stack should be requested. Otherwise, users might receive a new HTML containing frontend resources with fresh cache buster keys, but these frontend resources might be delivered by a container of the old stack and thus be outdated (and cached by varnish / browsers).

There was a promising feature request asking to implement an API to do exactly what I described: https://github.com/containous/traefik/issues/914

With such an API, we could easily make the switch in Traefik between the active/inactive stacks. However, this request was closed linking to this pull: https://github.com/containous/traefik/pull/5237. Unfortunately, I fail to see how weighted round robin can solve this issue since it does not seem to provide an atomic switch between the stacks using docker labels (such as an API described in the feature request would provide).

Is there a way achieve this goal? If so, how?

Thank you very much in advance.

Kind regards
Daniel