Documentation
Backups and restore
Under Administration → Backup you create and manage backups.
What is included?
- MySQL/MariaDB database
- Blob storage (attachments and message bodies)
- Configuration
- Your own TLS certificates and their keys
- The key for passwords at rest
- Sieve rules, DKIM keys and the licence (stored in the database)
- ACME and component state, where present
What is not included
- The full-text search index. It is derived data and has to be rebuilt after a restore — see step 4 below. Without that step the search finds nothing even though all the data is there.
Rotation
The backup schedule keeps the configured number of copies (set under Administration → Backup). A backup triggered by hand also honours this rotation — copies beyond the configured number are removed.
Restoring through the web interface
- Upload the backup archive.
- Choose the restore target (complete or selective).
- The server restarts afterwards if that is necessary.
Restoring from the command line
This is the path for the real emergency. The web interface stops answering exactly when you need it most — broken database, half-deployed version, deleted directory.
The command works without a running server and refuses while one still answers. That is deliberate: while the dump is being loaded, a running service keeps working on the same tables, and the result is a mixture of two states that only shows up days later.
# List the available archives
sudo annexgroup restore --list
# Stop the service
sudo systemctl stop annexgroup
# Restore
sudo annexgroup restore annexgroup-backup-20260831-090000.tar.gz
restore-backup remains as a compatible alias.
Moving to a different machine
The most common reason for a restore is not a disaster but a move: the old machine is going away. The procedure is the same, with four additions.
1. Create an empty database on the new machine, with the same character set:
CREATE DATABASE annexgroup CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'annexgroup'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON annexgroup.* TO 'annexgroup'@'localhost';
2. Transfer the archive and the configuration. The archive belongs in the
backup directory of the new installation (<data directory>/backups). Check
data_dir and database_dsn in the configuration — otherwise they point at
directories that do not exist on the new machine.
3. Restore as above, with the service stopped.
4. Rebuild the search index — with the service still stopped:
sudo annexgroup reindex-search
sudo systemctl start annexgroup
In that order, not the other way round. The search index takes exactly one writer. If the service is already running it holds the lock, and
reindex-searchaborts with a message saying so.
Then count, do not hope. A restore is only proven once you have compared both sides: sign in over IMAP and over the web interface, open a message with an attachment, and search once for a word you know is there.
Note: Test your backups regularly in a separate environment. A backup that has never been restored is an assumption, not a safeguard.
Restore probe
The server checks this itself: once per interval (default: weekly, configurable
under Administration → Backup, 0 turns the probe off) it restores the
newest archive into a throwaway database on the same database server — the
production database is never touched. It then compares:
- the row counts of the most important tables (messages, accounts, domains and others) against the production database — with a tolerance, because the production database keeps living since the backup,
- a sample of checksums of stored message bodies (blobs) against the archive.
The result (time, archive, outcome, duration, counts, and the error reason if any) is shown on the backup page. If the probe fails, the administrators receive a notice in their mailbox — once per error cause per 24 hours, not for every run. The self-check (Security → Self Audit, see security settings) carries the probe as its own traffic-light level: green only when the latest probe is younger than two intervals and succeeded.
The throwaway database is deleted after every run, even when the probe fails.
Requirement on the database server: the service user must be allowed to create
and drop databases with the prefix annexgroup_probe_. The probe runs at
night and defers itself while a backup is in progress. It checks
samples of the most important contents — it does not replace a full
test-restore before a migration.
Complete probe
Before a move also run annexgroup backup-probe --voll --json. It compares
every table and blob checksum; the production database is blocked as a target.
Archive size, space requirement, duration and result are retained.
Something unclear or described wrong? Tell us — we will fix it. Your question shows us where the text falls short.