REFERENCE

Upgrades and rollback

You are moving Community Edition to a newer release, a release went wrong and you want the previous one back, or your database still runs PostgreSQL 16.

UPDATED

On Community Edition you upgrade by moving the image pin: set WEP_PLATFORM_IMAGE in .env to the new tag, then run docker compose pull and docker compose up -d. Database migrations apply when the new version starts, before it serves. The agent ships inside the image. Your endpoints update to it once it is armed, by auto-arm or on the Agent rollout page, and it then stops at the canary ring unless the rollout loop is on (how the agent updates itself). An upgrade changes neither switch: the installation keeps what it had.

You do not have to take every release. Read the release notes between your pin and the target, and move the pin. Let the fleet settle between upgrades rather than jumping several releases at once. Since platform 26.10.2900 releases are numbered by date (YY.MM.DDNN), and every 26.x release sorts above every 0.x one. A script that compares versions must compare the numbers, not the text: 26.11.300 comes before 26.11.2900, but sorts after it as a string.

Skip 26.11.500. Its tag and image exist, but the release build ran out of disk space before it finished, so it was never published; 26.11.501 carries everything it would have shipped. Since 26.11.501 the latest tag moves only after a release’s broker MSI upgrade test has passed, and points at the same signed digest as the version tag. It still moves with every release, so pin a version tag.

Which releases are one-way

Every release that applies a migration. Migrations only go forward; there is no migrate down. Since platform 0.246.0 the platform refuses to start on a database a newer version migrated: it exits 86, changes nothing, and names the newest pre-upgrade backup with the commands that restore it. So, for any release after 0.245.0:

  • No migrations: re-pinning the previous tag is the whole rollback, once the agent check below passes. The database did not change.
  • Migrations: the previous image will not start on the migrated database. The way back is the backup taken before the upgrade, and everything after it is lost.

Each release’s entry in the release notes opens with a Migrations: line that names them, or says No migrations. Of the recent releases, 26.11.1600, 26.11.1500, 26.11.1400, 26.11.1300, 26.11.1200, 26.11.1100, 26.11.900, 26.11.700, 26.11.502, 26.11.501, 26.11.400, 26.11.300 and 26.11.100 apply migrations; 26.11.801, 26.11.800, 26.11.701, 26.11.601, 26.11.600, 26.11.201 and 26.11.200 apply none. The signing-key migration in 26.11.1600 also refuses to be undone once a key has been recorded as a manifest mismatch, because an older image would serve that key as current. Read that line before you move the pin, and note beside the pin which kind of rollback the move signs you up for.

Some limits hold whatever the schema says:

  • Broker CA rotation. After any rotation step, do not roll back to an image older than 0.253.0: its restore would put the old roots back and strand the brokers that moved (the broker CA through a restore).
  • 0.245.0 and older. These images cannot run the reference compose file’s backup services, and they do not refuse a database a newer version migrated. Going back to one is not covered.
  • Your agents. Never below the fleet’s agent version, below.

The restricted database role

Since 26.11.501 the platform refuses to start when it connects to PostgreSQL as a superuser or as a role with BYPASSRLS: it logs a [db-role] line and exits 91 before it serves anything. An install created before the restricted application role still connects as the stack’s POSTGRES_USER, which is such a role. Before you move the pin to 26.11.501 or later, do one of these:

  • The one-time move in the restricted-database-role.md runbook. It stops the platform, takes a pg_dump, and hands the platform’s schemas to the application role in one transaction. It changes ownership and grants, never data.
  • Or, for this upgrade only, the opt-out. Set Wep__Database__AllowBypassingRole: "true" under wep-platform’s environment: in a docker-compose.override.yml. A line in .env does not reach the platform. Every start then logs a [db-role] warning, and admins see a notice on every console page. Do the move afterwards and remove the setting.

Snapshot first

The snapshot is the pre-upgrade backup, and with the reference compose file the stack takes it for you. Before the platform starts, a one-shot backs the database up whenever the new image has migrations to apply, and the platform does not start until that backup succeeds. A failed backup holds the upgrade; WEP_UPGRADE_WITHOUT_BACKUP lets one upgrade through without it, on the record (the pre-upgrade backup).

  • Give the stack a recipient certificate first. Without one, the pre-upgrade bundle holds no keys and its database dump is not encrypted.
  • Back up with the backup command, not by copying volumes. A bundle keeps the database and the keys that signed what it holds together, and a database put back by hand with pg_dump and psql stops the audit projection.
  • A compose file without the one-shot still upgrades, with a warning and a record that no backup was taken. Take a backup by hand before you move the pin.
  • After the upgrade, run the drill on a bundle. It proves that your key opens it and that it restores, without touching anything live.

Rolling back

A release with no migrations. Pass the agent check below, set the pin back, and run docker compose up -d. If the old image stops at the pre-upgrade one-shot with exit 86, the release had migrations after all: nothing changed, and the next paragraph applies.

