Pre-Upgrade Checklist
Before upgrading any environment, complete these steps:Review the changelog and release notes
Verify the image digest and attestation
Run acceptance on a test environment first
Create a database backup
postgres_data volume is intact. For Cloud Run, the upgrade waits for the Cloud SQL backup operation to report SUCCESSFUL before proceeding.Migration Requirement
Every upgrade helper enforces this order automatically. If you are managing a custom container platform, run the migration as a one-shot pre-traffic job:Docker Compose Upgrade
Download and verify the new bundle
README.md before proceeding.Preserve your existing environment and secrets
Run the upgrade helper with your existing environment path
upgrade.sh with the path to the existing environment file. Relative secret and backup paths resolve from the directory containing that file:- create a PostgreSQL custom-format backup and validate it;
- pull the exact pinned images;
- apply checked forward migrations;
- restart the topology; and
- verify readiness at
/ready.
Copy the backup to off-host storage
postgres_data volume is not a substitute for a verified backup.Run post-upgrade smoke checks
Compose Rollback
Application rollback does not undo database migrations. Restore an older image only after confirming it supports the current schema. Data rollback requires a reviewed restore into a controlled target:- Stop the current topology.
- Confirm schema compatibility between the prior image and the migrated database schema.
- Update the image digest in your environment file to the prior pinned release digest.
- Restart the topology.
Cloud Run Upgrade
Download and verify the new Cloud Run bundle
Preserve existing environment and bootstrap records
cloudrun.env, bootstrap state, client identity, and .state files in a durable installation directory outside source control. Merge new template keys from the new bundle instead of overwriting local configuration.Run the upgrade helper
upgrade.sh with the path to the existing environment file:- validate the current environment and bootstrap contract, create any newly required numbered Secret Manager versions, and grant the existing runtime identity access;
- create an on-demand Cloud SQL backup, wait for its operation to finish, and require the resulting backup status to be
SUCCESSFUL; - run the new migration job;
- update the cleanup job and apply current environment and secret bindings;
- deploy a no-traffic candidate revision;
- temporarily enable a previously disabled generated URL so the candidate can be verified;
- verify candidate readiness and JWKS;
- cut traffic over explicitly; and
- verify the custom origin and restore the prior generated-URL policy.
Run post-upgrade smoke checks
- the active revision and exact image digest;
- migration and cleanup job execution history;
- Cloud Scheduler’s last execution;
- Cloud SQL backup/PITR status, storage, and connections; and
- numbered secret-version references.
Cloud Run Rollback
If a candidate check fails duringupgrade.sh, the previous revision retains traffic automatically. Completed forward migrations remain in place.
For an explicit rollback after traffic has been cut over:
- Confirm the prior revision supports the current database schema (application rollback never reverses migrations).
- Use the bundle’s explicit schema-compatibility confirmation before proceeding.
- Route traffic back to the prior revision using the bundle’s rollback helper or
gcloud run services update-traffic. - The rollback helper verifies
TOOL_URLwhen configured and re-disables the generated URL if applicable.
OAuth Token Encryption Migration
If upgrading from a version that stored OAuth tokens in plaintext (pre-1.1), follow the two-phase mode transition before enforcing encryption.- Docker Compose
- Cloud Run
Deploy in compatibility mode first
OAUTH_TOKEN_ENCRYPTION_MODE=compat in .env.secrets and run the upgrade. The compatibility revision can read both plaintext and encrypted tokens while writing only encrypted rows.Enforce and rewrite existing tokens
enforce, recreate the application, then run the one-shot rewrite:0 updates before retiring the old plaintext key.npm Commands Reference
The following npm scripts are used during upgrades and maintenance. Thebuilt variants run the compiled output directly without requiring TypeScript tooling, matching the commands the deployment helpers invoke internally.
built variants invoke the compiled output directly without requiring TypeScript tooling. The migration and cleanup jobs call npm run db:migrate:built and npm run db:cleanup:built respectively, which resolve to node dist/server/server/data/migrate.js and node dist/server/server/data/cleanup.js --drain.