Learning paths / Vibe coding to production / Operate, cost and when to stop

Lab: roll back an agent's bad release

Verified lab · 30 min · Module 9, lesson 3 of 435 min left in this module

Module 9 · Operate, cost and when to stopLesson 3 of 4

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

Goal: Let your agent ship a broken release with a project token, confirm the old version keeps serving, read the failure, and roll back.

You need hello-web Running in learn with a health check on /healthz (lab 5.1.4), and your agent started with the agent_deploy token from lab 4.8.3.

Haven't done lab 5.1.4, or the token expired?

Deploy hello-web yourself:

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

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. Without the health check, the broken release passes and goes live.

Expired token: create a new one as in lab 4.8.3, steps 4 and 5.

  1. Have the agent record a known-good version

    Send your agent:

    Run: csph deploy --image quay.io/computesphere/learn-hello-web:1.0.0 --name hello-web --port 8080
    Show me the command first and wait for my OK. Report the result.
    

    You should seeAfter your OK, the agent reports Running and your URL, or unchanged.

  2. Let it ship the new release

    Now deploy quay.io/computesphere/learn-hello-web-broken:1.0.0 the same way.
    Wait for my OK first.
    

    Send it at least a minute after step 1: deploy history keeps one version per minute. This image answers pages but fails its health check, like a release that passed review and still breaks.

    You should seeAfter your OK, csph reports Running within seconds while the new version starts.

  3. Watch the old version keep serving

    In your own terminal, while you wait:

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

    Check yourself

    The new release is failing its health check. Who is being served right now?

    You should see200 on every call; after about ten minutes, hello-web shows Failed.

  4. Read the failure before acting

    Read hello-web's deploy log. Quote the lines that explain the failure.
    Don't change anything.
    

    Check its quote against csph logs hello-web --kind deploy yourself.

    You should seeThe agent quotes deploy-log lines showing the health check failing.

  5. 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 seehello-web Running again on the step 1 version.

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 deploy log.