{{define "content"}}{{template "settings-start" .}}{{with .Data}}
Supermarket's database is Postgres, on the server. It's dumped every night at 03:00, and two weeks of dumps are kept. Keys and tokens are in it too, encrypted with the server's secret key: a dump restored elsewhere needs that key as well.
{{if not .Dir}}Supermarket doesn't know where the dumps are (SUPERMARKET_PG_BACKUPS). With compose.server.yaml, they're in the pgbackups volume; whoever runs Postgres otherwise backs it up their own way.
The dumps can't be read: {{.}}
{{end}} {{with .Stale}}The last dump is from {{.Local.Format "2 Jan 2006"}}: the nightly backup isn't working. Check the backup service's log on the server.
{{end}} {{if .Dumps}}{{len .Dumps}} dump{{if ne (len .Dumps) 1}}s{{end}}, {{bytes .Total}} in all.
| Made | File | Size |
|---|---|---|
| {{.At.Local.Format "2 Jan 2006, 15:04"}} {{ago .At}} | {{.Name}} | {{bytes .Size}} |
No dumps yet: the first is made when the backup service starts.
Restoring is done on the server, by whoever runs it, so that no one can undo the team's work from a browser. Stop Supermarket, restore the dump over the database, and start it again:
docker compose -f compose.server.yaml --env-file server.env stop supermarket docker compose -f compose.server.yaml --env-file server.env exec backup \ pg_restore --clean --if-exists --no-owner -d supermarket /backups/supermarket-YYYY-MM-DD.dump docker compose -f compose.server.yaml --env-file server.env start supermarket
To move to another server, supermarket export and supermarket import work too, from either database to either.