Ship the updater-fix patcher as a repo artifact
release gate / check (push) Failing after 6m18s

Idempotent, anchor-asserted patcher for the Core suite's lib/functions.sh:
registers superbrain in EXTRA_APPS and makes upgrade_app verify the
post-redeploy start (alert + return 1 instead of printing Done over a dead
stack). Same change as core-fix-upgrade-superbrain.patch, applicable on any
core without git access to the Core repo:
  python3 deploy/federated/apply-updater-fix.py
(also bundled in migrate images at /deploy/ since 1.2.4)
This commit is contained in:
Andrew S Erwin
2026-11-06 09:45:33 -06:00
parent 696fc929c6
commit 6e8b89ab57
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""One-shot patch for /federated/lib/functions.sh (Core suite repo).
1) Register superbrain in EXTRA_APPS so /federated/bin/start can dispatch it.
Root cause of the 2026-11-03 outage: `bin/start superbrain` fell through
to usage/exit 2 because superbrain was absent from SERVICES, and
upgrade_app ignored the exit status and printed "Done upgrading" over a
dead stack (traefik then answered 404 for the whole host).
2) In upgrade_app, never report success over a stack that failed to start:
check the start exit status AND that the primary container is running
afterwards; alert via send_matrix_alert like the snapshot-failure path.
"""
import sys
P = "/federated/lib/functions.sh"
s = open(P).read()
old_apps = '"mcpserver" "erpnext" "hermes")'
new_apps = '"mcpserver" "erpnext" "hermes" "superbrain")'
if s.count(old_apps) != 1:
sys.exit("EXTRA_APPS anchor not found exactly once")
s = s.replace(old_apps, new_apps)
old_start = """ else
/federated/bin/start $APP
if [ -x "/federated/services/${APP}/upgrade/post" ]; then"""
new_start = """ else
/federated/bin/start $APP
if [ $? -ne 0 ] && [ "$(docker container inspect -f '{{.State.Running}}' $APP 2>/dev/null)" != "true" ]; then
send_matrix_alert "$DOMAIN ($EXTERNALIP): upgrade of $APP to $VERSION finished but the app did not come back up - investigate now, the service is likely DOWN"
echo -ne "ERROR: start $APP failed during upgrade - app may be DOWN, not reporting success.\\n"
return 1
fi
if [ -x "/federated/services/${APP}/upgrade/post" ]; then"""
if s.count(old_start) != 1:
sys.exit("start-call anchor not found exactly once")
s = s.replace(old_start, new_start)
open(P, "w").write(s)
print("functions.sh patched OK")