Split the README into focused docs under docs/
The README had grown to 658 lines. It is now a short overview: what Überbringer is, a quick start, a table of the docs and the licence. Each topic it held has a document of its own: - docs/install.md: install.sh, what it leaves behind, and upgrading. - docs/docker.md: the image behind a reverse proxy, the env file, health checks, and the ntfy state volume and token file. - docs/configuration.md: loading, environment variables, a table of every key in every section, and what is logged. The list of log messages becomes a summary of what is logged and reported. - docs/security.md: the API secret, issuing tokens and their scopes, the header-file recipe that keeps tokens off command lines (moved from docs/api.md), the reverse proxy, image URLs, and what is never logged. - docs/ntfy.md: the ntfy subscriptions, securing the topics and the printer's token, with the token scripts unchanged. - docs/cli.md: the command line. - docs/development.md: running from source, the Go version, make targets, the gate, generated files, the layout, CI and releases. CLAUDE.md names the new docs: a config key is now documented in docs/configuration.md, and the layout and Go version in docs/development.md. docs/api.md, design.md and the job-store plan point to the docs that now hold what they referred to in the README. The release archives also carry the docs on running the daemon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
80a65f6083
commit
3d451eb0b7
14 files changed
+934
-678
No files matched your search
+21
-21
@@ -92,10 +92,10 @@ Before stage 1c:
|
||||
Before stage 1d:
|
||||
|
||||
13. **The libc pin.** modernc requires the exact `modernc.org/libc` its go.mod pins (v1.80.1 for v1.63.0; the latest libc is v1.82.14). Assumed: the owner accepts this exception to "latest stable" for libc alone, which then moves only with `modernc.org/sqlite`. Stage 1d records it in CLAUDE.md's dependency rule and in design.md, and adds a gate check, since a routine `go get -u` would otherwise move libc and break the driver silently. The other new indirect modules are `modernc.org/mathutil`, `modernc.org/memory`, `github.com/dustin/go-humanize`, `github.com/ncruces/go-strftime` and `github.com/remyoudompheng/bigfft`; bigfft has no tagged release, so it comes in at a pseudo-version, as a few indirect modules in go.mod already do. This question falls away if question 1 picks another store.
|
||||
14. **The Docker image's state directory.** Assumed: the image sets `UBERBRINGER_STATE_DIR=/var/lib/uberbringer`, so every container keeps a job store there, and it declares no `VOLUME`; the README asks for a named volume, or a bind mount owned by `10001:10001`. This is **Breaking**: a container started with `--read-only` and no volume, or with a bind mount owned by root, stops at start where 0.2.0 ran, since today only containers with subscriptions touch the directory. Trade-off: a `VOLUME` would give such containers an anonymous volume and let them start, but anonymous volumes pile up, and a new container silently starts with an empty one.
|
||||
14. **The Docker image's state directory.** Assumed: the image sets `UBERBRINGER_STATE_DIR=/var/lib/uberbringer`, so every container keeps a job store there, and it declares no `VOLUME`; docs/docker.md asks for a named volume, or a bind mount owned by `10001:10001`. This is **Breaking**: a container started with `--read-only` and no volume, or with a bind mount owned by root, stops at start where 0.2.0 ran, since today only containers with subscriptions touch the directory. Trade-off: a `VOLUME` would give such containers an anonymous volume and let them start, but anonymous volumes pile up, and a new container silently starts with an empty one.
|
||||
15. **Operational defaults.** Each assumed:
|
||||
- A store that cannot be opened stops the daemon with an error naming the file, and the README gives the steps to move it aside. A damaged ntfy state file, by contrast, means a fresh start with a warning. Trade-off: starting with an empty store would silently forget the waiting jobs and which jobs were in doubt.
|
||||
- The stop timeout must exceed `printer.write_timeout` plus about 10 s (Architecture, JOB STATES). The unit keeps systemd's 90 s default, enough at the default 30-s write; the README asks Docker users, whose default is 10 s, for `--stop-timeout 40` at the defaults. Trade-off: a shorter timeout kills a write, which leaves its job `uncertain`, never doubled.
|
||||
- A store that cannot be opened stops the daemon with an error naming the file, and docs/install.md and docs/docker.md give the steps to move it aside. A damaged ntfy state file, by contrast, means a fresh start with a warning. Trade-off: starting with an empty store would silently forget the waiting jobs and which jobs were in doubt.
|
||||
- The stop timeout must exceed `printer.write_timeout` plus about 10 s (Architecture, JOB STATES). The unit keeps systemd's 90 s default, enough at the default 30-s write; docs/docker.md asks Docker users, whose default is 10 s, for `--stop-timeout 40` at the defaults. Trade-off: a shorter timeout kills a write, which leaves its job `uncertain`, never doubled.
|
||||
- `UMask=0077` in the unit, so the WAL and any later file are 0600 like the database. Trade-off: none known; the state directory is 0700 already.
|
||||
- CI and the gate gain a `CGO_ENABLED=0` build of linux/arm (GOARM=6) and linux/arm64, and the libc check (question 13). Trade-off: a longer CI run; today nothing compiles the arm targets before a release tag.
|
||||
|
||||
@@ -309,7 +309,7 @@ COMPATIBILITY
|
||||
- Job status keeps its shape until there are several printers; only then does it gain the `deliveries` array (Architecture, DELIVERIES AND SEVERAL PRINTERS).
|
||||
- What prints does not change. TestRenderCompat and TestPaperReceipts keep passing.
|
||||
- The Docker image keeps a job store in `/var/lib/uberbringer`, so a container that cannot write there stops at start (question 14, **Breaking**).
|
||||
- A downgrade: an older binary refuses `[state] dir` and `queue.content_bytes` as unknown keys and ignores `jobs.db`. The CHANGELOG and README say so.
|
||||
- A downgrade: an older binary refuses `[state] dir` and `queue.content_bytes` as unknown keys and ignores `jobs.db`. The CHANGELOG and docs/configuration.md say so.
|
||||
|
||||
INVARIANTS
|
||||
1. Nothing reaches the printer unless the whole receipt rendered.
|
||||
@@ -351,7 +351,7 @@ A job has one or more deliveries, one per printer it goes to (DELIVERIES AND SEV
|
||||
- The stop timeout must therefore exceed `printer.write_timeout` plus about 10 s (question 15). A SIGKILL mid-write leaves the job `uncertain`.
|
||||
|
||||
STORE FAILURES (question 11)
|
||||
- A store that cannot be opened stops the daemon with an error naming the file. The README's steps: stop the daemon, move `jobs.db` and `jobs.db-wal` aside together, start it again (`systemctl reset-failed uberbringer` first if systemd stopped restarting it). The stored jobs are forgotten, and which of the last receipts printed must be checked against the paper by hand.
|
||||
- A store that cannot be opened stops the daemon with an error naming the file. The steps in docs/install.md and docs/docker.md: stop the daemon, move `jobs.db` and `jobs.db-wal` aside together, start it again (`systemctl reset-failed uberbringer` first if systemd stopped restarting it). The stored jobs are forgotten, and which of the last receipts printed must be checked against the paper by hand.
|
||||
- After Open, any failed store write stops the daemon, as question 11 describes. Nothing is retried, since a write that failed once (a full disk, a damaged page) seldom succeeds a moment later.
|
||||
|
||||
TELLING WHICH RECEIPTS PRINTED BEFORE A CRASH
|
||||
@@ -515,16 +515,16 @@ API
|
||||
- Every route is an entry in the table in `server/routes.go`, written there in OpenAPI form (`{id}`; api.md writes `:id`), with its case in TestRoutesConform. Every code goes into `server/errors.go`, the table in docs/api.md and the regenerated swagger.json.
|
||||
|
||||
CONFIG, PACKAGING, INSTALL.SH, DOCKER, WINDOWS
|
||||
- Config (question 4): `[state] dir`, with no default, required with an ntfy subscription, empty keeping the queue in memory. Stage 1c adds `queue.content_bytes`, default 67108864 (64 MiB), 0 to 1 GiB, an `int64` so 32-bit ARM can hold it. Each gets its default, validation, `configs/config.example.toml` entry and README § Configuration. `ntfy.state_dir` goes, and its `[Unreleased]` CHANGELOG entry is edited rather than listed as Breaking.
|
||||
- Config (question 4): `[state] dir`, with no default, required with an ntfy subscription, empty keeping the queue in memory. Stage 1c adds `queue.content_bytes`, default 67108864 (64 MiB), 0 to 1 GiB, an `int64` so 32-bit ARM can hold it. Each gets its default, validation, `configs/config.example.toml` entry and docs/configuration.md. `ntfy.state_dir` goes, and its `[Unreleased]` CHANGELOG entry is edited rather than listed as Breaking.
|
||||
- Files: `<dir>/jobs.db` and `<dir>/jobs.db-wal` (no `-shm` in exclusive mode), and `<dir>/ntfy-<name>.json`.
|
||||
- The unit already has `StateDirectory=uberbringer` with mode 0700. Add `UMask=0077` (question 15), and reword the comment that names `ntfy.state_dir`.
|
||||
- install.sh writes `[state] dir = "/var/lib/uberbringer"` into new configs. Re-runs keep the config, so an older config keeps the memory queue until the owner adds the line; the README says so.
|
||||
- Docker (question 14): `UBERBRINGER_STATE_DIR=/var/lib/uberbringer` replaces `UBERBRINGER_NTFY_STATE_DIR`, and the comment says the directory holds the job store and the ntfy state. The README asks for a named volume there, or a bind mount owned by `10001:10001`, not a Docker Desktop bind mount, since WAL needs a local filesystem, and for a stop timeout above `printer.write_timeout` plus 10 s (`--stop-timeout 40` at the defaults).
|
||||
- install.sh writes `[state] dir = "/var/lib/uberbringer"` into new configs. Re-runs keep the config, so an older config keeps the memory queue until the owner adds the line; docs/install.md says so.
|
||||
- Docker (question 14): `UBERBRINGER_STATE_DIR=/var/lib/uberbringer` replaces `UBERBRINGER_NTFY_STATE_DIR`, and the comment says the directory holds the job store and the ntfy state. docs/docker.md asks for a named volume there, or a bind mount owned by `10001:10001`, not a Docker Desktop bind mount, since WAL needs a local filesystem, and for a stop timeout above `printer.write_timeout` plus 10 s (`--stop-timeout 40` at the defaults).
|
||||
- Windows is for development only. modernc builds there and its WAL works (spike); it syncs with FlushFileBuffers. `state.dir` has no default, so `go run` and the tests keep the memory queue unless a directory is set.
|
||||
- Builds: nothing in CI compiles the arm targets today. Stage 1d adds the arm builds and the libc check to `test.yml`, the Makefile's `check` and CLAUDE.md's gate (question 15).
|
||||
|
||||
LOGGING AND PRIVACY
|
||||
- Print contents now rest on disk: 0600 files in a 0700 directory, `secure_delete=FAST`, and retention by question 9. README § Configuration says so.
|
||||
- Print contents now rest on disk: 0600 files in a 0700 directory, `secure_delete=FAST`, and retention by question 9. docs/configuration.md says so.
|
||||
- No SQL is logged, and statements take parameters. Store errors name the operation and the job, never a value. If GORM is chosen, its logger is silenced.
|
||||
- At start, one INFO line gives the number of jobs resumed, and one WARN line names each delivery that start turned `uncertain` by `job_id`, `printer`, `source` and `ref`.
|
||||
- A store failure is an unexpected error: logged once at ERROR and reported to Sentry once, without content.
|
||||
@@ -618,7 +618,7 @@ Packaging
|
||||
|
||||
Docs
|
||||
- configs/config.example.toml: `[state] dir` added; `[ntfy] state_dir` removed.
|
||||
- README: the install note on `/var/lib/uberbringer`, the Docker paragraph, the `ntfy.state_dir` entry under Configuration (it becomes `state.dir`), the ntfy example config, and the State paragraph's `<state_dir>/ntfy-<name>.json`.
|
||||
- The install note on `/var/lib/uberbringer` in docs/install.md, the ntfy paragraph of docs/docker.md, the `ntfy.state_dir` entry in docs/configuration.md (it becomes `state.dir`), and in docs/ntfy.md the example config and the State paragraph's `<state_dir>/ntfy-<name>.json`.
|
||||
- design.md: the ntfy State paragraph, which names `ntfy.state_dir`.
|
||||
- CHANGELOG: the `[Unreleased]` entry that adds `ntfy.state_dir`, edited.
|
||||
|
||||
@@ -671,7 +671,7 @@ internal/app/uberbringer/server
|
||||
Docs
|
||||
- docs/api.md: job status (`uncertain`, `sent_at`, and what `failed` with `sent_at` means).
|
||||
- docs/swagger.json regenerated.
|
||||
- README: `queue.content_bytes` under Configuration.
|
||||
- docs/configuration.md: `queue.content_bytes`.
|
||||
- configs/config.example.toml: `[queue] content_bytes`.
|
||||
- design.md: "Jobs remember their source" (a digest's reference), and the digest paragraph of the ntfy subscriptions.
|
||||
- CHANGELOG: under **Breaking**, the `uncertain` status; under Added, `sent_at` and `queue.content_bytes`; under Changed, a digest's reference in the logs.
|
||||
@@ -738,14 +738,14 @@ Packaging
|
||||
|
||||
Docs
|
||||
- design.md: replace "The queue lives in memory, on purpose" with the store the owner chose, the state machine, the sync policy and store failures, with stage 1a's numbers. Update the diagram ("printqueue (memory, 1 worker)") and "no database", the ntfy paragraph that says waiting jobs are lost, and the statement that ESC/POS has no acknowledgement. Record the libc exception (question 13). Shrink the Deferred item to the previews.
|
||||
- README:
|
||||
- Configuration: `state.dir` now holds the job store too; a privacy note.
|
||||
- The install notes and the Docker section: the state directory, a named volume or a bind mount owned by `10001:10001`, and the stop timeout.
|
||||
- The ntfy "Jobs" paragraph, which says a waiting job is lost at shutdown.
|
||||
- The worker's log lines.
|
||||
- The steps for a store that will not open (STORE FAILURES).
|
||||
- A downgrade note.
|
||||
- Development: the layout (`internal/pkg/jobstore`, `tools/libcpin`), the `make check` steps, and "CI and releases", which says test.yml builds no binaries.
|
||||
- The docs:
|
||||
- docs/configuration.md: `state.dir` now holds the job store too; a privacy note.
|
||||
- docs/install.md and docs/docker.md: the state directory, a named volume or a bind mount owned by `10001:10001`, and the stop timeout.
|
||||
- docs/ntfy.md: the "Jobs" paragraph, which says a waiting job is lost at shutdown.
|
||||
- docs/configuration.md: the worker's log lines, under Logs.
|
||||
- docs/install.md and docs/docker.md: the steps for a store that will not open (STORE FAILURES).
|
||||
- docs/configuration.md: a downgrade note.
|
||||
- docs/development.md: the layout (`internal/pkg/jobstore`, `tools/libcpin`), the `make check` steps, and "CI and releases", which says test.yml builds no binaries.
|
||||
- docs/api.md: job status (what survives a restart) and the `job_not_found` row.
|
||||
- CHANGELOG: under Added, jobs survive a restart; under **Breaking**, that with a state directory waiting jobs print after a restart instead of failing, and the Docker image's store (question 14); the downgrade note.
|
||||
- CLAUDE.md: the layout and the imports (jobstore → printqueue; internal/app → jobstore); the gate's new steps, and line 75's "It builds no binaries"; the libc exception beside the rule that dependencies are at their latest stable release.
|
||||
@@ -856,7 +856,7 @@ internal/app/uberbringer/server
|
||||
|
||||
Docs
|
||||
- docs/api.md: the route table, a "Cancel a job" section, the `job_started` row in the error table, and the Job status section (`cancelled`).
|
||||
- README: how a subscription behaves: a `message_delete` cancels the waiting receipts of its notification and drops its held digest rows, also under `min_priority` and past `max_backlog`; a `message_clear` does neither; `min_priority` is applied by the subscriber, which reads every message of its topics.
|
||||
- docs/ntfy.md: how a subscription behaves: a `message_delete` cancels the waiting receipts of its notification and drops its held digest rows, also under `min_priority` and past `max_backlog`; a `message_clear` does neither; `min_priority` is applied by the subscriber, which reads every message of its topics.
|
||||
- design.md: the state machine's `cancelled`, its synced commit and the delivery lock; the ntfy subscriptions paragraph (deletes cancel, clears do not, and the subscriber filters priorities itself).
|
||||
- docs/plans/formatters.md: its phase 5 item "Queue.Cancel so message_delete can cancel a still-queued job" goes, since this phase builds it.
|
||||
- CHANGELOG: under **Breaking**, the `cancelled` status; under Added, `DELETE /api/v1/jobs/{id}` and cancelling by ntfy deletes; under Changed, that a subscription with `min_priority` reads every message and filters itself.
|
||||
@@ -964,7 +964,7 @@ internal/app/uberbringer
|
||||
Docs
|
||||
- docs/api.md: the preview section (the PNG, the fetch deadline, the cap) and the error row. The text and JSON previews still fetch no images; the PNG preview does.
|
||||
- design.md: why the picture is drawn from the bytes rather than the layout; the font, its licence, and why box drawing is drawn rather than taken from it; "The preview reads the bytes back" ("a preview never fetches anything") and "Images are fetched by the worker" ("a slow or broken image URL holds no HTTP request"), which a PNG preview no longer keeps to.
|
||||
- README: the CLI, and § Development's layout (`internal/pkg/paper`, `tools/genglyphs`).
|
||||
- docs/cli.md, and the layout in docs/development.md (`internal/pkg/paper`, `tools/genglyphs`).
|
||||
- CLAUDE.md: the layout and the imports (receipt → paper → escpos).
|
||||
- CHANGELOG. docs/swagger.json regenerated.
|
||||
|
||||
|
||||
Reference in new issue
Block a user