- Документація
- Адміністрування
- Back up your server
Ця сторінка ще недоступна мовою «Українська». Її показано англійською.
Back up your server
Back up and restore the database and settings of a self-hosted Vigiora Server on Linux.
Vigiora Server doesn't make backups of its database by itself yet. This page shows how to back it up by hand with the PostgreSQL tools that come with the server. The steps are for Linux.
What to back up#
| What | Where (Linux default) | Why |
|---|---|---|
| Database | Embedded PostgreSQL in /var/lib/theia/pg/ | Cameras, users, groups, sites, alert rules, Guardian history, faces, API keys. |
| Settings file | /etc/vigiora.env | Secrets and site settings. Needed to restore: it holds the keys that unlock data stored in the database. |
| Configuration | /etc/vigiora/ and /etc/go2rtc/go2rtc.yaml | Server and video engine configuration. |
| Recordings | /var/lib/theia/recordings/ | Video. Large; back up only if you need to keep it. |
If you installed with --data-dir, the database and recordings are under that folder instead of /var/lib/theia.
Back up the database#
The database runs on the server itself and only listens on 127.0.0.1, on a port chosen at install time (5433 or higher). The port and the password are in files that only root and the vigiora account can read.
Open a terminal on the server
Sign in to the server with an account that can use
sudo.Make the dump
Run:
Terminal sudo sh -c 'umask 077; PGPASSWORD="$(cat /var/lib/theia/pg/.password)" \ /opt/vigiora/pgsql/bin/pg_dump -h 127.0.0.1 -p "$(cat /var/lib/theia/pg/port)" \ -U vigiora -d vigiora -Fc -f /root/vigiora-db-$(date +%F).dump'This writes a compressed dump such as
/root/vigiora-db-2026-10-30.dump, readable only by root. The server keeps running.Copy the settings
Run:
Terminal sudo tar czf /root/vigiora-config-$(date +%F).tar.gz /etc/vigiora.env /etc/vigiora /etc/go2rtc/etc/vigiora.envmatters: itsVIGIORA_NODE_TOKEN_KEYunlocks the cloud connection stored in the database, andJWT_SECRETkeeps people signed in after a restore.Move both files off the server
Copy them to another machine, a NAS or cloud storage.
Check a backup#
List what's inside a dump without restoring it:
/opt/vigiora/pgsql/bin/pg_restore -l vigiora-db-2026-10-30.dump | headRestore#
Restore onto a server running the same or a newer Vigiora version. On start, the server applies any newer database changes by itself.
Stop the server
Run
sudo systemctl stop vigiora. This also stops its database, so the next step starts only the database.Start the database on its own
Terminal sudo -u vigiora /opt/vigiora/pgsql/bin/pg_ctl -D /var/lib/theia/pg/data \ -l /tmp/vigiora-restore-pg.log -w startRestore the dump
Terminal sudo sh -c 'PGPASSWORD="$(cat /var/lib/theia/pg/.password)" \ /opt/vigiora/pgsql/bin/pg_restore -h 127.0.0.1 -p "$(cat /var/lib/theia/pg/port)" \ -U vigiora -d vigiora --clean --if-exists --single-transaction /root/vigiora-db-2026-10-30.dump'--single-transactionmeans a failed restore leaves the database exactly as it was.Stop the database and start the server
Terminal sudo -u vigiora /opt/vigiora/pgsql/bin/pg_ctl -D /var/lib/theia/pg/data -m fast -w stop sudo systemctl start vigioraSign in and check your cameras, users and rules.
Restoring onto a new machine#
Install Vigiora Server as usual, then follow the same steps. The new install has its own database password and port, which is fine: the dump doesn't contain them. Before the last step, copy VIGIORA_NODE_TOKEN_KEY and JWT_SECRET from your backed-up /etc/vigiora.env into the new /etc/vigiora.env. Otherwise you'll need to reconnect the server to Vigiora.