BOOK DEEP READ · CONTINUOUS DELIVERY · CH 10

Deploying and Releasing Applications

Continuous Delivery · Ch 10 · Jez Humble & David Farley · 2010

中文 →

What is this chapter about?

The apps on your phone and the sites you open every day quietly swap themselves for a new version every week, sometimes every day. This chapter is about how you swap them — how a new version reaches thousands of machines without disturbing a single person using it, and the more important half: when it turns out to be wrong, how you get back within two minutes.

An analogy

Shipping used to look like closing a restaurant for a refit: hang the "closed" sign at ten at night, a crew works until three in the morning, and you open the doors next day and pray. This chapter teaches two other moves.

The first is blue-green: don't close. Fit out an identical restaurant next door, stock it, do a trial run, then change the sign at the corner — customers walk into the new place on their own. If something is off, change the sign back. Ten seconds, and the old place is still standing.

The second is canary (named for the bird miners carried underground: the bird goes quiet first, and everyone leaves). Serve the new dish to two tables out of a hundred and watch them. Fine? Widen it. Not fine? Pull it — at worst, two tables ever tasted it.

Why the old world was hard

The hard part was never pushing the new version out. It was that nobody had rehearsed it. A release was a forty-page manual typed in by one person at 2am; the test environments followed one set of steps and production followed another — so production was the one performance in the whole run that never had a dress rehearsal.

The back door was worse. The last page of the manual usually said "to revert, do the above in reverse", and nobody had ever actually run that. Its first execution was on the worst night of the year. A lot of famous outages have that shape: the new version wasn't the disaster — being unable to get back was.

How this chapter fixes it

One: the moves you make going live must be the moves you rehearse daily. Test, staging and production all get the same automated script installing the same package; only a few lines of configuration differ. You do it right on the hundred-and-first try because you did it a hundred times before.

Two: being able to go back matters more than being able to go forward. Rollback shouldn't be a contingency sleeping in a document; it should be an ordinary function you use constantly. A path you walk every day is the one you can trust in the rain.

Three: don't swap everything at once. Swap a sliver, watch the dashboards, then widen — turning the release from an on/off switch into a dial you can turn slowly.

The one cost you can't dodge

Code goes back in seconds. Data doesn't. Whatever the new version already wrote in its new format, the old version may simply be unable to read — so the real difficulty was never putting the program back, it's making one pile of data legible to both versions at once.

One line to remember

Turn releasing from "a few times a year, everyone up all night" into "any time, one button to undo": the same script deploys every environment, new versions go out to a sliver first, and the road back gets walked every single day.

Want the actual cutover mechanics, how much traffic a canary really takes, and why rollback always jams on the data? → Switch to the deep read