From b217bedd8c0afd0dd9397411ea20200d9aee6171 Mon Sep 17 00:00:00 2001 From: Andrew S Erwin Date: Wed, 28 Oct 2026 20:12:35 -0500 Subject: [PATCH] update.sh: payload-sync only, never clobber the generated compose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- deploy/federated/update.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/deploy/federated/update.sh b/deploy/federated/update.sh index 05305c9..5808556 100755 --- a/deploy/federated/update.sh +++ b/deploy/federated/update.sh @@ -89,8 +89,21 @@ rollback() { } # --- 4. Sync, refresh suite files, build, recreate -------------------------------- -say "Syncing source into $APP_DIR (.env and data untouched)" -cp -a "$STAGE/." "$APP_DIR/" +# Payload-sync ONLY the tracked source paths (same list as the installer's +# 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 # install.sh conventions; a failing lib parse aborts BEFORE anything else).