Interim installs carry IMAGE_VERSION=local + IMAGE_VERSION_HOLD=1: the
hold makes upgrade_app skip the app, and the re-rendered registry compose
would pull a nonexistent :local tag. update.sh now detects the hold, drops
it, and pins IMAGE_VERSION to the service file's VERSION before invoking
the house upgrade flow.
The federated suite now installs Superbrain like every other house app:
pull images, run installapp, no source tree on the host.
Images (Docker Hub, federatedcomputer namespace, one shared tag per
release + :latest, linux/amd64 + linux/arm64):
superbrain-app Go API (scratch)
superbrain-web Next.js standalone
superbrain-migrate NEW self-contained db image: db/ baked in, entrypoint
db/bootstrap.sh waits for postgres, applies
schema.sql AS DB_USER on an empty database (object
ownership — migrations must be able to ALTER), then
always runs the checksummed ledger. Fresh install and
upgrade become the same command. The dev compose runs
the same bootstrap.sh (verified: non-empty DB skips
schema, applies pending migrations).
Release CI (.github/workflows/release.yml): semver tags without v prefix
(the suite's VERSION_RX); a smoke job bootstraps a throwaway PostgreSQL
with the migrate image (fresh schema + complete ledger + idempotent re-run)
and runs Go build/vet/unit BEFORE the publish job pushes — a broken db/
can never reach a tag the upgrade flow will pull. Requires
DOCKERHUB_USERNAME/DOCKERHUB_TOKEN secrets. Dockerfile stays legacy-
builder compatible (no BUILDPLATFORM cross-compile): dev hosts build
locally; CI builds each arch natively under qemu.
Federated integration:
- lib-superbrain.sh: compose pulls federatedcomputer/superbrain-*:
${IMAGE_VERSION} (bookstack quoting), no build: keys, no
IMAGE_VERSION_HOLD; compose generation extracted into
render_superbrain_compose (install + update share it); schema.sql
pre-apply and host image builds removed; IMAGE_VERSION is the only
VERSION= line in the generated .env (upgrade_app's sed matches every
occurrence — the file says so in words that don't contain the pattern).
- service file: CONTAINER=federatedcomputer/superbrain-app (must equal the
first image: repository — upgrade_app compares it), VERSION=1.0.0.
- services/superbrain/upgrade/pre hook (listmonk pattern): pre-upgrade
pg_dump into .update-backups (5 retained) + pulls web/migrate at the
target version (upgrade_app pulls only the app image).
- install.sh: registry messaging, installs the upgrade hook, clone is only
for deploy files now.
- update.sh REWRITTEN for registry mode: the app dir no longer contains
source, so it runs from a repo clone — sync lib/service/hook (parse-
checked, backed up) -> re-render compose -> /federated/bin/upgrade
superbrain -> same-version compose safety pass -> health probe.
- STRATEGY.md interim-mode section replaced with the registry-mode record.
README: federated section updated (pulls, not builds; house upgrade flow)
and a new 'Environment variable reference' section — every variable the
stack reads, required/optional, defaults, grouped (core, compose, access
policy, OIDC, SMTP, AI, federated-only, tests-only), so generated .env
files stay correct as features are added.
Found by the live rehearsal on core: cp -a of the whole clone over the
app dir replaced config_superbrain's GENERATED docker-compose.yml (fixed
IPs, core network, env_file) with the repo's dev compose, whose :?
POSTGRES_PASSWORD interpolation then failed the build. The rollback path
worked exactly as designed (previous images retagged; running containers
were never touched), and the compose was restored by replaying the lib
heredoc with the install-time values.
Fix: sync the same explicit payload as the installer's staging (main.go,
go.mod, go.sum, Dockerfile, .dockerignore, internal, db, web, deploy) via
tar — the generated compose, .env and .update-backups are untouchable.
Plus a pre-build guard: the app dir's compose must contain the generated
stack's container_name or the update refuses to proceed.
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.
deploy/federated/install.sh packages what the 2026-10-26 core install did
by hand, for any operator running their own federated suite with repo
access. Run on the core host as root; it:
- Preflights the suite: installapp/functions.sh//etc/federated, the core
docker network, Authelia (REQUIRED — the core tier is SSO-only, so an
install without Authelia would lock everyone out) and the fcore SMTP
credential source for the notification email channel.
- Refuses when the app dir exists, and checks the fixed core-network IPs
(.93/.94/.95) against live allocations and other services' INTERNAL_IP;
SUPERBRAIN_{WEB,APP,MIGRATE}_IP override and rewrite lib + service file.
- Stages the source by git clone (SUPERBRAIN_REPO/SUPERBRAIN_REF) or from
a local tree (SUPERBRAIN_SRC), same payload as the workstation tar-sync.
- Installs lib/superbrain.sh + services/superbrain/service (backing up
anything existing), then runs the house flow via
/federated/bin/installapp superbrain (config/start/configsso/monitors/
superpanel catalog).
- Verifies containers, the Authelia client AND claims-policy markers (the
AccessDenied footgun), and the HTTPS login page with a retry loop for
traefik cert provisioning; prints the operator's first-login steps,
including that Authelia subjects are opaque UUIDs from
user_opaque_identifier (not usernames) for offline SEED_SUBJECT links.
Validated: shellcheck clean; preflight chain smoke-tested against the
live core (correct refuse at the already-installed guard). STRATEGY.md
interim-mode section now points at the installer.
The tier switch removed core's SMTP config when password reset became dead
in oidc mode, but the notification engine's email channel needs the same
relay. Reinstate the house pattern in config_superbrain (fcore submission
on mail.$DOMAIN:587, credential read from authelia's secret or
superpanel's .env, NETGUARD_TRUSTED_HOSTS pin for split-horizon DNS) and
correct STRATEGY.md, including the stale 'app sends no outbound mail'
claim in the suite-service notes.
Deployed to core: migration 013 applied, SMTP+pin env verified in the app
container, /api/notifications/* routes live behind auth (401 anonymous),
clean app/web logs. The live /federated/lib/superbrain.sh was synced from
this repo copy (backup kept as superbrain.sh.bak-20261026).
Product tiers (decided 2026-10-26): TIER=core|multi is the deployment knob.
core (federated install, paying customers) derives AUTH_MODE=oidc with
signup/bootstrap off - Authelia is the only way in and accounts are
provisioned upstream (Superpanel -> LDAP -> Authelia). multi (hosted
self-service) derives AUTH_MODE=password: signup, password login and
SMTP-backed self-reset, with the OIDC bridge refused even when variables
are set. Explicit AUTH_MODE/SIGNUP_ENABLED/ALLOW_BOOTSTRAP_SIGNUP always
override the tier; invalid values fail startup instead of falling back.
Go enforces every gate at the API; the web UI mirrors it (conditional
credentials provider, SSO-only login page, signup/reset redirects).
Authelia-only bootstrap: ProvisionExternal grants ADMIN to ADMIN_EMAILS
addresses at first SSO login, and --seed accepts SEED_SUBJECT to link a
pre-existing password account offline - the only path when 409 'account
link required' meets a deployment where nobody can password-login to call
oidc-link.
Self-service password reset (multi tier): POST /api/password/forgot and
/api/password/reset with hashed single-use 30-minute tokens
(PasswordResetToken, migration 011 + schema.sql), enumeration-safe
identical 200s, per-IP rate limits, tokenVersion bump on success (all
prior sessions revoked), OIDC-only accounts excluded by design. New
internal/mailer sends via netguard+outbound budget; NETGUARD_TRUSTED_HOSTS
pins operator-chosen relays that resolve privately (split-horizon DNS)
without the blanket INTEGRATIONS_ALLOW_PRIVATE switch. Web gains
/forgot-password and /reset-password pages and a login-page link.
Federated install fixes: the Authelia client now registers a
claims_policy putting email in the ID token (production AccessDenied -
Auth.js builds OIDC profiles exclusively from ID-token claims), config is
validated before restarting the shared Authelia, uninstall removes the
claims block marker-safely, and generated .env switches to TIER=core with
a password-less admin seed.
Tests: tier derivation/override unit tests, mode and tier integration
tests (403 gates, bridge refusal, ADMIN_EMAILS promotion, offline link),
reset-flow integration tests against a loopback SMTP fake, netguard
trusted-host tests. Docs: RUNNING.md, web/docs/AUTHELIA.md section 7,
.env.example, STRATEGY.md.