From 9bf82565775f9ecb45d05c0e58646a2f95aa3c3e Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Wed, 30 Sep 2026 01:50:33 +0200 Subject: [PATCH] Keep backups where the control plane can see them The first backup on the live control plane was written, and the control plane reported none: /var/backups/llmgw already existed, made by an earlier move to PostgreSQL for its own dumps, owned by postgres and 0700. MkdirAll leaves an existing directory as it is, so the archive landed where the llmgw user could not list it, and llmgw_backup_last_success_timestamp_seconds said 0. Opening that directory up would have exposed the dumps already in it, so backups get their own, /var/backups/llmgw-server. And `llmgw server backup` now warns when the directory it wrote to is one the control plane cannot list, rather than leaving that to be found from an alert. Co-Authored-By: Claude Opus 5.5 (1M context) --- deploy/systemd/llmgw-backup.service | 2 +- docs/install.md | 6 +++--- docs/reference.md | 2 +- internal/cli/backup.go | 23 ++++++++++++++++++++++- internal/cli/backup_test.go | 12 ++++++++++++ internal/config/config.go | 2 +- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/deploy/systemd/llmgw-backup.service b/deploy/systemd/llmgw-backup.service index 268fbe5..c830afa 100644 --- a/deploy/systemd/llmgw-backup.service +++ b/deploy/systemd/llmgw-backup.service @@ -1,5 +1,5 @@ [Unit] -Description=llmgw backup: the store and /etc/llmgw, to /var/backups/llmgw +Description=llmgw backup: the store and /etc/llmgw, to /var/backups/llmgw-server After=llmgw-server.service postgresql.service [Service] diff --git a/docs/install.md b/docs/install.md index b282b0a..27d5409 100644 --- a/docs/install.md +++ b/docs/install.md @@ -973,7 +973,7 @@ cannot be rebuilt without: certificate authority's key (`pki/`). Nothing in llmgw can reconstruct that key; losing it means reissuing every node's identity. -Archives go to `/var/backups/llmgw`, readable by root only because of the CA +Archives go to `/var/backups/llmgw-server`, readable by root only because of the CA key, and the newest 14 are kept. Run it nightly with the timer: ``` @@ -981,7 +981,7 @@ sudo install -m 0644 deploy/systemd/llmgw-backup.service deploy/systemd/llmgw-ba sudo systemctl daemon-reload sudo systemctl enable --now llmgw-backup.timer sudo systemctl start llmgw-backup.service # one now, to see it work -ls -l /var/backups/llmgw +ls -l /var/backups/llmgw-server ``` The control plane publishes when the newest archive was written as @@ -1006,7 +1006,7 @@ them: ``` sudo systemctl stop llmgw-server -mkdir /tmp/restore && sudo tar -xzf /var/backups/llmgw/llmgw-backup--