Theme
Tier 5 · lesson 6 of 9 · 30 min

Deploy, and roll back with a pull

You will: Ship the robot image by digest, and make rollback something that cannot fail to build.

Builds on A release is a tag plus evidence and A pipeline for a machine with motors.

A robot is a deployment target with awkward properties. It may be on a flaky home network. It cannot be scaled horizontally. Restarting it has physical consequences. A bad web deploy serves errors; a bad robot deploy moves something.

Most of what you know still applies, and the most important piece is the oldest: if the only way back is a successful build, you do not have a rollback — you have a hope. Every push to main publishes the robot image under an immutable sha- tag, for both architectures, so the same image runs on a mini PC or a Raspberry Pi next to the arm. Rolling back is pulling an older tag and starting it. Nothing is rebuilt, so the version you return to is the version that was tested.

Deployment is deliberately asymmetric. The robot pulls a published image, because it is remote and rollback has to be a pull. The small fleet view is designed to be built on the shared server from a checkout, like every other product on that box, because a second deployment model there would buy nothing. That half is a design, not a running service: the fleet view has not been deployed anywhere yet, and deploy/README.md is the procedure for when it is.

And nothing reaches into the robot. Robots sit behind home routers where inbound connections do not work — but the real reason is that a robot must never wait on a server. Each robot pushes a small report every ten seconds, one way. This was demonstrated rather than asserted: killing the fleet service mid-run left the robot reporting ready and its scenarios passing, while its reporter logged a single, throttled warning. Losing the network degrades what you can see. It must never degrade what the robot can do.

In the simulation

The robot-side counterpart of a pull: Record keeps a motion exactly as it ran, and Replay brings that same motion back without working anything out again. Nothing is rebuilt, so what you return to is what you saw.

Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.

The SO-101 loads as you reach it.

In this lesson

  1. Press Record, send the arm to ready with its button, and press Record again there to stop.
  2. Move on to something else. Send the arm to rest.
  3. Roll back. Press Replay and let it finish at ready, the version you recorded.

Do it

  1. Build the robot image if you have not, and read what it says about itself.

    make runtime
    docker inspect --format '{{json .Config.Labels}}' threevn-robotics-runtime:local
    

    Expect: Source, licence, revision, creation time and title — answerable without starting it.

  2. Read the rollback procedure. It is four commands.

    grep -n -A10 "### Rolling back is a pull" docs/deployment.md
    
  3. Rehearse it locally: tag your current image as "previous", build a change, then roll back to "previous" without building anything.

    docker tag threevn-robotics-runtime:local threevn-robotics-runtime:previous
    docker run --rm threevn-robotics-runtime:previous bash -lc 'echo "$THREEVN_GIT_COMMIT"'
    
You will know it worked when: You can name the exact commit an image was built from without running it, and roll back to a previous image without a build.

When it goes wrong

A deploy failed halfway and the robot is down.

Why: The old container was stopped before the new image had finished downloading.

Fix: Pull first, then replace. A failed pull leaves the old version running.

The robot "rolled back" but is behaving like the broken version.

Why: Rolled back to a moving tag, like latest, that someone had already moved.

Fix: Roll back to an immutable sha- tag, or a digest.

Terms

Immutable tag
An image tag that is never moved once pushed — here sha-<commit>. Safe to roll back to.
Pull-based rollback
Returning to a previous version by pulling an image that already exists, never by rebuilding.
Push telemetry
The robot sending reports outwards on its own schedule, so it never waits on, or is reachable from, a server.

Every term in the course: glossary.

Check yourself

Answer in your head first, then open it.

Why must rollback never depend on a build?

The moment you need a rollback is the moment something is broken, possibly the build itself. And a rebuilt image is not the image that was tested.

Why does the robot push, rather than the server pulling from it?

Robots are behind home routers that block inbound connections — and more fundamentally, a robot must never wait on a server.

Stretch

Write the rollback runbook for your own robot in five lines or fewer: how you find the last good version, how you bring it back, and how you know it worked. Which line depends on something that does not exist yet?

Going deeper