Skip to content

backrest: register the Hola backup hooks itself — today provides: backup@1 asserts coverage the bundle can't enforce #159

Description

@pofallon

What

src/backrest/src/manifest.json:11 declares "provides": ["backup@1"], and Hola treats that as the host's backup provider — the dashboard's Backups page reports every accepting app's coverage on the strength of it.

But the bundle only writes the two broker scripts (src/compose.yaml:59,126,154/config/hola/backup-prepare.sh, /config/hola/backup-finalize.sh). It never registers them with Backrest. BACKREST_CONFIG points at /config/config.json (compose.yaml:6) and nothing generates or patches it, so out of the box a scheduled run calls neither hook.

Our own README says so (README.md:33): "Wire up the hooks — see below. Without them a scheduled run copies live [data]", then asks the operator to add both as Command hooks on the repo or plan in the Backrest UI, with the right conditions (CONDITION_SNAPSHOT_START / ON_ERROR_CANCEL, CONDITION_SNAPSHOT_END / ON_ERROR_IGNORE).

Why it matters

Between install and that manual step, the two facts an operator sees are both wrong in the reassuring direction:

  • provides: ["backup@1"] is true at the contract layer, so Hola shows a provider is installed;
  • the coverage rollup reports each app's participation — quiesced, partial — describing hooks that will not run.

So a Postgres-backed app displays as quiesced while its backup is in fact a live-file copy: crash-consistent at best. The failure is silent, it is only visible by opening the Backrest UI and noticing the hook list is empty, and it points the wrong way — the dashboard actively reassures.

This is also the only thing standing between backup@1 and being genuinely end-to-end, since the broker side (prepare → poll → finalize, failing closed) is already implemented in the scripts and exercised by the server.

Suggested fix

Have backrest-hooks-init own the registration, not just the script bodies:

  • If /config/config.json does not exist, write one whose repo/plan carries both Command hooks.
  • If it does exist, patch it idempotently — add the two hooks when absent, leave everything else alone, and don't re-add on every boot (the same stamped one-shot shape calibre-web uses for its settings, see fix(calibre-web): apply the reader model on upgrades, not just fresh installs #158).
  • Keep the scripts where they are; only the wiring changes.

Worth deciding alongside: whether a provider that cannot self-register should be allowed to declare provides at all, or whether Hola should surface "provider installed but hooks unregistered" — that half belongs in try-hola/hola.

Verified

  • manifest.json:11-12provides/accepts both backup@1.
  • compose.yaml:59,126,154 — writes and chmod +xes both scripts; no config.json handling anywhere in the file.
  • README.md:33,38-54 — documents the manual step and its consequence.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vck5KSX2CLxhohx14nb5Sh

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions