Add federated update script: one-command, roll-backable core updates
release gate / check (push) Failing after 6m16s

Other cores had an installer but no updater — updates meant re-running the
workstation tar-sync by hand. deploy/federated/update.sh ships inside the
app dir (the installer stages deploy/), so every installed core already
has its updater:

  sudo bash /federated/apps/superbrain/deploy/federated/update.sh [git-ref]

Flow, in house-safety order: re-exec from /tmp (the sync overwrites the
running script), clone the repo at REF (default main; sha refs fall back
to full-clone+checkout), record current image ids, compressed pre-update
pg_dump (last 5 retained, emptiness-checked), sync source (.env/data
untouched, .git kept out of the app dir/build context), refresh
lib+service suite files (parse-checked before replacing, backed up),
rebuild, force-recreate (migrate one-shot applies new migrations),
health-probe app+web for up to 3 minutes — and on ANY failure retag the
previous images and recreate, pointing at the dump.

Deliberate non-goal: an in-app update button. The scratch containers have
no docker socket and must never get one (read_only + cap_drop ALL is the
hardening model); host-level operator action is the trust boundary until
CI publishes registry images, at which point the generic house upgrade
flow and the panel button supersede this script (IMAGE_VERSION_HOLD comes
out of .env).

Also: .dockerignore gains .update-backups (dumps live under the app dir,
which is the build context); README/STRATEGY/install.sh document the
update path. shellcheck clean; tested live on the production core.
This commit is contained in:
Andrew S Erwin
2026-10-28 20:05:10 -05:00
parent 0848453732
commit e0d922547b
5 changed files with 173 additions and 7 deletions
+15
View File
@@ -386,6 +386,21 @@ Prerequisites: Authelia with the OIDC provider configured, shared
sender account). Full design record, IP plan, upgrade flow and incident
history: [deploy/federated/STRATEGY.md](deploy/federated/STRATEGY.md).
**Updating** an installed core (interim source-build mode) is one command
on the host:
```bash
sudo bash /federated/apps/superbrain/deploy/federated/update.sh [git-ref]
```
It clones the requested revision (default `main`), takes a pre-update
`pg_dump` (last 5 kept under the app dir), refreshes the suite integration
files, rebuilds the images, recreates the stack (migrations run
automatically), health-probes both containers, and **rolls back to the
previous images automatically on any failure**. When CI starts publishing
registry images, the generic house `upgrade` flow and the panel button
supersede this script (drop `IMAGE_VERSION_HOLD=1` from the app `.env`).
## Client test build
Use [RUNNING.md](RUNNING.md) for the client handoff. Test login, bookmark editing,