Upgrades and backups
Upgrade a self-hosted installation between releases, run migrations, and back up and restore it safely.
A self-hosted release is a new axonpush executable. The executable carries its own
database migrations, dashboard and auth service, so an upgrade is: back up, stop,
replace the file, migrate, start. There is no automatic updater and no zero-downtime
upgrade, because only one instance can run against a database.
Verify a release
Each release archive contains:
| File | Contents |
|---|---|
axonpush-<os>-<arch> | The executable. |
SHA256SUMS | SHA-256 of the executable. |
provenance.json | The server commit, dashboard commit, target and SHA-256 the executable was built from. |
sha256sum -c SHA256SUMS
cat provenance.json
./axonpush-linux-amd64 versionCompare the SHA-256 with the value axonpush sends you through a separate channel (for example the release email) rather than trusting the archive alone. Release builds also get a GitHub build provenance attestation; ask axonpush if you need to verify it. The executable has no detached GPG or Sigstore signature, and macOS builds are not notarized.
Upgrade
Read the release notes
Check whether the release changes configuration or the archive. You can skip
releases: migrate applies every missing migration in one run.
Back up
Take a database backup and copy the state directory and environment file while the old version is still running or just after stopping it. See Backups.
Stop the service
sudo systemctl stop axonpushStop it before starting anything new. A second process against the same database
exits with another portable dispatcher owns this database.
Replace the executable
sudo install -m 0755 axonpush-linux-amd64 /opt/axonpush/axonpush.new
sudo mv /opt/axonpush/axonpush /opt/axonpush/axonpush.previous
sudo mv /opt/axonpush/axonpush.new /opt/axonpush/axonpushKeep the previous file until the upgrade is verified.
Run migrations
With the migration credentials, as during installation:
sudo sh -c 'set -a; . /etc/axonpush/service.env; . /etc/axonpush/migrate.env; set +a;
exec /opt/axonpush/axonpush migrate --owner-role axonpush_owner --app-user axonpush_app'Start and check
sudo sh -c 'set -a; . /etc/axonpush/service.env; set +a; exec /opt/axonpush/axonpush doctor'
sudo systemctl start axonpush
curl -fsS http://127.0.0.1:8080/healthz
curl -fsS https://axonpush.example.com/licenseOn the first start of a new version, the service extracts that version’s auth
service into runtime/<sha256>/ in the state directory. Then sign in, open a recent
trace and send a test event.
Migrations
axonpush migrate applies the application and auth schemas embedded in the
executable to PostgreSQL.
- It runs every pending migration in a single transaction, under an advisory lock. If anything fails, nothing is applied.
- It records versions in the
goose_db_versiontable. - It refuses to run if the database already has a migration the executable does not
know:
database has applied version N beyond the selected embedded schema; refusing downgrade. axonpush serverefuses to start on an older schema:database schema N required; found M; run the migration command.- Database credentials come only from
DATABASE_URLorDATABASE_URL_SSM_PARAMETER, never from flags.
| Flag | Default | Purpose |
|---|---|---|
--owner-role | none | Existing role to SET ROLE to during migrations, so objects are owned by it rather than the login. |
--app-user | axonpush_app | Existing runtime role to grant data privileges. Pass an empty value to skip grants. |
--max-version | 0 (latest) | Apply migrations only up to this version. |
--timeout | 30m | Maximum duration. |
Run migrations with a login that can create and alter objects in the database, and run the service with the restricted runtime role.
Rolling back
There are no down migrations. Running an older executable after a newer migrate is
not supported, even if it happens to start.
To roll back:
- Stop the service.
- Restore the database backup you took before the upgrade.
- Put the previous executable back.
- Start the service.
Keep the same state directory throughout. Events received between the upgrade and the rollback are lost with the restored database unless your SDKs resend them.
Backups
| What | How | Notes |
|---|---|---|
| PostgreSQL | pg_dump or your provider’s snapshots | One database holds application data, auth data and pending durable work. |
| State directory | File copy, encrypted, with restricted access | Contains the auth secret, installation ID and evidence seeds. Back it up whenever you back up the database. |
| Environment file | Your secret store | Contains the licence key and database credentials. |
| Payload bucket | S3 versioning or replication | Large event payloads referenced from the database. |
| Archive bucket | Optional cross-region or cross-account replication | Objects are already write-once until their lock ends. |
| Key bucket | Do not back up | Copies would make erased subject keys recoverable. |
Copying the executable is not a backup. A restore needs the database and the state
directory from the same point in time. A database restored without its matching
better-auth-secret cannot decrypt stored auth keys, and everyone has to sign in
again.
Restore
- Install the same release that took the backup.
- Restore the state directory to the
--statepath, owned by the service user with mode0700, and restore the environment file. - Restore the database into an empty database with the same roles.
- Start the service.
If the evidence archive is enabled, the restored database may contain data for
subjects that were erased after the backup was taken. On the first request for each
organisation, the service compares the database with the erasure record in the key
bucket. When they differ, it blocks that organisation’s ordinary reads and writes
(503 evidence reconciliation or storage recovery required) and starts a
reconciliation job that removes the erased data again. Status and job endpoints stay
available while it runs. Owners can also start one with POST /audit/reconcile. An
organisation whose key was destroyed cannot be brought back by restoring the
database.
Moving to another host
Moving is a restore onto the new host: stop the old service, copy the state directory,
environment file and executable, point DATABASE_URL at the database and start the
new service. Keeping the state directory keeps the licence instance ID, so the
installation does not activate as a new instance. Never run both hosts at once.