A release with migrations. Pass the agent check, set the pin back and run docker compose up -d. The pre-upgrade one-shot exits 86, and its log (docker compose logs wep-backup-pre-upgrade) names the pre-upgrade bundle and prints the commands that restore it, with the key option that bundle needs. They stop the platform and the scheduler, restore that bundle with --replace --accept-older, and start the stack again. Run them with the old tag still in .env. --accept-older is there because a backup taken after the upgrade is newer than the bundle you are going back to.

What that costs is what a restore costs. Everything since the bundle was taken is gone, apart from the revocations and erasures the restore carries forward; everyone signs in again; and agents with a device key come back at 50 machines per tenant per day (after a restore).

Never pin the platform below your fleet’s agent version

The agent ships inside the platform image, so an endpoint’s agent is normally at most as new as the platform: it can lag behind, never lead. The platform serves an older agent: each newer capability goes only to agents at or above its floor, an endpoint below one is marked below floor on the fleet list, and it goes without that capability until its agent updates.

The other direction has no guard. Roll the platform back after endpoints have updated to its agent, and they run an agent newer than the platform, which knows nothing of what that agent reports or expects. Depending on the gap, that ranges from harmless to the old server misreading what the new agent sends. The fleet list marks such an endpoint platform behind, but that is a marker only: nothing refuses and nothing holds back.

So before any rollback, a re-pin or a restore, read the agent versions on /fleet or on Agent health (/fleet/agents). The rollback target must be at or above the newest agent version your fleet runs. If agents have already moved past it, roll back only as far as that version, or accept the skew and re-upgrade promptly. A restore does not help here: it puts back the platform’s state, not the agents installed on your endpoints.

An agent whose code did not change keeps its number, so the newest agent can be older than the platform it came with: 26.10.2900, 26.10.3000 and 26.10.3001 all shipped agent 0.253.0.

PostgreSQL 16 to 18

Since platform 0.249.1 the platform refuses to start on a PostgreSQL server older than 18, or on one whose version it cannot read. It stops before its first migration, so nothing is migrated, and exits 90. On Community Edition the startup task database-server-version logs the refusal in a line that starts [db-version] REFUSED:. The sub-state name server-version belongs to the hosted deployer. The version that ran before still starts on the unchanged database.

So move the database to 18 before you move the pin to 0.249.1 or later. The way across is a backup and a restore: a bundle taken on PostgreSQL 16 restores into an 18 server. The image has carried both the 16 and the 18 client since platform 0.248.0, and runs the one that matches each server. The other direction is refused: a bundle taken on 18 never restores into 16, and the restore says so before it changes anything.

Changing only the Postgres image tag does not move the data. The reference compose file runs postgres:18-alpine with its volume, wep-pgdata, mounted at /var/lib/postgresql, where PostgreSQL 18 keeps its cluster. An install created on 16 keeps its database in the wep-postgres-data volume in 16’s layout, and postgres:18-alpine refuses to start on a mount at /var/lib/postgresql/data, leaving the data as it was. New installs start on 18.

Plan the move as a restore: everyone signs in again, and agents with a device key come back at 50 machines per tenant per day.

On a dedicated instance

We run the upgrade. Each one is a deploy from a release tag that a named Attestree operator approves (dedicated instance).

  • Before it migrates, the instance logs a restore point: the database server’s own clock just before the migration. On a General Purpose server we also take an on-demand database backup named for the version. A Burstable server has none, because Azure offers none on that tier, so the logged point is the record.
  • If the new version never becomes healthy, the previous one keeps serving. Migrations run before the new version is released. A test in the platform’s build fails on any migration that drops or renames a table or column, unless that migration is on a reviewed list, so that the release before can still read the migrated schema. The test reads the migrations’ source, so it misses a drop assembled at run time, and it does not cover views, constraints or row-level security policies. It covers an upgrade of one release, so an instance several releases behind is upgraded in steps.
  • To undo an upgrade, your operator restores the database server to the logged point in time, with us talking you through it, and we deploy the previous release again (backup on a dedicated instance).

Where this stops

  • No downgrade. A release with migrations comes back only through its pre-upgrade bundle, and the restore loses everything since.
  • Nothing before 0.246.0 refuses a migrated database, and going back to 0.245.0 or older is not covered.
  • A superuser connection stops the start since 26.11.501, until the install moves to the restricted role or sets the one-upgrade opt-out.
  • The agent direction is unguarded. A platform pinned below its fleet’s agents starts and serves; only the platform behind marker shows it.
  • PostgreSQL 18 is a restore, with the sign-ins and agent re-issue that brings. No published tool upgrades a 16 cluster in place.
  • A dedicated instance’s safety net covers one release. An instance several releases behind is upgraded in steps.