Module 6 Lesson 3: Blue-Green vs Canary Releases
·DevOps

Module 6 Lesson 3: Blue-Green vs Canary Releases

Zero downtime mastery. Explore the advanced deployment patterns used by world-class engineering teams to ship code with zero interruptions to the user.

Module 6 Lesson 3: Blue-Green vs Canary Releases

For a small blog, 1 minute of "Down time" is fine. For a bank or a hospital, it's not. These two patterns ensure your app is always reachable.

1. Blue-Green Deployment

  • Blue: The current live version.
  • Green: The new version you just built.
  1. You build "Green" on a separate server.
  2. You run all tests on "Green."
  3. When you are ready, you "Flip the Switch" (at the Load Balancer) to send all traffic to Green.
  • The Benefit: If Green is broken, you flip the switch back to Blue in 1 second. Zero users saw a "Site Down" page.

2. Canary Release

Named after the "Canary in a coal mine," this strategy is about Progressive Exposure.

  1. Deploy the new version (v2) to just 1% of your users.
  2. Watch the error logs.
  3. If everything is fine after 1 hour, increase it to 10%.
  4. By the end of the day, 100% of users are on v2.
  • The Benefit: If there is a massive bug, only 1% of users were affected. You "Save" 99% of your customers from the bug.

3. Rolling Updates (The Kubernetes Default)

If you have 10 servers, you update them one by one.

  • Server 1 updates -> Server 2 updates -> ...
  • There are always 9 servers online at any given moment.

4. Comparing the Strategies

StrategySpeed of RollbackInfrastructure CostRisk
Simple RebuildSlowLowHigh
Blue-GreenInstantHigh (2x Servers)Low
CanaryInstantMediumLowest

Exercise: The Strategy Selector

  1. A social media app wants to launch a new "Like" button animation. Which strategy should they use?
  2. A government tax database is updating its core encryption logic. Which strategy should they use?
  3. In GitLab, how would you implement a "Canary" using Manual Jobs (Module 3) and 2 different deployment servers?
  4. Research: How does a Load Balancer (like Nginx) decide which user gets the "Canary" version vs the "Standard" version?

Summary

Advanced deployment isn't about "Getting the code there"; it's about Risk Management. By using Blue-Green or Canary patterns, you protect your company's reputation and your users' experience from the inevitable bugs that exist in every piece of software.

Next Lesson: Controlling the live site: Feature Flags (GitLab Unleash).

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn