Backups and restores
How to back up an instance, and why a restored backup brings back everything except the WhatsApp links.
Back up
Section titled “Back up”Dump the database:
docker compose exec -T db pg_dump -U whatomato whatomato > whatomato.sqlKeep ENCRYPTION_KEY somewhere other than with the dumps. The two together reveal every secret the key protects.
What a restore brings back
Section titled “What a restore brings back”A restore brings back the accounts, templates, scheduled messages and history. It doesn’t bring back the WhatsApp links. Every user has to link again, for the reason below.
After losing the key or restoring a backup
Section titled “After losing the key or restoring a backup”Linked devices can’t survive either of these:
- A lost or replaced
ENCRYPTION_KEY. The keys can’t be opened any more. - A database restored from a backup. The Signal keys in it have moved on since the backup was taken, and reusing them can break decryption and reuse message keys.
So before the server runs on that database, remove the links:
-
Stop the server.
-
Delete the WhatsApp accounts, which takes every key with them:
DELETE FROM whatsapp_accounts; -
Start the server.
-
Tell users to link again, and to remove the old device under Linked devices on their phone.
Scheduled messages that come due while an account isn’t linked fail and don’t go out later, so let users know soon.
