Blue-Green deployments 101: everything you need to know to get started

Patrick Wiseman
CEO and Founder

If you ship software, you’ve probably started hearing more and more about Blue-Green deployments over the past few years. But what exactly is this approach? How does it work? And why should you care? We’ve distilled everything you need to know about Blue-Green deployments into this handy guide.

What are Blue-Green deployments?

A Blue-Green deployment is an approach to deploying new software that involves maintaining two identical production stacks. It allows for zero downtime deployments and enables teams to quickly rollback any bad deployments.

The concept of Blue-Green deployments were popularized by Martin Fowler, who noted its value for teams embracing continuous delivery. Specifically, he argued for the importance of simplifying the cut over to new code when automating deployments.

In the decade-plus since then, continuous delivery has become even more widely embraced and the accessibility of a Blue-Green deployment practice has increased accordingly.

How do Blue-Green deployments work?

With Blue-Green deployments, you maintain two identical production stacks: One blue stack and one green stack. When software updates are ready for production, you deploy the code to the stack that is not currently receiving traffic. You can then check its readiness and reroute traffic to that stack once a proper working state is confirmed.

For example, let’s say the blue stack currently receives traffic and the green stack is inactive. You can deploy code changes to the green stack, run readiness checks against the deployed code and then switch to direct traffic to the green stack. Once that’s complete, the blue stack becomes inactive. As you become conditioned to this practice, you can rinse and repeat using the same stacks reversing roles each time a new deployment is ready.

What are the benefits of Blue-Green deployments?

Blue-Green deployments solve two main problems:

  1. Downtime associated with deployments: Blue-Green deployments allow for zero downtime deployments, which is critical for continuous delivery since deploying changes so frequently leaves little-to-no tolerance for downtime with each delivery.
  2. Risk of bad deployments: Blue-Green deployments reduce the risk of bad deployments by making it quick and easy to rollback changes once an issue is identified simply by rerouting traffic back to the previously active stack.

In solving these problems, Blue-Green deployments lead to three important benefits for organizations, development teams and end users:

  1. A safer way to ship updates more frequently, which can help teams advance their journey toward continuous delivery
  2. Delight and emotional security for your development team as a result of the reduced risk with each deployment
  3. A better experience for end users thanks to reduced downtime and reduced issues when changes go live

Additionally, mature continuous delivery practices lead to long term benefits such as getting new features to customers faster to accelerate feedback, allowing development teams to get more done and even retaining employees for longer due to increased satisfaction.

What are the challenges of Blue-Green deployments?

For all the benefits that Blue-Green deployments offer, they have not been without their challenges over the years.

Most notably, the concept of Blue-Green deployments first came about at a time when maintaining two production stacks was relatively expensive. Before cloud technologies infrastructure was a high fixed cost. In many cases, adopting Blue-Green deployments could mean doubling the costs of your infrastructure.

As a result of this history, while the practice is very popular with technologists – who benefit from the reduced downtime and ability to more easily push frequent changes – Blue-Green deployments have historically been less popular with management, who are accountable for the costs. Cloud native infrastructure has really changed the way Blue-Green deployments are implemented.

What is the way forward for Blue-Green deployments?

Fortunately, several advancements over the past few years have significantly lowered the costs of Blue-Green deployments and led to increased adoption of this approach.

Cloud computing, in particular, has allowed for more on-demand (rather than fixed) costs. For instance, instead of maintaining additional instances indefinitely, teams can easily spin down each instance when it’s not in use.

The rise of Kubernetes also helped alleviate the density issue by making it possible to safely run more services from fewer servers. Ultimately, Kubernetes has made Blue-Green deployments less expensive financially.

Beyond reducing the costs associated with Blue-Green deployments, Kubernetes also makes them easier than ever. That’s because in the design of Kubernetes, routing and deployments are separate resources and containers have startup, readiness and liveness probes that serve important purposes in Blue-Green deployments.

In this current state, the challenges associated with Blue-Green deployments shift from cost concerns to how to best define readiness probes for a container and how to ensure zero downtime deployments for datastores, which are not as easy to replicate from one deployment to the next.

How can you get started with Blue-Green deployments?

The benefits of Blue-Green deployments are clear and only growing as more teams embrace cloud native technologies like Kubernetes that reduce costs and provide a superior development experience.

The best way to get started with Blue-Green deployments, particularly if your team is also looking for a better way to do continuous delivery, is to introduce a platform built for this approach. Spaceship is built on Kubernetes and designed to facilitate this type of process. Talk to us today to learn more and discover how you can get started.

Want to be first in line to get early access to Spaceship?

Be the first to know when we launch! Sign up for our waiting list below: