Backups and restoring
Every night a backup of the database and the files, encrypted if you want and in a second place; how to restore it, and where the keys are.
In short
- With install.sh, the server makes a backup every night. Make one yourself with
sudo bugsoft backup. - The keys are not in the backup. Keep them in your password vault.
- Copy every backup to a second place, and encrypt it if you like.
- Restore with
sudo bugsoft restore. Practise this at least once a year.
With install.sh, the server makes a backup every night, for SQLite and for MariaDB. You can also make one
yourself, and restore one. Do you run Bugsoft Portal in Docker? Then see Bugsoft Portal with Docker.
What is in a backup
Each backup consists of two files in /var/backups/bugsoft (the folder of --backup-path):
| File | Contents |
|---|---|
db-2026-11-22_023000.sqlite.gz or db-2026-11-22_023000.sql.gz | The database. SQLite: a snapshot while Bugsoft Portal keeps running. MariaDB: a dump that is checked first. |
storage-2026-11-22_023000.tar.gz | Images and attachments (uploads), the Bugsoft Connect key, the installation lock and the anchor of the audit log. |
There is also a file .last-success with the time of the last successful backup. Backups older than 14 days
(--backup-keep-days) are removed automatically.
The keys are not in the backup
The keys APP_KEY and VAULT_KEKS are not in the backup. Without
them, you cannot read the saved passwords and the authenticator keys any more, not even with a backup. That includes the
keys for the codes from an authenticator app that people and administrators saved with a login: everyone then has to
turn two-step sign-in on again on those websites.
The keys are on the server in /etc/bugsoft/bugsoft.env. After the installation they were also in
/root/bugsoft-sleutels.env, so you could put them in your organisation's password vault.
- If that has not happened yet,
sudo bugsoft statussays so. - Confirm with
sudo bugsoft keys: type VERPLAATST ("moved") and the file is deleted. - Make sure at least two people can open the vault.
Make a backup yourself
sudo bugsoft backup
The nightly backup runs at 02:30 (--backup-time), through bugsoft-backup.timer or, without
systemd, /etc/cron.d/bugsoft. To see which backups there are: sudo bugsoft restore --list.
Only root writes in /var/backups/bugsoft (owner root, group bugsoft, permissions 0750). Bugsoft Portal itself
only reads there when the last backup finished, for sudo bugsoft production:check.
Keep a copy in a second place
A backup on the same disk does not help when the server is gone. So give --backup-copy-path during the
installation: a folder that is a share of another system (for example mounted through NFS or SMB). Every new backup is
copied there too.
Encrypt the backups
With --backup-cert you give a certificate (PEM). Every file of the backup is then encrypted for that
certificate (and gets the extension .cms). The private key that belongs to it is never on the server: your
security team keeps it.
To make a key pair on another computer:
openssl req -x509 -newkey rsa:4096 -nodes -days 3650 -subj "/CN=Bugsoft Portal backup Klaverveld" \ -keyout backup-key.pem -out backup-cert.pem
Put backup-cert.pem on the server, and backup-key.pem in the vault.
Restore a backup
sudo bugsoft restore --list sudo bugsoft restore 2026-11-22_023000
Type TERUGZETTEN ("restore") to confirm. The script then:
- checks that all files are intact;
- makes a backup of the current state;
- switches on the maintenance page;
- restores the database and the files, and brings the database to the current version;
- checks
/healthzand switches off the maintenance page.
If something goes wrong halfway, the maintenance page stays on: nobody works with a half-restored database. The script names the command to try again, and the backup made just before. A successful restore switches the maintenance page off by itself.
For an encrypted backup, add --decrypt-key backup-key.pem. Afterwards, check the audit log with
sudo bugsoft audit:verify.
Restore on a new server
- Install Bugsoft Portal with the same version and the same database choice (Install with install.sh).
- Copy the backup to
/var/backups/bugsoft, and the keys from the vault to a file, for example/root/keys.env(permissions 0600). - Run
sudo bugsoft restore 2026-11-22_023000 --keys /root/keys.env - Delete the key file:
sudo shred -u /root/keys.env
Practise restoring
A backup that was never restored is not tested. At least once a year, restore a backup on a test server with the keys from the vault. Then sign in with the emergency account and open a saved password.
Monitoring
sudo bugsoft production:check and sudo bugsoft status warn you when the last backup is older than
36 hours. See Check and monitor the server.
Stuck? See Questions and problems or contact Bugsoft at ugurs156@gmail.com.