Sovrain
  1. Documentation
  2. Self-hosting

How-to guide

Back up Sovrain

Take a consistent copy of Sovrain's data directory and keep the configuration file with the master key apart from it.

This guide backs up everything Sovrain stores. All of it is in one directory: the Docker volume sovrain-data, mounted at /data in the container, or /var/lib/sovrain for a package or the binary. To bring Sovrain back from such a copy, see Restore Sovrain.

What you are backing up

The data directory holds your organization’s SQLite database with its password manager attachments, Sovrain’s own database node.sqlite with the license and the trial, the fingerprint of the master key and a few small marker and log files; every path is listed in Server configuration.

Two things to keep in mind:

  • The backup can be read only with IDP_MEK. The keys inside the databases are encrypted under it, and Sovrain starts on the data only with the same key. Keep a copy of the configuration file, .env or /etc/sovrain/sovrain.env, in your password manager, not next to the backup.
  • The backup holds personal data in readable form. The SQLite files are not encrypted; only keys and secrets inside them are. Protect the backup like the server itself.

Take a copy with Docker

In the directory with docker-compose.yml, stop Sovrain, copy the volume into an archive and start Sovrain again:

cd ~/sovrain
docker compose stop sovrain
docker run --rm -v sovrain-data:/data -v "$PWD":/backup debian:bookworm-slim \
  tar -czf /backup/sovrain-data-$(date +%F).tar.gz -C /data .
docker compose start sovrain

The copy is taken while Sovrain is stopped, so every database in it is consistent. Nobody can sign in for the few seconds it takes.

Take a copy of a package or binary installation

sudo systemctl stop sovrain
sudo tar -czf /var/backups/sovrain-$(date +%F).tar.gz -C /var/lib/sovrain .
sudo systemctl start sovrain

Move the archive off the server

Copy the archive to another machine or to storage outside the server. The archive is named with the date, such as sovrain-data-2026-11-27.tar.gz.

Other situations

If you want to copy without stopping Sovrain

If the data directory lives on a file system that takes atomic snapshots, such as ZFS, Btrfs or LVM, snapshot it while Sovrain runs and copy from the snapshot. The snapshot must cover the whole directory at one instant, including any -journal files next to the databases: SQLite uses them to roll back an unfinished write when the database is next opened.

If you want a copy of the organization only

An admin can also export the organization from its admin area and import it again; see Back up your organization. An export leaves out, among other things, everyone’s second factors, sessions and API access, so keep the data directory backup as well. What an export contains: Export format.