Skip to content

Blue green deployment

Anthony Lapenna edited this page Jul 19, 2015 · 5 revisions

You only need a part of the skynet stack to be able to do blue-green deployment: Docker, Consul, Registrator and a load balancer.

The load balancer configuration is dynamically updated when any changes is detected inside the service registry (Consul) to add/remove backend servers. This is the key for blue-green deployment.

Using Docker and Registrator

With Docker and Registrator, any created/deleted container is automatically registered/unregistered from the service registry (Consul).

Supposing you already have a running container hosting a webapp in version 0.1, here are the steps to ensure a blue-green deployment of a webapp in version 0.2:

  • start a new container hosting a webapp in version 0.2
  • stop the container hosting the 0.1 version

Registrator will automatically notify Consul that a new container has spawned and as the load balancer configuration is dynamically updated, your clients will be automatically sending requests against the new version.

Available examples:

poc-bluegreen-haproxy

poc-bluegreen-nginx

Without Registrator

If you don't plan to use Registrator, you'll need to register/deregister your container inside Consul manually, by using the API.

Supposing you already have a running container hosting a webapp in version 0.1, here are the steps to ensure a blue-green deployment of a webapp in version 0.2:

  • start a new container hosting a webapp in version 0.2
  • register the new service via the Consul API
  • deregister the old service via the Consul API
  • stop the container hosting the 0.1 version

Once the old service is deregistered from Consul, the load balancer configuration will be updated and your clients will be automatically sending requests against the new version.

Available examples:

poc-bluegreen-haproxy-noregistrator

Clone this wiki locally