Learning paths / Deploy on ComputeSphere / The deployment lifecycle

Lab: roll back a bad release

Verified lab · 25 min · Module 7, lesson 5 of 630 min left in this module

Module 7 · The deployment lifecycleLesson 5 of 6

Self-checked for now. Automatic checking arrives with sign-in; until then, tick off each item under Check your work yourself.

Goal: Ship a broken release, see the old version keep serving, and roll back to it.

You need hello-web Running with a health check on /healthz, from lab 5.1.4.

Haven't done lab 5.1.4?

Deploy it:

csph deploy --image quay.io/computesphere/learn-hello-web:1.0.0 --name hello-web --port 8080

Then in the console open hello-web, go to Settings, choose Add health check, and set Endpoint path /healthz, Port 8080, Initial delay 5, Check interval 10. Choose Save, then Redeploy now.

The health check is what makes this lab work. Without it, the broken release passes and goes live.

  1. Record a known-good version

    csph deploy --image quay.io/computesphere/learn-hello-web:1.0.0 --name hello-web --port 8080
    

    A console settings change doesn't record a version; a deploy that changes something does. This is the version you'll come back to.

    You should seecsph prints Running and your URL, or unchanged if this is already the current version.

  2. Ship the broken release

    csph deploy --image quay.io/computesphere/learn-hello-web-broken:1.0.0 --name hello-web --port 8080
    

    Wait a minute after step 1 first: deploy history keeps one version per minute, so a quicker release won't get its own version to roll back from. The new version then gets about ten minutes to pass its health check.

    You should seecsph prints Running within seconds, while the new version is still starting.

  3. Watch the old version keep serving

    In a second terminal, while you wait:

    curl -s -o /dev/null -w "%{http_code}\n" https://<your-hello-web-url>/
    

    Check yourself

    The new version is failing its health check. Why does your URL still answer 200?

    You should see200 on every call; after about ten minutes the deployment shows Failed.

  4. Roll back

    Open hello-web. Under Recent deployments, choose Roll back next to the step 1 version, then Roll back to v….

    A rollback restores that version's image, variables and health check. If Settings then shows no health check, your step 1 version predates it: add it again.

    You should seeRunning again, with your step 1 version marked Current under Recent deployments.

Check your work

  • If this doesn't pass

    Wait for the broken release to show Failed, about ten minutes, before rolling back. If it never fails, the health check wasn't on /healthz: set it up and start again from step 1.

  • If this doesn't pass

    Rolling back redeploys the old version, which takes about a minute. If it ends Failed, open that deployment's log.