Back up and restore
Create a Supermetry database archive and restore it safely with the built-in commands.
Back up the configured PostgreSQL database, then restore the archive into a dedicated Supermetry database when needed.
-
Install PostgreSQL client tools so
pg_dumpandpg_restoreare available. -
For a Linux binary install, create a private backup directory and archive the database.
Terminal window sudo install -d -m 0700 -o supermetry -g supermetry /var/lib/supermetry/backupssudo -u supermetry env SUPERMETRY_ENV_FILE=/etc/supermetry/supermetry.env \/usr/local/bin/supermetry backup --out /var/lib/supermetry/backups/supermetry-backup.tar.gzFor Docker, write the archive into the application data volume.
Terminal window cd /opt/supermetrydocker compose exec supermetry /supermetry backup --out /data/supermetry-backup.tar.gz
-
To restore a binary install, stop the service and confirm replacement of the target database.
Terminal window sudo systemctl stop supermetrysudo -u supermetry env SUPERMETRY_ENV_FILE=/etc/supermetry/supermetry.env \/usr/local/bin/supermetry restore /var/lib/supermetry/backups/supermetry-backup.tar.gz --yessudo systemctl start supermetryRestore only into Supermetry’s dedicated database. The command replaces its database objects and refuses an archive created by a newer schema.
-
Check readiness after the restored instance starts.
Terminal window curl -fsS http://127.0.0.1:8787/readyz
What you should see: the backup command prints Backup written to ...; restore prints Restore completed, and readiness returns {"status":"ok"}.