Back up and restore a Sovrium SQLite database
On the SQLite default, an app's rows live in one database file inside SOVRIUM_DATA_DIR (default ./.sovrium/database.db). Copying it is most of a backup — but do it consistently, because SQLite runs in WAL mode with side files, and copy the encryption key beside it.
Take a consistent backup
Use SQLite's online backup so an in-flight write can't corrupt the copy (no downtime needed):
sqlite3 .sovrium/database.db ".backup '/backups/app-$(date +%F).db'"
cp .sovrium/encryption-key /backups/encryption-key # unless SOVRIUM_ENCRYPTION_KEY is set in the environmentThe key is not inside the database. encryption-key is a sibling file in the same data directory, and it is what decrypts stored connection credentials. Restore the database without it and every row comes back while the secrets in them stay unreadable — with no error to tell you why. If you set SOVRIUM_ENCRYPTION_KEY in the environment instead, that value is the thing to keep safe, and no key file exists to copy.
For a whole-directory snapshot (database, key and uploaded files), stop the server first, then copy SOVRIUM_DATA_DIR in full.
Restore
Stop the app, replace the database file, and start again:
sovrium stop # or systemctl stop / docker stop
cp /backups/app-2026-07-20.db .sovrium/database.db
cp /backups/encryption-key .sovrium/encryption-key # only if the original key is gone
rm -f .sovrium/database.db-wal .sovrium/database.db-shm
sovrium start app.tsVerify
The startup summary reports the SQLite database, and your records are back. Automate the backup command with cron for off-site copies.
Next
- Database Infrastructure — the SQLite defaults and
SOVRIUM_DATA_DIR. - Connect Sovrium to PostgreSQL — when you outgrow single-file backups.
- GDPR & Privacy — data export and erasure obligations.
Last updated September 1, 2026
This documentation was written with AI, so errors or outdated content are possible. Sovrium is in beta. Contributions and corrections are welcome.