Backup and restore

All Scalengi data lives in two PostgreSQL databases. Back them up together, store the copies off the server, and test the restore.

What to back up

DatabaseContent
Business database (scalengi)Organisations, members, roles, catalogues, diagrams and their versions, inventories, feedback, settings.
Identity database (scalengi_identity)Accounts, password hashes, sessions and single sign-on settings.

Back up both, at the same moment: a business database restored without its identity database leaves members without accounts. Also keep, in your secret manager, the passwords and secrets used by the services.

Take a consistent backup

The simplest consistent backup is a logical dump of each database while the Core and the identity service are stopped:

docker compose stop core identity
docker compose exec -T database pg_dump -U scalengi_migrator -d scalengi --format=custom --no-owner --no-privileges > scalengi.dump
docker compose exec -T identity-database pg_dump -U identity_migrator -d scalengi_identity --format=custom --no-owner --no-privileges > scalengi_identity.dump
docker compose start identity core

Adapt the service and role names to your Compose files. On a larger installation, physical PostgreSQL backups with point-in-time recovery avoid stopping the services.

Restore

  1. Stop the Core and the identity service.
  2. Restore each dump into an empty database of the same version of Scalengi, with pg_restore and the migrator role.
  3. Start the identity service, then the Core, and check their health.
  4. Sign in and check a few organisations, diagrams and inventories.

A restore brings the data back as it was at the time of the backup, including settings such as the responsibility mode.

Test the restore

A backup that has never been restored is not a guarantee. Regularly, on a separate machine: restore the latest dumps, compare the number of organisations, diagrams and objects, open a few diagrams, and measure how long it took. Do it again whenever you change storage or before a migration.