Upgrade And Rollback¶
Purpose¶
This guide describes the supported upgrade and rollback path for the current self-hosted DecisionGraph deployment model.
The supported path assumes:
- one application node
- one PostgreSQL database
- source-based deployment from this repository or the packaged OTP release built from it
Supported Upgrade Model¶
Today the safest supported upgrade flow is:
- back up PostgreSQL
- move the source checkout to the target release or git SHA
- run migrations
- start the new runtime
- run smoke tests before trusting the install
Pre-Upgrade Checklist¶
Before upgrading:
- record the current git SHA or tag
- record the database name and
DATABASE_URL - take a fresh pre-upgrade backup
- read
docs/release.mdfor migration notes - plan a maintenance window if you cannot tolerate brief write interruption
Upgrade Procedure¶
From the repository root:
git fetch --tags
git checkout <target-tag-or-sha>
cd beam
mix deps.get
mix compile
mix ecto.migrate
mix phx.server
For non-dev installs, run with the same production environment used by the current deployment, including:
MIX_ENV=prodDATABASE_URLSECRET_KEY_BASEPHX_HOSTPORTPOOL_SIZEPHX_SERVER=true
Post-Upgrade Verification¶
After the new version starts, verify:
GET /api/healthzreturns200- authenticated
GET /api/v1/projections/healthreturns200 - the operator console loads
- replay admission still works for an admin token
- recent traces and workflows render correctly
If you are validating a release candidate on a disposable or dedicated demo tenant, you can also run:
cd beam
mix dg.release.validate --output ../.tmp/phase10-release-validation.json
That command is appropriate for the documented release-demo evaluation path. It is not a substitute for production-safe smoke checks on a live tenant because it reseeds a dedicated demo dataset.
If those checks fail, do not continue normal traffic.
Supported Rollback Model¶
The supported rollback path is conservative:
- stop the upgraded runtime
- restore the pre-upgrade PostgreSQL backup
- check out the previous known-good release or git SHA
- restart the old runtime
- re-run the smoke checks
This is the official rollback story because it does not assume every migration is safely reversible in place.
Rollback Procedure¶
From the repository root:
git checkout <previous-tag-or-sha>
cd beam
mix deps.get
mix compile
mix phx.server
Before restarting, restore the matching database backup captured before the upgrade.
When A Projection Rebuild Is Enough¶
If the upgrade issue only affects derived projection code and the event log remains trustworthy, a full database restore may not be necessary.
A narrower recovery path can be:
- revert to the previous code version
- start the runtime
- rebuild affected projections
- verify health and digests
Do not use this shortcut when the database migration itself is suspect.
Unsupported Rollback Tactics¶
The current supported self-hosted story does not rely on:
- manual table surgery in production
- undocumented down-migration sequences
- restoring projection tables without understanding event-log consistency
If the failure mode is unclear, prefer the full restore-based rollback.