Found in the VM test: a site's PM2 daemon started from the agent's install
job belonged to the agent's service, so stopping or updating the agent took
down every site it had installed. Before any PM2 command as a site user,
the scripts now make sure that user's daemon runs under pm2-<user> (moving
one that runs elsewhere, keeping its process list). The agent's stats no
longer start an empty daemon by asking one that isn't running. Uninstall
stops the unit before removing it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found in the VM test: the new install's tunnels never opened, because
frpc only reads admin_addr when it starts, so the first reload failed.
That first time (and whenever a reload fails), frpc is restarted under
systemd and the report says so; later changes reload as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found in the VM test: Prisma records a failed migration and then refuses
every later migrate deploy (P3009), so one broken release left a church
unable to update. On rollback, failed migrations the previous release
doesn't have are marked rolled back (prisma migrate resolve); the
backup still has the database as it was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found in the VM test: adopt refused events@2.2.0 because the AI tokens
migration made it into the release, and adopt only moved installs with
no migrations. Now the migrations the release has and the old install
doesn't run after the backup, while neither version runs; a failure
starts the old install again. They're recorded (EVENTS_ADOPT_MIGRATIONS)
so adopt --undo can still go back past them (they only add columns).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Every command takes --json (crosscode.script-report/1 on stdout, the
log on stderr) and --config (the .env values by layer, from the agent).
- .env files come from the release's env.template.json (lib/envtpl.js):
written whole on install; on deploy only new variables are appended,
and a new required one with no value stops the deploy at the checks.
- install --frp: Hub-given ports, a marked frpc.ini block (backup,
frpc verify, reload; [common] admin lines added once), no nginx.
A database on another server via DB_ADMIN_URL. Refuses an existing
database or role. Everything the run made is removed if it fails.
- restart, export (crosscode.church-export/1 ZIP), uninstall (final
backup, uploads and .env kept 30 days) and purge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One script for installing, updating and moving church installs, replacing
hope-events' scripts/deploy.sh and install.sh:
- deploy <church> [events] / --every-church, with --version, --main, --check
and --allow-local-changes: checks every product first (files changed by
hand, Node, release requirements from WHATS-NEW.md headings), then each
product in order with backup, checkout, install, migrate, build, PM2 reload
and a /health version check; a failure rolls that product back and stops.
- status [<church>]: checked-out and latest release, /health, and the old
folder kept after adopt.
- install <church> --products events --domain <address>: a new church under
/var/www/sites/<church>, writing church.env.
- adopt <church> --events-dir <old> builds the monorepo checkout next to the
running install and switches PM2 over; adopt --undo goes back to it.
Product hooks live in scripts/products/events.sh. shellcheck (lint:scripts)
and 47 bats tests (test:scripts) are part of npm run check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>