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
Why Continuous Delivery?
Continuous Delivery helps organizations achieve several important benefits that can provide incredible competitive advantages.
- Quick Reaction:
- Reduced Risk:
- Improved Product:
- Lower costs:
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.
Blue-Green Deployment Methodology
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.
Continuous Delivery(CD) using CloudOptimo
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.
- Elastic Load Balancer(ELB):
- Cloudfront CDN:
- Amazon S3:
- Amazon Route 53:
- Amazon EC2 Instances with Autoscaling:
- Amazon RDS – Master and Slave:
Elastic Load Balancing automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses. It can handle the varying load of your application traffic in a single Availability Zone or across multiple Availability Zones. Elastic Load Balancing offers three types of load balancers that all feature the high availability, automatic scaling, and robust security necessary to make your applications fault-tolerant. CloudOptimo Platform allows you to utilize ELB with Spot Instances.
Amazon CloudFront is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .php, and image files, to your users. This helps you serve the static content by serving it from the closest edge location to customers thereby reducing latency.
Cloudfront CDN can be clubbed with Amazon S3 to serve static resources from edge location.
Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service. It is designed to give developers and businesses an extremely reliable and cost-effective way to route end users to Internet applications. It has a Geo DNS that can allow you to route the traffic to another Autoscaling Cluster in case your primary availability zone is unavailable helping you achieve fault-tolerance and high availability. It also can be used to route the traffic to the nearest deployment thereby help you reduce the latency.
Most of the customers use EC2 Instances in Autoscaling mode. CloudOptimo allows you to form a cluster of EC2 Spot instances in Autoscaling mode to help you to take advantage of increased cost savings.
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.