Software Development Lifecycle has quickly evolved during the last decade putting more emphasis on continuous integration(CI), built-in testing, constant monitoring, and analytics feedback. They all point toward an overall trend in the software industry: increasing the ability to react. As companies are trying to adapt to these changes, they invariably discover continuous delivery, commonly known as a CD. Continuous Delivery(CD) is the ability to get changes of all types—including new features, configuration changes, bug fixes and experiments—into production, or into the hands of users, safely and quickly in a sustainable way.
Fig 1: Continuous Delivery Model using CloudOptimo
Continuous Delivery helps organizations achieve several important benefits that can provide incredible competitive advantages.
The most obvious benefit of Continuous Delivery is that it provides quick reactions to stimuli – both external and internal helping you roll out new features, bug fixes faster.
The new age mantra which Mark Zuckerberg made famous is “Stay Focused & Keep Shipping”. However many organizations have a halo around – Shipping the release. It’s a dark secret that shipping a release takes a humongous amount of time due to QA, Built/Release teams. When organizations start following the Continuous Delivery Model, the release(not necessarily customer-facing) is made often thereby reducing the halo around the release. This reduces the risk of detecting issues significantly.
By applying patterns such as blue-green deployments it is relatively straightforward to achieve zero-downtime deployments that are undetectable to users. It will help your organization achieve high availability. CloudOptimo supports this feature to reduce your risk.
Continuous delivery makes it economical to work in small chunks. This means we can get feedback from users throughout the delivery lifecycle based on working software. Techniques such as A/B testing enable us to take a hypothesis-driven approach to product development whereby we can test ideas with users before building out whole features. This means we can avoid the 2/3 of features we build that deliver zero or negative value to our businesses.
Due to constant shipping, engineering teams will detect issues that customers are facing quicker thereby making the product better.
Any successful software product or service will evolve significantly over the course of its lifetime. By investing in build, test, deployment and environment automation, we substantially reduce the cost of making and delivering incremental changes to software by eliminating many of the fixed costs associated with the release process.
As Martin Fowler says here – “One of the challenges with automating deployment is the cut-over itself, taking software from the final stage of testing to live production. You usually need to do this quickly in order to minimize downtime.” One of the key approaches to achieve this is a Blue-Green Deployment.
The Blue-Green Deployment is a technique that allows you to deploy your product with zero downtime. The Blue-Green Deployment approach expects you to have two similar production environments – Blue and Green. The Blue Environment is typically running the older or current version prior to deployment. The green environment is a new version that you wish to roll out in production.
As you prepare a release of your new product version, you create an identical set of the current blue environment called Green Environment. All the final testing happens in this Green Environment. When the release was found to be working, you migrate the production traffic to this Green Environment making the Blue Environment idle. In case any unexpected issues are detected(many a times production traffic brings random issues which had fallen through the cracks.) with your Green Environment, you can immediately roll back to the previous version on Blue.
The two environments are typically different but as similar as possible. Many times, the difference could only be a change of hardware capacity, change in IP addresses, or a new image if you are on the cloud.
CloudOptimo helps you achieve Continuous Deployment using the Blue-Green deployment approach ensuring high availability during new product deployment. Let’s see how we do it.
Let’s try to further dive in to see how Continuous Delivery(Cd) can be achieved using the CloudOptimo Platform. We will take a sample Web App to demonstrate how CD can be achieved. The typical application architecture will have below components. We will be considering Blue-Green Deployment model to demonstrate Continuous Deployment.
Amazon RDS – Master and Slave: Amazon RDS is a managed database service for many Database flavors like Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle, and Microsoft SQL Server. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching, and backups. We will be running using the MySQL server in Master and Slave mode.
Fig 2: Web Application Application Architecture
Let’s say we want to deploy a new release for our product. We will need to create a new image that can be configured using the Edit option in CloudOptimo Configuration Wizard. Once we complete the configuration, a green environment with a new image will be created to launch. The autoscaling will be paused until the rolling deployment is completed. CloudOptimo will automatically launch instances as per this new configuration. CloudOptimo will launch a minimum number of instances for a green environment as per the configuration. The deployment scenario will look as below:
Fig 3: Instances launched for Green Environment
Once a minimum number of instances are launched for Green Environment, CloudOptimo will automatically route the traffic from ELB to Green Environment Instances and deregister the Blue Environment instances from ELB. In case any issue occurs, Green Instances will be terminated. Blue Instances will remain intact. This ensures a zero-downtime deployment using CloudOptimo.
Fig 4: Traffic routed to Green Environment Instances
Once all Green Environment Instances comes online, we will start terminating Blue Environment Instances.
Fig 5: Blue Environment Instances are terminated
Once all Blue Instances are terminated, the deployment is marked as completed. Green Environment will become the Blue Environment for the next deployment.
Fig 6: Deployment Completion
Once you hit the Edit Button on OptimoGroup Dashboard, you will be able to deploy with a new image. You can monitor the progress on the OptimoGroup Dashboard. You can see it in below screenshot:
Fig 7: Rolling Deployment Stages in CloudOptimo Console
That’s it. I hope you will find it useful.