Share this
Enhancing continuous delivery with blue-green deployment
by Kosta Hahladakis on 19 April 2016
In my role as an Equinox IT senior consultant specialising in solution architecture, I am often asked by clients to help with technology decisions and implementations.
In a recent assignment, as part of an Equinox IT team working with a client, we identified an opportunity to improve the client’s deployment process to better fit a continuous delivery approach. The Equinox IT team comprised of an enterprise architect, two very experienced Java software development specialists, and myself as solution architect.
I guided the development team to implement blue-green deployment. In this article I cover the work that we as an Equinox IT team performed to achieve this implementation.
Client situation
The client’s previous release process involved a significant amount of upfront planning, ceremony and bureaucracy before system components could be deployed and new features were made available to users. When a deployment was performed the existing system components were taken offline, replaced and restarted, causing considerable user and business disruption. As a result releases were performed infrequently and outside of business hours.
Decision to implement blue-green deployment
To get over these problems the Equinox IT team made a recommendation to update the release process, so that new releases could be deployed as required with minimal business impact and without requiring a full system outages. The recommendation was agreed by the client.
With continuous delivery in mind and an existing continuous integration (CI) pipeline in place, the strategy we agreed on was a blue-green deployment approach, where two production environments (blue and green) would be hosted, with either being capable of servicing production users. At any given time, one environment would be active and receive production traffic while the other would be available as a staging area for deployments. Traffic could then be redirected to the staging environment when ready with the newly deployed changes. If anything were to go wrong, then the DevOps team would simply switch back to the previous environment.
Implementing the blue-green deployment change
Before embarking on building a blue-green deployment platform the Equinox IT team had to get the client’s environment and applications into a state that would support this approach.
We limited our scope to focus only on the services layer of the system as it was much simpler to deal with deploying individual stateless components rather than an entire system.
Establishing two production environments
First, we needed a means to run two production environments, a blue and a green. The Equinox IT team was already migrating the system to a microservices based architecture and this enabled us to deploy and run components as individual services. Each service instance was self-hosted, running under its own embedded http server and did not rely upon any external dependencies or configurations. This meant we could host several instances of a service on the same server listening on different ports. Essentially this gave us our two environments, a service instance representing the blue environment and another instance running as the green environment.
Other approaches we could have taken was to stand up more virtual machines or use application containerisation.
Using a shared database for both service instances
One of the issues we grappled with during the development of the blue-green deployment implementation was how to handle the database layer. We had been using a mixture of standalone databases and embedded application databases. Each approach had its drawbacks and complexities. We finally settled on service instances using a shared database and carefully managed our database migrations so that schema updates would support both the old and new service versions during the deployment transition period.
Routing traffic between both service instances
We also needed a way to route traffic between the two environments (or in our case: service instances).
We decided to leverage an existing reverse proxy server that was currently used for terminating HTTPS connections. The reverse proxy would host the service endpoint URLs that client applications would connect to and it would then route traffic to specific service instances.
Continuous delivery pipeline
With the environments and traffic routing in place we updated our continuous delivery approach to fit the new arrangements.
The updated deployment and release process is based upon two distinct actions:
- Deploying software – when a deployment is initiated the DevOps role selects the environment instance (e.g. green) to target. A build and deploy job on the continuous integration server deploys the component artefacts and configuration files for the green target. The deploy job also instantiates the web service to listen on the port designated for the green environment. The new deployment is smoke tested and any fixes implemented and redeployed through the same mechanism.
- Releasing software - when the new version of the service is ready to be released to users, the DevOps role initiates an activation job on the CI server. The activation job updates the proxy configuration to point to the green service instance. A graceful restart is sent to the proxy to reload its configuration and redirect traffic to the newly deployed green instance. The roles of the service instances are now reversed and production traffic is routed to the updated instance.
The complete process from deployment to release is performed without taking down the existing service and without causing disruption to users.
Result
The goal of our blue-green deployment initiative was to make releasing software a ‘non-event’ - something that just occurs as part of the development process and doesn’t require major outages or intensive upfront planning to perform. Using a blue-green deployment approach reduced the risk and overheads associated with performing deployments and enabled the client to deploy alongside a current live system during business hours. The result was an environment and approach that better supported the client’s continuous delivery direction, enabling faster delivery of new features and enhancements to users.
Kosta is a Senior Consultant based in Equinox IT's Wellington, New Zealand office.
Share this
- Agile Development (153)
- Software Development (126)
- Agile (76)
- Scrum (66)
- Application Lifecycle Management (50)
- Capability Development (47)
- Business Analysis (46)
- DevOps (43)
- IT Professional (42)
- Equinox IT News (41)
- Agile Transformation (38)
- IT Consulting (38)
- Knowledge Sharing (36)
- Lean Software Development (35)
- Requirements (35)
- Strategic Planning (35)
- Solution Architecture (34)
- Digital Disruption (32)
- IT Project (31)
- International Leaders (31)
- Digital Transformation (26)
- Project Management (26)
- Cloud (25)
- Azure DevOps (23)
- Coaching (23)
- IT Governance (23)
- System Performance (23)
- Change Management (20)
- Innovation (20)
- MIT Sloan CISR (15)
- Client Briefing Events (13)
- Architecture (12)
- Working from Home (12)
- IT Services (10)
- Data Visualisation (9)
- Kanban (9)
- People (9)
- Business Architecture (8)
- Communities of Practice (8)
- Continuous Integration (7)
- Business Case (4)
- Enterprise Analysis (4)
- Angular UIs (3)
- Business Rules (3)
- GitHub (3)
- Java Development (3)
- Lean Startup (3)
- Satir Change Model (3)
- API (2)
- Automation (2)
- Scaling (2)
- Security (2)
- Toggles (2)
- .Net Core (1)
- AI (1)
- Diversity (1)
- Testing (1)
- ✨ (1)
- August 2024 (1)
- February 2024 (3)
- January 2024 (1)
- September 2023 (2)
- July 2023 (3)
- August 2022 (4)
- August 2021 (1)
- July 2021 (1)
- June 2021 (1)
- May 2021 (1)
- March 2021 (1)
- February 2021 (2)
- November 2020 (2)
- September 2020 (1)
- July 2020 (1)
- June 2020 (3)
- May 2020 (3)
- April 2020 (2)
- March 2020 (8)
- February 2020 (1)
- November 2019 (1)
- August 2019 (1)
- July 2019 (2)
- June 2019 (2)
- April 2019 (3)
- March 2019 (2)
- February 2019 (1)
- December 2018 (3)
- November 2018 (3)
- October 2018 (3)
- September 2018 (1)
- August 2018 (4)
- July 2018 (5)
- June 2018 (1)
- May 2018 (1)
- April 2018 (5)
- March 2018 (3)
- February 2018 (2)
- January 2018 (2)
- December 2017 (2)
- November 2017 (3)
- October 2017 (4)
- September 2017 (5)
- August 2017 (3)
- July 2017 (3)
- June 2017 (1)
- May 2017 (1)
- March 2017 (1)
- February 2017 (3)
- January 2017 (1)
- November 2016 (1)
- October 2016 (6)
- September 2016 (1)
- August 2016 (5)
- July 2016 (3)
- June 2016 (4)
- May 2016 (7)
- April 2016 (13)
- March 2016 (8)
- February 2016 (8)
- January 2016 (7)
- December 2015 (9)
- November 2015 (12)
- October 2015 (4)
- September 2015 (2)
- August 2015 (3)
- July 2015 (8)
- June 2015 (7)
- April 2015 (2)
- March 2015 (3)
- February 2015 (2)
- December 2014 (4)
- September 2014 (2)
- July 2014 (1)
- June 2014 (2)
- May 2014 (9)
- April 2014 (1)
- March 2014 (2)
- February 2014 (2)
- December 2013 (1)
- November 2013 (2)
- October 2013 (3)
- September 2013 (2)
- August 2013 (6)
- July 2013 (2)
- June 2013 (1)
- May 2013 (4)
- April 2013 (5)
- March 2013 (2)
- February 2013 (2)
- January 2013 (2)
- December 2012 (1)
- November 2012 (1)
- October 2012 (2)
- September 2012 (3)
- August 2012 (3)
- July 2012 (3)
- June 2012 (1)
- May 2012 (1)
- April 2012 (1)
- February 2012 (1)
- December 2011 (4)
- November 2011 (2)
- October 2011 (2)
- September 2011 (4)
- August 2011 (2)
- July 2011 (3)
- June 2011 (4)
- May 2011 (2)
- April 2011 (2)
- March 2011 (3)
- February 2011 (1)
- January 2011 (4)
- December 2010 (2)
- November 2010 (3)
- October 2010 (1)
- September 2010 (1)
- May 2010 (1)
- February 2010 (1)
- July 2009 (1)
- April 2009 (1)
- October 2008 (1)