Backups and recovery
This page is for administrators and hosting teams of public sites, and the project managers who set recovery targets. A backup is the database and the files, taken at the same moment (10.9 Backups and restore).
Contents
- What to back up
- A consistent backup
- Protecting the backups
- Restore tests
- Smaller recoveries
- Related pages
What to back up
| Path | Why |
|---|---|
| the database | content, users, roles, settings stored in the database |
var/storage, var/<site>/storage | uploaded images and files |
settings/override, settings/siteaccess | the installation's settings, including secrets (database password, audit keys, mail preference secret) |
| your own extensions and designs | if they are not in a repository |
var/log (optional) | later investigation; the audit trail lives under var/<site>/log/audit |
Caches need no backup.
A consistent backup
- Maintenance mode, so nothing is written between the database and the file backup:
php bin/php/maintenance.php on --message="Back soon" --until=30m --allow-root-user(--allow-adminkeeps the administration reachable). - The database with its engine's tool (
mysqldump --single-transaction,pg_dump -Fc, the SQLite online backup, ...). - The files:
tar czf /backup/files-$(date +%F).tar.gz var/storage settings/override settings/siteaccess. php bin/php/maintenance.php off --allow-root-user.
On SQLite and MySQL with InnoDB the database backup is consistent without maintenance mode; maintenance mode makes database and files agree.
Protecting the backups
- Encrypt them: they contain the database password and the audit keys.
- Keep at least one copy off the machine and one offline, so ransomware on the server cannot reach it (Security hardening: Backups and recovery).
- Keep several generations, as long as your records and privacy rules allow (backups contain personal data too).
- Keep the break-glass procedure for the administrator account next to the restore procedure.
Restore tests
Restore to a test machine regularly (for example each quarter):
- maintenance on; under Velocity stop the server;
- restore the database and unpack the files; fix owner and mode;
- clear caches and start;
- check: front page, sign-in, a content page with images,
./console exp:audit verify --allow-root-user.
Record the date, the backup used, the time it took and problems found. The time is your real recovery time.
Smaller recoveries
Not every loss needs a full restore:
| Lost | Recover with |
|---|---|
| a page moved to the trash | Restore in the trash (content/trash) (The trash view) |
| an earlier text of a page | Make a new draft from the old version on the versions page (Versions of an object) |
| a user account removed | only a restore: user objects never go to the trash; prefer Deactivate and move for leavers |
| an archived audit day | ./console exp:audit restore --apply --channel=<channel> --date=<YYYY-MM-DD> --allow-root-user |
Related pages
- 10.9 Backups and restore
- Runbook: restore from backup
- Backups and restores for website creators
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.