fix: serialise the restic runs and drop the tube host #54

Merged
aleksei merged 2 commits from fix/restic-collision into main 2026-11-28 10:03:44 +00:00
Owner

The hourly backup and the 04:00 maintenance started at the same moment, and the maintenance takes an exclusive lock on the repository, so the backup lost that run every day: its liveness probe failed on the lock and the init fallback reported the failure as "config file already exists". The journal keeps the proof on every host (21–26.11), and the same collision hit all hosts at today's boot, when both Persistent timers caught up at once.

  • the maintenance moves to 04:15, off the top of the hour;
  • both runs are serialised through one lock file (flock /run/restic.lock), so the schedule, a boot-time catch-up or a prune that outlives the hour can no longer overlap them;
  • the repository is initialised only when restic exits 10 ("repository does not exist"); any other failure is reported as it is instead of being taken for a missing repository.

The second commit drops the tube host: inventory, host vars, playbook and SSH key. The jellyfin role stays, as a role describes one piece of software rather than the host that runs it; the pool-side SFTP user and its repository were left untouched.

Deployed to the eight remaining restic hosts (ai, chat, gateway, git, music, note, photo, vault); a second run is idempotent. Verified on gateway: a backup started while the lock was held by flock /run/restic.lock sleep 15 waited 16 s, then saved its snapshot with Result=success.

The hourly backup and the 04:00 maintenance started at the same moment, and the maintenance takes an exclusive lock on the repository, so the backup lost that run every day: its liveness probe failed on the lock and the init fallback reported the failure as "config file already exists". The journal keeps the proof on every host (21–26.11), and the same collision hit all hosts at today's boot, when both `Persistent` timers caught up at once. - the maintenance moves to 04:15, off the top of the hour; - both runs are serialised through one lock file (`flock /run/restic.lock`), so the schedule, a boot-time catch-up or a prune that outlives the hour can no longer overlap them; - the repository is initialised only when restic exits 10 ("repository does not exist"); any other failure is reported as it is instead of being taken for a missing repository. The second commit drops the tube host: inventory, host vars, playbook and SSH key. The jellyfin role stays, as a role describes one piece of software rather than the host that runs it; the pool-side SFTP user and its repository were left untouched. Deployed to the eight remaining restic hosts (ai, chat, gateway, git, music, note, photo, vault); a second run is idempotent. Verified on gateway: a backup started while the lock was held by `flock /run/restic.lock sleep 15` waited 16 s, then saved its snapshot with `Result=success`.
The hourly backup and the 04:00 maintenance start together and the maintenance takes an exclusive repository lock, so the backup lost that run every day: its liveness probe failed on the lock and the init fallback turned the failure into "config file already exists".

Move the maintenance off the top of the hour, order both runs through one lock file, and initialise the repository only when restic exits 10 (repository does not exist) so any other failure is reported as it is.
The host is gone: remove it from the inventory, its host vars, its playbook and its SSH key. The jellyfin role stays, as a role describes one piece of software and not the host that runs it.
aleksei deleted branch fix/restic-collision 2026-11-28 10:03:44 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/infra!54
No description provided.