Schedule encrypted backups
Updated
On your own server, Artavolo can write one encrypted archive a day that holds everything needed to rebuild the instance: both databases and the uploaded files. It keeps as many days as you choose, locally and in any S3-compatible storage, and one command puts an archive back.
Set the encryption key first
Set BACKUP_ENCRYPTION_KEY in includes/config.php, or ARTAVOLO_BACKUP_ENCRYPTION_KEY in Docker's .env, to 32 or more random characters. Backups are refused until it exists. Keep a copy of the key away from the server, in a password manager or a safe: an archive cannot be opened without it, and there is no way round that.
Turn on the schedule
- Sign in as an administrator, choose Control panel in the account menu, then Settings, Backups.
- Tick Run a backup every day and choose the hour under Run from (hour of day, server time). Pick a quiet one.
- Set a Local folder outside the web root, ideally a separate disk. Leave it empty to use
data/backups. - Set Keep backups for (days). 0 keeps everything.
- Leave Include uploaded files (attachments, avatars) ticked unless you copy the files another way.
- For a copy off the server, fill in the S3-compatible section: Endpoint, Bucket, Region, Key prefix, Access key and the secret key. Hetzner, MinIO, Scaleway, Wasabi and AWS S3 all work.
- Press Run a backup now once, to see a first archive in the list below.
The cron job, which runs every 5 minutes, starts the backup at its first run after the chosen hour.
Check and restore an archive
Check an archive without touching anything: php utilities/restore.php /path/to/archive.abk --dry-run. It verifies it, decrypts it to a temporary folder, lists what it holds and cleans up. Do this every month.
To restore, stop the web server, then run the same command with --yes instead of --dry-run. It replaces both databases and copies the uploads back. Restore once onto a spare machine now, while nothing is wrong: it is the only way to know the procedure works for you.
Good to know
- Each archive is encrypted with AES-256 and carries an HMAC-SHA256 tag over the whole file, checked before anything is decrypted. A wrong key or a damaged file is refused, never half-restored.
- A failed run e-mails every administrator. Every run, success or failure, is in the audit log.
- The schedule is part of Pro on your own server and needs a licence key that includes it. Without one,
php utilities/backup.phpmakes the same archive from the shell in every edition. - The archive does not hold
includes/config.php(it has your database passwords and secrets). Keep that file with the key. - Archives older than the days you keep are removed after each successful run, locally and in the bucket.
- In our cloud we run the backups. A base's own snapshots are under Settings, Backups in the base: Free keeps 10 per base, Standard 25 and Pro 50.