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
+14 -4
View File
@@ -54,10 +54,20 @@ collision checks and `SUPERBRAIN_*_IP` overrides), runs
Authelia client + claims policy, and the HTTPS login page.
Images are tagged `superbrain-app:local` / `superbrain-web:local`, `.env`
carries `IMAGE_VERSION_HOLD=1` so the generic `upgrade` flow skips the app
cleanly, and the service file's `CONTAINER=superbrain-app` matches the first
`image:` line of the generated compose so `upgrade_app`'s rewrite-sed can
never mangle it. Switching to registry mode later = publish images, drop the
`build:` keys + hold marker, point `CONTAINER`/`VERSION` at the registry.
cleanly, and the service file's `CONTAINER=superbrain-app` matches the
first `image:` line of the generated compose so `upgrade_app`'s rewrite-sed
can never mangle it. **Updates** in interim mode run through
`deploy/federated/update.sh` (shipped inside the app dir): clone at REF →
pre-update pg_dump (5 retained) → sync (`.env`/data untouched) → refresh
lib+service files → build → force-recreate → health probe → automatic
rollback to the previous image tags on failure. A 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 registry mode.
Switching to registry mode later = publish images, drop the
`build:` keys + hold marker, point `CONTAINER`/`VERSION` at the registry —
at which point the house `upgrade` flow and panel button take over and
update.sh retires.
For the registry target: