Backups & Restore
3 min read
An Academy & Exam OS installation consists of four parts, plus the website images you upload. Back them up together, because they only work as a set.
| What | Where | Why |
|---|---|---|
| The database | Your MySQL or MariaDB server | Every account, question, test, result, setting and page |
| The private configuration | Web/config/app_local.php | Security salt and database credentials. It cannot be regenerated: without it, sessions, stored credentials and the installation cannot be read. |
| The installation marker | Web/config/installed.php | Version, installation identifier and mode |
| Private storage | Web/storage/ | Uploaded media, the installation’s encryption keys and, for Single Site and Multi Site, the licence activation files |
| Website images | Web/webroot/images/user-* | The copies of the logo, homepage slide and blog images you uploaded in Website & CMS. The public website serves these copies, and they are not recreated automatically. |
The other application files (src/, templates/, vendor/, the rest of webroot/ …) come from the package and do not need a backup — unless you customised them. If you did, back up your changes as well.
How to back up #
- Dump the database with your hosting panel’s backup feature or with
mysqldump(on MariaDB,mariadb-dump, which takes the same options). See the example command below. - Copy
Web/config/app_local.php,Web/config/installed.php, the wholeWeb/storage/folder and theWeb/webroot/images/user-*files. - Store the set in a location that is not inside the website folder and not on the same disk as the site.
Example database dump (replace academy with your database name):
mysqldump --single-transaction --routines --triggers academy > academy.sqlDaily backups kept for at least two weeks are a sensible default. Take an extra backup immediately before every update.
Important: The backup contains your database password and encryption keys. Store it as securely as the site itself.
How to restore #
- Upload the same package version to the target host and set up the folders as in Installing Academy & Exam OS, but do not run the installer.
- Restore the database dump into an empty database.
- Restore
Web/config/app_local.php(adjust the database credentials and the site address if they changed),Web/config/installed.php,Web/storage/and theWeb/webroot/images/user-*files. - Make
Web/tmp/,Web/logs/,Web/storage/andWeb/webroot/images/writable again. - Open the site. It starts directly with the restored data; the installation marker keeps
/installlocked.
Single Site and Multi Site: if the host name changed, deactivate the licence on the old host before activating it on the new one. See Licence Activation & Deactivation.
Test your backups #
Restore a backup into a test host or a local environment at least once after setting it up, and sign in. A backup that has never been restored is not a proven backup.
Related documents #
Watch the Video Tutorial #
This topic is also covered in Academy & Exam OS Video Tutorial 12: Updates, Backups, Security & Support (watch on YouTube). All Academy & Exam OS video tutorials.