22 Commits
Author SHA1 Message Date
Andrew S Erwin 696fc929c6 release 1.2.5: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 6m41s
release / smoke (push) Successful in 10m43s
release / publish (push) Failing after 9m51s
2026-11-06 09:21:58 -06:00
Andrew S Erwin 0824700e4e Add the derived gateway image Dockerfile (referenced by STRATEGY; upstream-retirement TODO)
release gate / check (push) Failing after 6m52s
2026-11-05 15:31:38 -06:00
Andrew S Erwin d08cc9b543 STRATEGY: record the erwin MCP attach (1.2.4) and the interim gateway image
release gate / check (push) Failing after 6m15s
2026-11-05 15:06:20 -06:00
Andrew S Erwin 3816155b91 release 1.2.4: fix unescaped backticks in the compose render heredoc
release gate / check (push) Failing after 6m28s
release / smoke (push) Successful in 10m31s
release / publish (push) Failing after 9m57s
The unquoted heredoc in render_superbrain_compose turned the comment's
backticked 'docker container inspect superbrain' into command substitution;
re-rendering while the stack runs injected inspect JSON into the compose
file and update.sh's parse guard aborted (2026-11-05, core). Reworded;
1.2.3's /deploy remains defective for updates, use 1.2.4+.
2026-11-05 14:16:53 -06:00
Andrew S Erwin aefc84441c STRATEGY: record the 1.2.3 manual publish and the CI-secrets gap
release gate / check (push) Failing after 6m30s
2026-11-05 14:10:06 -06:00
Andrew S Erwin 2e95190cac Record the 2026-11-03 auto-upgrader outage and the fix layers
release gate / check (push) Failing after 6m28s
upgrade-federated.timer redeployed superbrain and left it down: superbrain
is absent from EXTRA_APPS in the Core repo's lib/functions.sh, so
bin/start fell through to usage/exit 2 and upgrade_app printed Done over a
dead stack (traefik default 404 for the hostname). Carries the Core-repo
fix as a format-patch (no push access to Core from here), documents the
IMAGE_VERSION_HOLD pin and the erwin-local commit, and the migrate-ledger
aggravator (DB at 017 vs .env pinned 1.0.1).
2026-11-04 09:43:33 -06:00
Andrew S Erwin 9a6fbe0d3f release 1.2.3: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 6m55s
release / smoke (push) Successful in 10m24s
release / publish (push) Failing after 9m49s
2026-11-02 22:14:19 -06:00
Andrew S Erwin ad9c351649 release 1.2.2: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 6m49s
release / smoke (push) Successful in 10m36s
release / publish (push) Failing after 9m54s
2026-11-02 21:56:51 -06:00
Andrew S Erwin 6fbe5f23bf STRATEGY: copy-paste-ready suite-side snippets for the mcpserver link
release gate / check (push) Failing after 6m45s
Also records the product framing: the MCP attach is how the core's
already-configured AI (Superpanel -> Hermes) reaches Superbrain data with
zero per-app LLM config - apps expose tools, the house agent owns the LLM.
Superbrain's own AI features (automations/assistant) keep resolving BYO
first, then the plan-gated AI_* server env key.
2026-11-02 21:07:48 -06:00
Andrew S Erwin 9a9c3bb80d release 1.2.1: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 6m43s
release / smoke (push) Successful in 10m28s
release / publish (push) Failing after 10m0s
2026-11-02 14:49:57 -06:00
Andrew S Erwin 9990c33712 release 1.2.0: bump federated service VERSION
release gate / check (push) Failing after 7m30s
release / smoke (push) Successful in 10m42s
release / publish (push) Failing after 9m51s
2026-11-02 14:28:21 -06:00
Andrew S Erwin e6ab778bd5 Add personal API keys, superbrain-mcp, and fix Markdown prose styling
API keys & MCP (the mcpserver-link prerequisite from STRATEGY.md):
- ApiKey table (migration 017 + schema.sql): hash-only storage of personal
  "sb_..." Bearer credentials, unique keyHash, owner cascade.
- internal/auth/apikeys.go + AuthMiddleware fork: keys resolve before the
  assertion/cookie channels; gated on the mcp-core connector at issuance
  AND at every use (downgrade 403s); independent of tokenVersion so "sign
  out everywhere" never breaks a gateway link; view-as stays browser-only.
- /api/keys GET/POST/DELETE: plaintext shown exactly once, 10-key cap under
  the user lock, owner-scoped revocation; Settings -> API Keys tab.
- mcp/: superbrain-mcp, a pip-installable stdio MCP server (listmonk-mcp
  pattern) with bookmarks/tags/pages tools, version-safe updates; the
  federated gateway spawns it via config_mcpserver_superbrain() in
  deploy/federated/lib-superbrain.sh (mints the gateway key in-db, points
  it at http://superbrain-app:8080). STRATEGY.md records the remaining
  suite-side registry work.
- Tests: TestAPIKeys (plan gate, cap, revocation, tokenVersion semantics,
  downgrade-at-use); full DB-backed suite, db-converge, live MCP-client
  smoke all pass.

Markdown (Gitea issue #3): add @tailwindcss/typography and enable it in
tailwind.config.ts. The prose wrapper was a no-op without it, so Tailwind
Preflight flattened headings/blockquotes to body text while bold/italic
survived - exactly the reported symptom. Verified in the built CSS.

Gitea: #2 and #3 closed with reference notes; #1 stays open pending the
Superpanel core-AI walkthrough.
2026-11-02 14:27:58 -06:00
Andrew S Erwin febc7b2195 release 1.1.1: bump federated service VERSION (BYO AI instructions)
release gate / check (push) Failing after 6m21s
release / smoke (push) Successful in 10m17s
release / publish (push) Failing after 9m54s
2026-11-01 12:46:15 -06:00
carly 1dfd41986c Ship install/update scripts in the migrate image; no repo clone on hosts
release gate / check (push) Failing after 6m45s
release / smoke (push) Successful in 10m18s
release / publish (push) Failing after 9m55s
2026-10-30 12:03:07 -06:00
Andrew S Erwin d914a87e98 update.sh: migrate source-mode installs to registry mode
release gate / check (push) Failing after 6m19s
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.
2026-10-29 10:25:16 -05:00
Andrew S Erwin 341cdce026 Registry mode: publish app/web/migrate images, drop source builds on hosts
release gate / check (push) Canceled after 4m3s
release / smoke (push) Successful in 10m13s
release / publish (push) Failing after 12m48s
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.
2026-10-29 10:21:10 -05:00
Andrew S Erwin b217bedd8c update.sh: payload-sync only, never clobber the generated compose
release gate / check (push) Failing after 6m46s
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.
2026-10-28 20:12:35 -05:00
Andrew S Erwin e0d922547b 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.
2026-10-28 20:05:10 -05:00
Andrew S Erwin 2fa3979451 Add one-shot federated installer for other cores
release gate / check (push) Failing after 6m37s
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.
2026-10-26 23:33:50 -05:00
Andrew S Erwin f72e4fedb8 Federated install: SMTP relay for the notification email channel on core
release gate / check (push) Failing after 6m54s
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).
2026-10-26 15:09:04 -05:00
Andrew S Erwin f372936894 Add deployment tiers, self-service password reset, and Authelia SSO fixes
release gate / check (push) Failing after 7m28s
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.
2026-10-26 12:28:43 -05:00
Andrew S Erwin d7a2abc683 Deploy script and AUTHELIA documentation (Tim did that)
release gate / check (push) Failing after 6m53s
2026-10-25 01:02:52 -05:00