Vigiora

Denne side findes endnu ikke på Dansk. Den vises på engelsk.

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#

WhatWhere (Linux default)Why
DatabaseEmbedded PostgreSQL in /var/lib/theia/pg/Cameras, users, groups, sites, alert rules, Guardian history, faces, API keys.
Settings file/etc/vigiora.envSecrets and site settings. Needed to restore: it holds the keys that unlock data stored in the database.
Configuration/etc/vigiora/ and /etc/go2rtc/go2rtc.yamlServer 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.

  1. Open a terminal on the server

    Sign in to the server with an account that can use sudo.

  2. 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.

  3. Copy the settings

    Run:

    Terminal
    sudo tar czf /root/vigiora-config-$(date +%F).tar.gz /etc/vigiora.env /etc/vigiora /etc/go2rtc

    /etc/vigiora.env matters: its VIGIORA_NODE_TOKEN_KEY unlocks the cloud connection stored in the database, and JWT_SECRET keeps people signed in after a restore.

  4. 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:

Terminal
/opt/vigiora/pgsql/bin/pg_restore -l vigiora-db-2026-10-30.dump | head

Restore#

Restore onto a server running the same or a newer Vigiora version. On start, the server applies any newer database changes by itself.

  1. Stop the server

    Run sudo systemctl stop vigiora. This also stops its database, so the next step starts only the database.

  2. 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 start
  3. Restore 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-transaction means a failed restore leaves the database exactly as it was.

  4. 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 vigiora

    Sign 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.

Rediger denne side på GitHub