How-to guide
Restore Sovrain
Bring Sovrain back from a copy of its data directory, on the same server or on a new one, with the same master key.
This guide brings Sovrain back from an archive made as in Back up Sovrain: after a failure,
after an upgrade you want to undo, or on a new server. In the examples the archive is
sovrain-data-2026-11-27.tar.gz.
Everything that happened after the backup is lost, such as people invited or settings changed since then.
Before you start
- The configuration file from the copy in your password manager, above all its
IDP_MEK:.envfor Docker, or/etc/sovrain/sovrain.envfor a package or the binary. With another master key, Sovrain refuses to start withIDP_MEK is not the MEK this data was encrypted with. KeepIDP_CSRF_SECRETas well; with another one, forms people have open stop working. - The release that made the backup, or a newer one. A newer release starts on it and updates the data, as in Upgrade Sovrain. An older release is not made to run on data a newer one has changed.
Restore with Docker
In the directory with
docker-compose.yml, here~/sovrain, stop Sovrain:cd ~/sovrain docker compose stop sovrainOn a new server, first set it up as in Run Sovrain on your server, steps 1 to 3, but put the
.envfrom your password manager in~/sovraininstead of creating a new one. Then rundocker compose createto create the containers and the volume without starting them.Copy the archive into
~/sovrain, empty the volume and unpack the archive into it:docker run --rm -v sovrain-data:/data -v "$PWD":/backup debian:bookworm-slim \ sh -c 'find /data -mindepth 1 -delete && tar -xzf /backup/sovrain-data-2026-11-27.tar.gz -C /data'Start everything and follow the log:
docker compose up -d docker compose logs -f sovrain
Restore a package or binary installation
On a new server, install Sovrain as in Install Sovrain from a package or Install the Sovrain binary, and replace
/etc/sovrain/sovrain.envwith the copy from your password manager before the first start.Stop Sovrain, empty the data directory, unpack the archive and give the files to the user
sovrain:sudo systemctl stop sovrain sudo find /var/lib/sovrain -mindepth 1 -delete sudo tar -xzf sovrain-2026-11-27.tar.gz -C /var/lib/sovrain sudo chown -R sovrain:sovrain /var/lib/sovrain sudo systemctl start sovrain
Check the result
Within a few seconds the log contains idp listening on. Sign in to your organization and open its admin area.
Your organization is back as it was at the time of the backup, with the same license.
Other situations
If you move Sovrain to a new server
Restore on the new server as above, then change the A records of both names, such as auth.example.com and
acme.auth.example.com, to the new address. Caddy on the new server gets new certificates once the names point at
it. Keep the old server stopped: never run two copies of the same data.
Related
- Every setting mentioned here: Server configuration