Check state.dir at start, with or without subscriptions

Breaking: the Docker image sets state.dir, so a container that cannot
write /var/lib/uberbringer, one started --read-only without a volume
there or with a bind mount owned by root, no longer starts, ntfy
subscriptions or not: mount a named volume or a directory owned by
10001:10001.

The daemon created state.dir and checked that it could write there only
when an ntfy subscription was configured, since only subscriptions kept
files in it. The job store will keep its database there too, so the
check now runs once at start whenever state.dir is set: the directory
is created 0700 if it is missing, and one that cannot be made or
written stops the start with an error naming state.dir, before any
subscription is made. A state.dir of only spaces is refused whether or
not a subscription is configured, rather than made as a directory of
that name. Without state.dir nothing changes.

Part of stage 1d of docs/plans/job-store.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-12-01 16:39:48 -06:00
1 parent 2926a69598
commit 4eb620dde0
9 files changed
+105 -30

No files matched your search

+10 -2
View File
@@ -13,6 +13,12 @@ version may break callers; such changes are listed under **Breaking**.
while it was sending the job to the printer, so the receipt may have
printed. Such a job is never sent again. Clients that switch on `status`
must handle it.
- The Docker image sets `state.dir`, and the daemon now checks at start
that it can write there, with or without ntfy subscriptions, so a
container that cannot write `/var/lib/uberbringer` no longer starts:
one started with `--read-only` and no volume there, or with a bind mount
owned by root. Mount a named volume there, or a directory owned by
`10001:10001` (`docs/docker.md`).
- A job with a `raw` element prints only with a token issued with
`uberbringer token --raw`. Every other token, every token issued so far
included, gets `403` `token_scope` for it and keeps every other route.
@@ -68,8 +74,10 @@ version may break callers; such changes are listed under **Breaking**.
when it ends.
- A message that replaces one the subscription printed is marked
`(updated)`, or left out with `ntfy.format.updates = "skip"`.
- `state.dir` keeps each subscription's state across restarts.
`install.sh` writes it into a new config and the systemd unit gains
- `state.dir` keeps each subscription's state across restarts. The
daemon checks at start that it can write there, with or without
subscriptions, and refuses one of only spaces. `install.sh` writes it
into a new config and the systemd unit gains
`StateDirectory=uberbringer`, so `/var/lib/uberbringer` is writable;
the Docker image sets it to that path, for a volume, and runs as user
and group `10001`, so a mounted token file can be given to it.