Backups and restore
Sail keeps everything in two places: the Postgres database and the file volume. The backup.sh script that comes with Sail copies both, checks them, and leaves you a folder you can restore from.
Sail keeps running while it backs up. Nobody notices.
What to keep safe
Section titled “What to keep safe”| What | Where | Backed up by |
|---|---|---|
| Chats, memories, assistants, settings | Postgres | backup.sh |
| Uploaded and generated files | The sail-data volume | backup.sh |
| Your settings | .env | You |
| The secret key | secrets/secret-key | You, separately |
The secret key is left out of backups on purpose. Whoever steals a backup still can’t read the secrets inside it. Keep the key in your password manager or secrets store, away from the backups.
Back up
Section titled “Back up”From the folder where Sail is installed:
./backup.sh --out /srv/sail-backupsIt makes a folder such as sail-backup-20261025T120000Z with:
database.dump: the database;files.tar.gz: every file;manifest.json: when it was made, the Sail and Postgres versions, and the number of files;SHA256SUMS: checksums, so you can tell later that nothing was damaged.
The script checks the dump and the archive before it finishes. A folder still named .partial is incomplete. Never restore from one.
Back up every night
Section titled “Back up every night”Add a line to the server’s crontab:
15 3 * * * cd /opt/msty-sail && ./backup.sh --out /srv/sail-backups --keep 14--keep 14 keeps the newest 14 backups and deletes older ones.
Then copy the backups somewhere else, such as object storage in another location, with the tool you already use (rclone, aws s3 cp, or your backup software). A backup on the same disk as Sail doesn’t survive a lost disk.
Sail doesn’t encrypt backups. If they leave the server, store them encrypted.
Restore
Section titled “Restore”Restoring replaces everything in Sail with the backup.
-
Check the backup first. Without
--yes, the script only verifies checksums and says what it would replace:./restore.sh /srv/sail-backups/sail-backup-20261025T120000Z -
Restore:
./restore.sh /srv/sail-backups/sail-backup-20261025T120000Z --yes
It stops Sail, replaces the database and files, starts Sail again, and waits until it’s healthy.
Before you restore:
- Use the same secret key the backup was made with.
- Run the same Sail version or newer. A newer Sail updates the restored database when it starts.
- Run the same Postgres major version or newer than the one in
manifest.json. - On a new server, start Sail once first, so its containers exist.
Test your backups
Section titled “Test your backups”A backup you’ve never restored is a hope, not a backup. Every few months, restore last night’s backup on a spare server and sign in. If it works there, it’ll work when you need it.
Using your own Postgres
Section titled “Using your own Postgres”backup.sh backs up the bundled Postgres only. If you run Sail against your own database service, such as Amazon RDS or Azure Database for PostgreSQL, use that service’s backups for the database. Back up the sail-data volume yourself as well.