# Upgrades and backups

> How to upgrade the engine without downtime, and what to back up.

Applies to: the Sypnia engine (open source, self-hosted).  
Source: https://data.docs.sypnia.com/self-hosting/upgrades-and-backups/

For agents: Upgrades: read the changelog, run `sypnia-data install` with the new version (migrations are additive within a minor version, run in a transaction, recorded in sypnia_data.migrations), then roll out the new binary; old and new engines run side by side during the rollout. Backups: the project's database holds everything (pg_dump or your provider's snapshots); also keep SYPNIA_DATA_MASTER_KEY (or the KMS key) — without it the signing keys cannot be decrypted and every session ends. Restore = restore the database + same master key.

## Upgrading

1. Read the [changelog](https://data.docs.sypnia.com/reference/changelog) for the version.
2. Run `sypnia-data install` with the **new** version (with `SYPNIA_DATA_INSTALL_ON_START=true`, as in Docker and AWS, the new version does it itself when it starts). Its migrations are **additive** within a minor version (new tables, columns, functions), run in one transaction and are recorded; the running engines keep working.
3. Roll out the new binary or image. Old and new instances can serve side by side during the rollout.

A major version can remove things; its notes say what to do before upgrading.

## Backing up

Everything is in the project's database: users, sessions, keys, settings, your tables. Back it up the way you back up Postgres: your provider's snapshots, or `pg_dump`.

Also keep, separately and safely:

- **`SYPNIA_DATA_MASTER_KEY`** (or access to the KMS key). Signing keys and stored credentials are encrypted with it. Restoring a database without it works for your data, but every session ends and provider credentials must be entered again.

## Restoring

Restore the database, start the engine with the same master key, done. If you restore to another server, update `DATABASE_URL` and nothing else.
