Backing up the panel

Daily backups of VaultPanel itself, with its database, secret key and certificate, and how to restore one on the same or a new server.

Last updated

Websites, apps and databases have their own backups. This page is about the backup of VaultPanel itself: without it, losing the server means losing every account and setting, and the key that decrypts them.

What a backup holds

Each backup is one file in /var/backups/vaultpanel-panel (root only, mode 600) with a .sha256 checksum next to it. It holds:

  • the panel's database, as a mariadb-dump,
  • .env, including VAULTPANEL_SECRET_KEY, which decrypts two-factor secrets, the agent signing key and every stored password,
  • the HTTPS certificate and key, so agents on other servers keep trusting a restored panel,
  • terminal recordings and the panel domain list,
  • a VERSION file with when, where and from which version it was made.

When backups are made

TriggerLabelKept
Every day, by vaultpanel-backup.timerscheduledVAULTPANEL_BACKUP_KEEP (14 by default)
sudo vaultpanel backupmanualall, unless you pass --keep
Before every updatepre-updatethe last 3
Before every restorebefore-restorethe last 3

Files are named after the time and label, such as vaultpanel-20261020-031500-scheduled.tar.gz.

Make a backup now

sudo vaultpanel backup
OptionWhat it does
--dir <folder>Write the backup to another folder.
--keep <n>Keep only the newest n backups with this label.
--label <name>Label the backup (a-z, 0-9 and -, at most 32 characters).

The backup needs the panel's MariaDB container that the installer set up. If you run the panel on your own database, back that database up yourself.

Settings

Set these in /opt/vaultpanel/.env. The next backup uses them; no restart is needed.

SettingDefaultWhat it does
VAULTPANEL_BACKUP_DIR/var/backups/vaultpanel-panelWhere backups go.
VAULTPANEL_BACKUP_KEEP14Daily backups kept.
VAULTPANEL_BACKUP_PASSPHRASE_FILEA file holding a passphrase. Backups are then encrypted (AES-256, PBKDF2) as .tar.gz.enc.
VAULTPANEL_BACKUP_UPLOADA command run after each backup with the file as $1, to copy it off the server.

For example, to copy every backup to another machine:

/opt/vaultpanel/.env
VAULTPANEL_BACKUP_UPLOAD=rclone copy "$1" remote:vaultpanel

If the upload command fails, the backup is still made and the command prints a warning.

Restore a backup

On the same server, or on a new one installed with the installer:

sudo vaultpanel restore /var/backups/vaultpanel-panel/vaultpanel-20261020-031500-scheduled.tar.gz

The restore:

  1. checks the file against its .sha256 checksum, when there is one,
  2. decrypts an .enc backup with VAULTPANEL_BACKUP_PASSPHRASE_FILE, or asks for the passphrase,
  3. asks you to type restore (--yes skips the question),
  4. takes a safety backup of the current panel,
  5. puts back the database, the settings and secret key, the certificate and the panel's files,
  6. updates the database to the installed version and restarts the panel.

The server keeps its own database and Redis passwords, ports and folders, so a backup from an old server restores onto a new one.

After restoring on a new server:

  • If the new server has another address, run sudo vaultpanel url <address>, and sudo vaultpanel https renew so the certificate names it.
  • A backup from a newer VaultPanel needs that version first: sudo vaultpanel update --version <it>, then restore again.