CD8: Delivery and rollback

Lesson 2 of 5 · reading 15–25 minutes; practice and project time is on the module page

Deployment strategies

🎯You'll be able to

Compare recreate, rolling, blue-green and canary deployments, and choose one based on risk, cost and how quickly you need to undo.

🏠The everyday picture

A restaurant changing its menu can close for a day to reprint everything (recreate), change one table's menu at a time (rolling), set up a fully new dining room next door and move everyone at once (blue-green), or give the new dish to a few tables first and watch their faces (canary).

📘What it really is

Strategy Downtime Extra capacity Speed of undo Users exposed to a bad release
Recreate yes none slow (redeploy) all
Rolling none a little medium growing share during the roll
Blue-green none double, briefly fast (switch back) all, after the switch
Canary none a little fast a small share at first

📝A worked example

Input: RouteRani's finished Terraform with 2 copies, deploying 1.0.2 while tools/load.js sends traffic.

Expected output: docker ps during the deploy shows four copies for a few seconds (two 1.0.1, two 1.0.2, each new one becoming healthy), then only the two new ones. The x-version header switches from 1.0.1 to 1.0.2 during the overlap, with some requests on each. This is a rolling-style deploy where all new copies start together, then the old ones are removed.

🌍Where it's used

📝Case scenario

A music streaming service released a new recommendations engine to everyone at once. It worked in tests but used three times the expected memory under real traffic, and copies started crashing within minutes. With a canary, 5% of traffic would have shown the memory climb and stopped the rollout. They moved to canary releases with automatic comparison of error rates and memory.

🖱️Try it

For each of these, choose a strategy and give one reason: an internal report generator used once a day; RouteRani's booking API; a payment gateway's new fraud rules; a new mobile app home screen. Success: you've used at least three different strategies, each with a reason about risk, cost or speed of undo.

⚠️Common mistakes

🛠️For your project

Project 2's deploys use a rolling-style replacement through create_before_destroy, and test 6 checks no requests fail during it.

✅Quick check

What does blue-green need that rolling doesn't?

Show the answer

Enough capacity to run two full versions at once, briefly.

Why is a canary safer for big changes?

Show the answer

Only a small share of users sees the new version until its metrics look good.

← PreviousContinuous delivery: build once, release many times
ProLearners Assist