Operate

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:

FileContents
axonpush-<os>-<arch>The executable.
SHA256SUMSSHA-256 of the executable.
provenance.jsonThe server commit, dashboard commit, target and SHA-256 the executable was built from.
sha256sum -c SHA256SUMS
cat provenance.json
./axonpush-linux-amd64 version

Compare 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 axonpush

Stop 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/axonpush

Keep 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/license

On 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_version table.
  • 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 serve refuses to start on an older schema: database schema N required; found M; run the migration command.
  • Database credentials come only from DATABASE_URL or DATABASE_URL_SSM_PARAMETER, never from flags.
FlagDefaultPurpose
--owner-rolenoneExisting role to SET ROLE to during migrations, so objects are owned by it rather than the login.
--app-useraxonpush_appExisting runtime role to grant data privileges. Pass an empty value to skip grants.
--max-version0 (latest)Apply migrations only up to this version.
--timeout30mMaximum 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:

  1. Stop the service.
  2. Restore the database backup you took before the upgrade.
  3. Put the previous executable back.
  4. 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

WhatHowNotes
PostgreSQLpg_dump or your provider’s snapshotsOne database holds application data, auth data and pending durable work.
State directoryFile copy, encrypted, with restricted accessContains the auth secret, installation ID and evidence seeds. Back it up whenever you back up the database.
Environment fileYour secret storeContains the licence key and database credentials.
Payload bucketS3 versioning or replicationLarge event payloads referenced from the database.
Archive bucketOptional cross-region or cross-account replicationObjects are already write-once until their lock ends.
Key bucketDo not back upCopies 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

  1. Install the same release that took the backup.
  2. Restore the state directory to the --state path, owned by the service user with mode 0700, and restore the environment file.
  3. Restore the database into an empty database with the same roles.
  4. 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.