
Steven Stout
Staff .NET Engineer | AI-Assisted Development with Quality Gates | 12 Years Full Stack .NET, 7 Fully Remote
· first posted on LinkedIn · 7 min read
At previous jobs, I ran blue-green deployments the traditional way. My own site swaps one container image in place on Azure App Service, because that saves about $56 a month.
This post sets the two side by side: what blue-green does with a container image, what a deploy in an App Service does instead, and what the one container has to do for itself to make up the difference. The settings and code lines are copied from my site's public repository at release 1.0.5.173.
Blue-green with container images
A container image is a whole site packaged as one sealed file: the program and everything it needs to run. A container is one running copy of an image. Blue-green deployment needs three pieces:
- Blue is a full copy of the site, running the current image. Today it serves every visitor.
- Green is a second full copy. Today it serves no one.
- A router sits in front of both and sends every request to one of them.
A deploy takes four steps:
- Step 1. Start the new image on green. Blue keeps serving, so visitors notice nothing.
- Step 2. Wait until green answers, and check it there.
- Step 3. Flip the router. Every new request now goes to green.
- Step 4. Leave blue running. If green misbehaves, flip the router back.
At previous jobs, I ran blue-green deployments this traditional way, to keep downtime to a minimum. At my previous job, the flip itself took about 5 seconds. We verified everything on the second copy before it, and we ran the SQL change scripts as we flipped, which guaranteed almost no downtime.
That setup had a fourth piece: user sessions lived in a Redis cache that sat outside the blue and green copies. Redis is a fast in-memory data store. Both copies read the same sessions from it, so a flip never made anyone log in again.
One quote worth keeping
Martin Fowler - Chief Scientist - Thoughtworks
"Blue-green deployment also gives you a rapid way to rollback"
He wrote that in his 2010 article, BlueGreenDeployment. The rollback is Step 4: the old copy is still running, so going back is one flip.
A deploy in an App Service
TheYard is my portfolio site, a live used-vehicle auction app I built and run on Azure in C# and .NET. It's a passion project, and I pay its Azure bill myself. It runs on Azure App Service, Microsoft's service for hosting web apps, as three pieces:
- An App Service plan is the rented server: the B2 size, 2 vCPU and 3.5 GB of memory.
- A web app is a place on that server where one program runs.
- One container runs in that web app, from the image of the current release.
The web app is told which image to run, to stay awake, and where to ask whether the program is alive:
linuxFxVersion: 'DOCKER|${appImage}'alwaysOn: truehealthCheckPath: '/healthz'
That's infra/appservice.bicep. A deploy changes one thing, the image. This is the whole command, where arm is the script's own retry helper:
arm az webapp config set -g "$RG" -n "$APP" --linux-fx-version "DOCKER|$GHCR_IMAGE" --generic-configurations '{"acrUseManagedIdentityCreds": false}' -o none
That's deploy.yml. App Service then does the rest on its own:
- It pulls the new image and starts a container from it on the same server, while the old container keeps answering.
- It moves visitors to the new container as soon as that container answers.
- It stops the old container.
A probe that requested ten of the site's addresses every two seconds caught that switch on November 11. One request was answered by release 1.0.5.18, and the next one, two seconds later, by release 1.0.5.19:
11:25:53.410 sql origin /api/version 200 303 1.0.5.1811:25:55.416 sql origin /api/version 200 382 1.0.5.19
Across that deploy and one more the next day, the longest stretch with no good answer on any address was 2 to 4 seconds, and 2 seconds is the probe's own interval. In October, on a smaller plan, the same stretch was 2 to 5 minutes. The numbers are on the Performance page, under "What a deploy costs a visitor".
Side by side
- Copies running. Blue-green: two full copies, all the time. App Service: one container, with a brief overlap on the same server during a deploy.
- Checked before visitors arrive. Blue-green: yes, on the idle copy. App Service: no, visitors move as soon as the new container answers.
- The switch. Blue-green: a router flip, about 5 seconds at my previous job. App Service: the platform moves visitors itself.
- The way back. Blue-green: flip the router back. App Service: deploy the previous image again.
- Logins. Blue-green: a session store outside both copies. TheYard: a signed token in a cookie.
- Cost on Azure. Blue-green: deployment slots, which need the Standard tier, about $56 a month more than the $13 plan TheYard ran on in October. In place: $0 more.
Deployment slots are how App Service sells blue-green. Microsoft Learn's page on deployment slots describes a slot as a live app with its own address: you deploy to the staging slot, Azure warms it up, a swap switches the routing, and swapping again brings the previous version back. Slots need the Standard, Premium or Isolated tier.
So TheYard's deploys are not blue-green, and I don't call them zero downtime. There is no copy to check first and no flip back.
What the one container has to do for itself
Without a checked second copy, the new container is in front of visitors the moment it answers. Three details make that safe enough for this site.
It answers first and loads after. The container holds a catalog of 100,000 vehicles in memory. It used to load them before answering anything. Now the startup code hands the loading to a background task and returns right away, so the web server begins answering at once:
_ = Task.Run(async () =>
await backends.Default.Startup.Time("bids", backends.Default.Bids.LoadAsync, stopping);await backends.Default.Startup.Time("catalogue", backends.Default.Inventory.WarmAsync, stopping);backends.Default.Startup.Ready();
return Task.CompletedTask;
That's CatalogueWarm.cs. The code spells it "catalogue". A request that needs the catalog during the load waits for it without tying up a thread, then gets its answer.
It says when it's ready. Two addresses tell the truth about the container. /healthz says only that the program is up:
private static ContentHttpResult Liveness() => TypedResults.Text("ok");
/readyz says whether the catalog is in. Until it is, the answer is HTTP status 503 with the title "Not ready". After that:
return TypedResults.Text("ready");
Both are in HealthEndpoints.cs. The deploy waits on /readyz before it calls a release done, and it's the same signal a second copy would wait on before a flip.
It keeps logins out of the container. At my previous job, Redis kept people logged in through a flip. TheYard needs no Redis, because it keeps no sessions on the server. A login is a signed token in a secure, httpOnly cookie, which means scripts on the page can't read it. The key that signs it is a setting on the web app, and every new container gets the same one:
{ name: 'Auth__SigningKey', value: authSigningKey }
A new container can read cookies the old one signed, so a restart doesn't log anyone out.
Why one container, for now
The price is the reason. In October, slots cost more than four times what the site's whole plan did, on a passion project. Before paying, I measured where the downtime came from, and the startup fix above cost $0.
That work was roughed in within one day, with me as the architect and Claude as the drafter. By my estimate, before AI those hours cost more than the $56 a month they avoid.
The site's decision record, Blue-green on a $13 plan, measured and held, prices every option and names what brings blue-green back: a real need for zero downtime, or enough free memory for a second copy.
A simple way to remember
- Two copies → check first, flip, flip back
- One container → answer first, say when ready
- Logins → outside the copies, or in a signed cookie
- Hours too costly → you architect, Claude drafts
When a deploy goes wrong on your team, how do you go back: a flip, or a redeploy? Tell me on LinkedIn.
References
- BlueGreenDeployment, Martin Fowler, Chief Scientist, Thoughtworks, March 1, 2010
- Set up staging environments in Azure App Service, Microsoft Learn, read November 27, 2026
- Decision record: Blue-green on a $13 plan, measured and held
- Decision record: Accounts
- TheYard Performance page, "What a deploy costs a visitor"
- TheYard on GitHub at release 1.0.5.173, commit a234c7a
11 reads on TheYard0 this week
