// CONTENTS Part 11 · Upgrade and release

// PART 11

Rollback

Chapter 48 / 60 2 min read English Part 11 of 15

Rollback is a runbook you rehearse, not an improvisation. This page covers the binary, the UI, the secrets, and the one case — migrations — where rollback becomes restore.

Binary rollback

# 1. Stop the service BEFORE replacing the binary ("text file busy" otherwise).
sudo incus exec bot -- systemctl stop botserver

# 2. Push the previous known-good binary and start it.
sudo incus file push /opt/gbo/bin/botserver.previous bot/opt/gbo/bin/botserver
sudo incus exec bot -- bash -c 'chmod +x /opt/gbo/bin/botserver && systemctl start botserver'

# 3. UI-only rollback: push the previous ui/ directory. Static files are read
#    per request, so no restart is needed.
sudo incus file push -r /opt/gbo/bin/ui.previous bot/opt/gbo/bin/ui

Keep botserver.previous and ui.previous next to the live binaries at all times — a rollback you cannot execute in one command is a rollback you will fumble at 2 a.m. A second rollback in a row without a diagnosis is an escalation trigger; re-deploy the rolled-back version only after the root cause is known and fixed.

Migrations are NOT rolled back

A migration is not rolled back by the binary rollback. If the release included a migration, the old binary must boot against the new schema — check that before assuming rollback will work:

psql -h localhost -U postgres -d botserver -c   "SELECT version, run_on FROM __diesel_schema_migrations ORDER BY run_on DESC LIMIT 5;"

If the old binary cannot boot, the rollback becomes a restore: follow Backup and restore (scratch database first, verify, then swap names), and keep botserver_broken until the postmortem closes.

Secrets rollback

Vault keeps versioned secrets — read the previous version instead of inventing a value:

vault kv get -version=<previous> secret/gbo/llm
vault kv put secret/gbo/llm url=<old-url> model=<old-model> openai_key=<old-key>
sudo incus exec bot -- systemctl restart botserver

A JWT-secret rollback invalidates refresh tokens; access tokens expire naturally.

Container and appliance rollback

# Incus snapshot restore (copy to a new instance and swap names — there is
# no in-place restore for a running instance)
incus copy bot/pre-upgrade-20260101 bot-rollback && incus start bot-rollback

OS appliances roll back by reprovisioning the previous image; desktop-local installs roll back by replacing the files again (keep the previous tarball or AppImage — nothing is installed system-wide, so the swap is the rollback).

Verification after any rollback

sudo incus exec bot -- curl -s -o /dev/null -w '%{http_code}
' http://localhost:5858/health
psql -h localhost -U postgres -d botserver -c   "SELECT SUM(request_count) AS requests,
          SUM(CASE WHEN status_class = '5xx' THEN request_count ELSE 0 END) AS errors
     FROM ops_request_metrics WHERE bucket > NOW() - INTERVAL '10 minutes';"

Expected: /health returns 200 and the error rate falls back inside the budget within one burn window. Escalate to the incident commander if the service does not answer /health within 15 minutes of the rollback.

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move