Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Engine reference — generated from the canonical engineering source. Do not edit this page by hand.

Upgrade and rollback (the recorded contract)

The contract is recorded in ADR-0016. This page is the operator half: the exact commands, the exact Mango ack, and the non-claims. The drill is scripts/upgrade-rollback-drill.sh (wired into the tri-service CI job via tests/smoke/test_upgrade_rollback_drill.py).

Non-claims (ADR-0016 U1–U7)

No hot code upgrade. server/src/sol.appup is an unsupported stub; code_change/3 callbacks carry no state migration. An upgrade restarts the service. No zero-downtime claim. The coordinator is stop-the-world; a release restart interrupts in-flight HTTP/SSE/chat, re-registers workers and fails live workflows per the workflow-restart contract. No HA/failover claim. Node loss is data loss within the backup window (disc_copies is [node]). Rollback is redeploy + health verification, with a data restore when the schema moved. Mango migrations are forward-only: a migrated database rolls back only through a verified snapshot/restore or the explicit controlled-downgrade ack below. Wire skew is not uptime. N/N−1 frames are accepted for the documented window; a Luna downgrade against an older Sol is stop-then-upgrade.

Sol release upgrade

Production upgrades are wild-owned image replacements (Crow CD). The standalone helper (server/scripts/upgrade.sh) is for the archived systemd/standalone model and performs the same contract:

server/scripts/upgrade.sh /path/to/sol-<version>.tar.gz --root /opt/sol

It requires a checksum sidecar (<tarball>.sha256 or SHA256SUMS), validates archive entries, captures the old version, installs the release payload (stop-the-world file install — no relx hot upgrade), restarts the service and requires /api/v1/health 200. A failed health check re-installs the captured old release and re-verifies it (exit 2 = rollback verified; exit 3 = manual action required). --no-restart reports an INSTALLED-ONLY verdict (exit 4) and never claims the new release is running.

Controlled rollback drill (no live service, real release packet pair):

scripts/upgrade-rollback-drill.sh \
 sol-root server/_build/prod/rel/sol \
 scratch /tmp/zerg-upgrade-rollback

It derives an N-1 packet from the shipped release tree, fresh-installs it, upgrades to N, rolls back to N-1, and asserts start_erl.data, bin/sol and lib/sol-<vsn>/ebin/sol.app at every step. The Mango leg (below) runs in the same drill.

Mango migrations (forward-only + schema-ahead gate)

Mango records applied versions in schema_migrations and applies pending up(db) modules in order. There are no down-migrations. A newer database meeting an older image refuses at boot:

schema version N is NEWER than the newest migration this tree ships (N-1) —
refusing to run an OLDER image against a NEWER schema (DC-03). Restore the
matching image, or explicitly acknowledge the controlled rollback with
MANGO_ALLOW_SCHEMA_AHEAD=1.

The exact ack is the environment variable:

MANGO_ALLOW_SCHEMA_AHEAD=1

With the ack the older image boots against the newer schema, logs a CRITICAL line, and undoes nothing (the schema stays at N; the older code must be compatible with it). The SAME ack is honored by /ready ( ): an acknowledged older image serves 200 with "schema_ahead": "acked" in the loopback readiness census instead of the permanent schema_ahead 503 the pre-fix shape answered — the rollback lever is now usable for traffic, not just for boot. Without the ack, /ready keeps answering 503 schema_ahead. Do not use the ack unless you have a verified backup and accept the forward-only window. The preferred rollback across a schema move is a restore of the pre-migration Mango backup (see Backup & DR).

The drill proves: a missing ack refuses typed, the ack downgrade keeps schema/data/auth rows, and a deliberately broken migration reds and leaves the recorded version untouched (transactional apply).

Compatibility window to watch

Mango v0013 (tokens.seq NOT NULL) is the recorded example: a pre-v0013 writer against a post-v0013 schema fails on the first write. Rolling back across a migration requires the ack and a reviewed compatibility note; the safe path is the pre-migration snapshot.

See also

ADR-0016 — upgrade/rollback + config authority Backup & DR — composite restore and the drill Production runbook — wild’s multi-node roll