Appearance
Upgrade and rollback
Upgrading means swapping the running images for a new build and running the database migrations. The one rule: never upgrade while a task is claimed, running or in gates. The upgrade script checks this for you and refuses.
Upgrade the local single-host stack
Run deploy/upgrade.sh (use --dry-run first to see the steps). It does the whole upgrade in one go:
- Check the intake configuration against the new build (changes nothing).
- Create the per-service database roles and their password files.
- Renew the operator certificate if it is past two thirds of its life.
- Stop the agent runner and the preflight runner.
- Pull, back up, migrate and recreate the stack (
ht upgrade). - Approve the existing runner evidence key for each runner that used it (once).
- Rebuild the host agent runner.
- Recreate the preflight sandbox network and proxy, and wait until the proxy answers.
- Start the preflight runner, run the end-to-end check (
ht agent-runner check, thenht verify), and only then start the agent runner.
If anything fails, both runners are stopped again, FAIL is printed and the exit code is non-zero. Order matters: a runner must never run while the sandbox network is recreated, or a job claimed then cannot reach its proxy.
The script fetches the target commit from the checkout's origin. If that remote holds a stale token, export a fresh GH_TOKEN first; it is passed through an environment header and never written to .git/config.
Roll back
Schema changes are forward-only, so rollback depends on whether a migration ran.
- No migration ran: set
FORELEAD_PREVIOUS_IMAGEand runsh deploy/activate.sh. If startup or the loop check fails it restores the previous image by itself. It never deletes volumes. - A migration ran: restore the database backup together with the previous image. Images that check the schema version refuse to start against a database a newer build migrated (
FORELEAD_ALLOW_NEWER_SCHEMA=1overrides, at your own risk). - Older images do not have the
healthcommand or the loopback listener. Rollback also appliesdeploy/compose.rollback.yaml, which restores the old TCP probes and turns off the runner probe. Use the basecompose.yamlagain once you are back on a new image.
Before you start
- Back up the Postgres volume and the external secrets.
- Keep the previous image available.
- Set
FORELEAD_COMPOSE_FILESto the files the running stack uses;activate.shrefuses to start without it. - Set
FORELEAD_LOOP_TESTto the operator loop driver. An upgrade does not report success until it passes (Operator loop).
Technical notes
- Compose health checks verify loopback readiness only. They do not check mTLS or provider calls: verify those with real client certificates before accepting a deployment.
- The three AWS tenant hosts start from a deploy bundle with
deploy/cloud/start.sh app|runner|mirror(see AWS tenant). - The upgrade also asks whether it can read the old shared runner key.
LEGACY_RUNNER_KEY_FILEcan point at a readable copy.
Sources
deploy/upgrade.sh,deploy/activate.sh,deploy/compose.rollback.yamldeploy/README.md("Updates and recovery", "Local stack upgrade and certificates")- Full text: Single-host deployment guide