mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 23:52:24 +00:00
feat(backup): restore a dump straight from the off-host bucket
A lost host takes its local dumps with it, and the copy left is the one in the bucket. `docker compose run --rm db-restore latest --from-bucket` now lists `database/` in the bucket the BACKUP_S3_* variables name, takes the newest dump whose manifest is there too (or the one named), downloads both with the S3 client the image already ships, and continues as for any off-host copy: opened with BACKUP_ENCRYPTION_KEY, checked against the manifest, restored into an empty database. `list --from-bucket` shows what is there. The sealed download is removed once it is opened. The image build now proves the S3 client resolves from the shared module's place in the tree, so the restore cannot lose it unnoticed.
This commit is contained in:
1 parent
1a4289545e
commit
82db3de30a
6 files changed
+298
-10
No files matched your search
@@ -147,6 +147,12 @@ describe("db-restore refuses before it writes", () => {
|
||||
expect(await main([], env())).toBe(2);
|
||||
});
|
||||
|
||||
it("refuses --from-bucket without a configured bucket, before it connects", async () => {
|
||||
expect(await main(["latest", "--from-bucket"], env())).toBe(1);
|
||||
expect(errors.join("\n")).toMatch(/--from-bucket needs BACKUP_S3_ENDPOINT/);
|
||||
expect(runTool).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("lists what is there", async () => {
|
||||
writeDump();
|
||||
expect(await main(["list"], env())).toBe(0);
|
||||
|
||||
Reference in new issue
Block a user