-
Notifications
You must be signed in to change notification settings - Fork 6
Blue green deployment
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.
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:
- Using HAProxy as the load balancer: https://github.com/cyberdyne-corp/skynet/tree/poc-bluegreen
- Using Nginx as the load balancer: https://github.com/cyberdyne-corp/skynet/tree/poc-bluegreen-nginx
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:
- Using HAProxy as the load balancer: https://github.com/cyberdyne-corp/skynet/tree/poc-no-registrator