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.
This commit is contained in:
Andrew S Erwin
2026-10-28 20:12:35 -05:00
parent e0d922547b
commit b217bedd8c
+15 -2
View File
@@ -89,8 +89,21 @@ rollback() {
} }
# --- 4. Sync, refresh suite files, build, recreate -------------------------------- # --- 4. Sync, refresh suite files, build, recreate --------------------------------
say "Syncing source into $APP_DIR (.env and data untouched)" # Payload-sync ONLY the tracked source paths (same list as the installer's
cp -a "$STAGE/." "$APP_DIR/" # staging). Never `cp -a` the whole clone over the app dir: the app dir's
# docker-compose.yml is GENERATED by config_superbrain (fixed IPs, core
# network, env_file) and the repo's dev compose would clobber it — hit in
# production 2026-10-29, caught by the rollback. .env, .update-backups and
# the generated compose are untouchable here.
say "Syncing source into $APP_DIR (generated compose/.env/data untouched)"
(cd "$STAGE" && tar cf - --exclude=node_modules --exclude=.next \
main.go go.mod go.sum Dockerfile .dockerignore internal db web deploy) \
| tar xf - -C "$APP_DIR"
# Sanity: the app dir must still hold the GENERATED federated compose
# (config_superbrain's), not the repo's dev stack.
grep -q "container_name: superbrain-app" "$APP_DIR/docker-compose.yml" \
|| die "$APP_DIR/docker-compose.yml is not the generated federated compose — refusing to build against it"
# Keep the house integration in step with the repo (both are backed up by # Keep the house integration in step with the repo (both are backed up by
# install.sh conventions; a failing lib parse aborts BEFORE anything else). # install.sh conventions; a failing lib parse aborts BEFORE anything else).