|
@@ -77,3 +77,39 @@ Two things learned while setting it up, both visible only in the log:
|
|
|
chronyc sources # ^* marks the selected source
|
|
chronyc sources # ^* marks the selected source
|
|
|
|
|
|
|
|
The container takes the host's clock, so nothing is configured inside it.
|
|
The container takes the host's clock, so nothing is configured inside it.
|
|
|
|
|
+
|
|
|
|
|
+## Backups
|
|
|
|
|
+
|
|
|
|
|
+`backup-smartbotic-db.sh` is installed at `/usr/local/bin/backup-smartbotic-db`
|
|
|
|
|
+on zeus and runs nightly at 03:30 from `/etc/cron.d/smartbotic-db-backup`
|
|
|
|
|
+(cronie, enabled under runit). Archives go to `/data/backups/smartbotic-db`,
|
|
|
|
|
+14 kept - about 32 GB against 1.5 TB free. The log is
|
|
|
|
|
+`/var/log/smartbotic/backup.log`.
|
|
|
|
|
+
|
|
|
|
|
+The container is stopped for the copy and started again immediately after, so
|
|
|
|
|
+the database is down for the copy but not for the verification. A trap restarts
|
|
|
|
|
+it even if the script dies partway.
|
|
|
|
|
+
|
|
|
|
|
+Three things the script insists on, each because the opposite failure is silent:
|
|
|
|
|
+
|
|
|
|
|
+- **The archive is decompressed and listed before it is kept.** A corrupt
|
|
|
|
|
+ archive that is never read is worse than no archive, because it is believed in.
|
|
|
|
|
+- **`storage.key` must be inside it.** The key lives in the data directory and
|
|
|
|
|
+ the data is unreadable without it. Its absence would not be noticed until a
|
|
|
|
|
+ restore was already needed.
|
|
|
|
|
+- **Old archives are pruned only after a good one exists**, so a run of failures
|
|
|
|
|
+ cannot age out the last working copy.
|
|
|
|
|
+
|
|
|
|
|
+### The restore, which has been done
|
|
|
|
|
+
|
|
|
|
|
+Not a procedure on paper - this was run:
|
|
|
|
|
+
|
|
|
|
|
+ zstd -qdc /data/backups/smartbotic-db/<archive>.tar.zst | tar -C <dir> -xf -
|
|
|
|
|
+ docker run -d --name smartbotic-db-restoretest \
|
|
|
|
|
+ -v <dir>:/var/lib/smartbotic-database \
|
|
|
|
|
+ -v /data/smartbotic-db/etc/config.json:/etc/smartbotic-database/config.json:ro \
|
|
|
|
|
+ -p 9005:9004 smartbotic-database:2.8.1
|
|
|
|
|
+
|
|
|
|
|
+It recovered 27,433 documents in 95 collections and served all 9 workflows by
|
|
|
|
|
+name, 7 credentials and 1 user. A 2 MB file downloaded byte-exact, which is what
|
|
|
|
|
+proves the encryption key came through - counting documents would not have.
|