A backup file is one encrypted file with a name that ends in .psdbackup. It holds your database, every photo and signature, and your licence state. You can copy it to a USB drive or a network drive, and it brings the whole business back on any computer when you type your recovery key. You will be able to choose the folder, read the status and check a file.
Before you start #
- Only the owner uses backups.
- Write down your recovery key and keep it away from the server computer. A backup file opens with the recovery key that was current on the day the file was made. See "The vault and your recovery key".
- The server needs a recovery key before it makes a file. Without one, the status shows the reason and no file is made.
Choose where the files go #
- Pick a folder on another drive, such as a USB drive or a network share. The default folder is
archivesinside the data folder, and a disk failure takes that folder along with the data. - Send
PATCH /backup/settingswith{"folder": "/Volumes/Backup"}(a full path). The server makes the folder if needed and writes a small test file to prove it can save there. - Set how long files stay with
keep_days(30 by default, 1 to 3650). Files older than that are removed after each new backup, and the newest file always stays. - Switch the schedule off with
{"enabled": false}. The internal nightly snapshots continue.
What the schedule does #
- The server checks every 30 minutes. When no file was made in the last 24 hours, it takes a snapshot, scrubs the secrets, makes the backup file and opens the file again to check it.
- When the folder is unavailable, for example the USB drive is unplugged, the status shows the reason and the server tries again every 30 minutes.
- Once a month the server restores the newest file into a scratch copy and checks it. The scratch copy is deleted afterwards.
- To make a file now, send
POST /backup/archives. The answer lists the file name, its size, its checksum andchecked: true.
Read the status #
GET /backup/status returns:
last_good: when the last file was made, its name, size, row count and number of photo and signature files.alert: true when the last good backup is older than 48 hours, or when no file was ever made.alert_messagesays what to do. The console can show this as a banner.last_error: the reason the most recent attempt failed, if it did.test_restore: the result of the latest monthly test with its time, the file tested and the row count.folder_is_default: true while files still go to the data folder. Choose another folder.
Check a file yourself #
Run dispatch-server verify-backup <file>. Type your recovery key when asked. The command opens the file, checks every file hash and reports the rows and photos inside. It changes nothing.
Technical details
- Format: the magic
PSDBAK01, a plain header (format, time, random salt and the data key sealed by your recovery key, the same sealed copy asrecovery.json), the body in encrypted chunks of up to 1 MiB (AES-256-GCM, a key derived from the data key and the salt, each chunk bound to the header and its position), and a trailer holding the SHA-256 of every byte before it. - The body lists
manifest.jsonfirst, thendb,licence-state.jsonandfiles/<business>/<file>. The manifest holds the row count of every table and the SHA-256 and size of every file. - A file with a changed or missing byte fails the trailer check before any key is asked for, so damage is never reported as a wrong key. A chunk changed with the trailer recomputed fails its own seal check.
- The database inside is the scrubbed snapshot, so passwords, sign-in tokens, authenticator secrets and webhook secrets are absent. See "Backups and restore".
- File names read
pop-street-dispatch-<UTC time>-<kind>.psdbackup. Retention reads the time in the name, so copying files to another drive keeps it intact. Other files in the folder stay untouched. - Settings and status are
backup-settings.jsonandbackup-status.jsonin the data folder, outside the database, so a restore never rewinds them. - Optional copy to a bucket that speaks the S3 protocol: set
PSD_BACKUP_S3=on,PSD_BACKUP_S3_ENDPOINT(anhttps://address),PSD_BACKUP_S3_REGION,PSD_BACKUP_S3_BUCKET,PSD_BACKUP_S3_PREFIX(optional),PSD_BACKUP_S3_ACCESS_KEY_IDandPSD_BACKUP_S3_SECRET_ACCESS_KEY. Each file is sent with a signedPUTover HTTPS. The server removes nothing from the bucket, so set a lifecycle rule there. The status shows the result of the last copy underbucket. - The monthly test uses the data key held by the server. It proves the file opens, matches its manifest and passes the data check. To prove your written recovery key, run
verify-backupand type it.
If something goes wrong #
last_errorsays the recovery key is missing: the data folder has norecovery.json. Rundispatch-server new-recovery-key, write the key down, and the next backup succeeds.last_errornames the backup folder: the drive is unplugged, full or read-only. Reconnect it or choose another folder. The next try follows within 30 minutes.- The test restore reports "damaged": the newest file changed after it was written. Make a new file with
POST /backup/archivesand copy the old one again from its source. - The settings call answers "That folder cannot be written to": choose a folder the server's account can write.