In an installation on your own server, everything that matters is in the database: settings, instructions, knowledge sources, messages, drafts and the encrypted secrets. So you back up the database — and MASTER_KEY.
What to back up
- The database — with a regular dump.
MASTER_KEYfrom the.envfile — once, off the server. Without it you cannot read the API keys, mailbox access or sign-in clients from the database; the backup would be useless.- Optionally the whole
.env(database passwords and other secrets) — in an equally safe place.
A database dump contains the customers' mail. Protect it like the mailbox itself.
Dumping the database
From the installation's directory:
mkdir -p data/backups
docker compose exec -T db mariadb-dump -udraften -p"$DB_PASSWORD" --single-transaction draften | gzip > data/backups/draften-$(date +%F).sql.gz
Run it regularly (daily from cron, say) and copy the dumps off the server.
Restoring
Into an empty database:
gunzip -c dump.sql.gz | docker compose exec -T db mariadb -udraften -p"$DB_PASSWORD" draften
Then start the installation with the same MASTER_KEY that applied at the time of the backup.
Watch out
- The
db-datavolume is the live database. Never remove the installation withdocker compose down -vunless you have a fresh dump. - The
data/directory no longer holds the truth — only text logs, the report and dumps are there. - You can always check in the interface: the Installation page shows whether
MASTER_KEYis set.