Single-binary distribution: generated systemd unit, CLI bootstrap → SQLite config, tool preflight #35

Closed
opened 2026-07-17 21:08:19 -05:00 by kreeader-user · 1 comment
Owner

Goal

Single-binary distribution posture for the GitHub release: the server runs from one downloaded binary, generates (never installs) its own systemd unit, bootstraps from CLI args, and keeps all subsequent configuration in SQLite behind the Settings UI.

Decisions (Andrew, 2026-07-17)

  1. systemd: generate only, never install. A service generate subcommand prints the unit to stdout by default; --write <path> writes it, offering the standard placements (/etc/systemd/system/, ~/.config/systemd/user/) as suggestions. It must never enable, start, or overwrite a package-manager-owned unit. Include the socket-activation variant (already supported by the server).
  2. Bootstrap via CLI args, then DB. Initial parameters (port, db path, library paths, cache dir) come from CLI arguments on first run; anything passed as args is saved into AppSettings once the DB initializes. Subsequent config changes (args or Settings UI) also persist to the DB. Precedence: flags > DB > defaults. Existing installs: one-shot TOML import backfill (same pattern as librarian.backfilled) so /etc/kreeader keeps working and nothing is retyped.
  3. First-run preflight warnings. On first run, warn on the CLI if tesseract is missing (it is exec'd, so this is detectable, and OCR features gate off via ocr.Available()). Warn if the CUDA OpenCV path is unavailable (CPU fallback engaged). NOTE the hard constraint: OpenCV itself is dynamically linked — if libopencv is absent the loader kills the process before main(), so no in-binary warning is possible for that case; mitigation is packaging-side (release-notes dependency list + container image).
  4. Settings: manual tool paths. A Settings card for external-tool paths, starting with the tesseract binary path (validated when set); the same card is the future home for other Tier-1 external tools.

Repo & branch

kreeader-server. Library paths becoming runtime-editable is the largest sub-task (libpath roots are registered at startup; changing them live touches the relative-path machinery) and may deserve its own branch/issue when picked up.

Staged order

(1) settings precedence + TOML-import backfill, (2) library paths runtime-editable, (3) service generate subcommand + preflight warnings + tool-path Settings card, (4) per-platform release artifacts + container image.

Constraints

  • api/openapi.yaml is a hand-maintained contract: mirror any new/changed routes.
  • The ComicVine key in config.toml.example is intentionally committed — never scrub it.
  • Existing butcher deployment must upgrade cleanly (pacman-owned unit and /etc/kreeader untouched by default).

Acceptance criteria

  • Fresh box: download binary → run with -port/-library args → open web UI → everything else configured from Settings; args persisted to DB.
  • service generate prints a correct unit; --write honors the chosen placement; never enables/installs.
  • First run without tesseract prints a clear warning; Settings path field restores OCR without reinstalling.
  • Existing TOML-based install upgrades with zero behavior change.
## Goal Single-binary distribution posture for the GitHub release: the server runs from one downloaded binary, generates (never installs) its own systemd unit, bootstraps from CLI args, and keeps all subsequent configuration in SQLite behind the Settings UI. ## Decisions (Andrew, 2026-07-17) 1. **systemd: generate only, never install.** A `service generate` subcommand prints the unit to stdout by default; `--write <path>` writes it, offering the standard placements (`/etc/systemd/system/`, `~/.config/systemd/user/`) as suggestions. It must never enable, start, or overwrite a package-manager-owned unit. Include the socket-activation variant (already supported by the server). 2. **Bootstrap via CLI args, then DB.** Initial parameters (port, db path, library paths, cache dir) come from CLI arguments on first run; anything passed as args is saved into AppSettings once the DB initializes. Subsequent config changes (args or Settings UI) also persist to the DB. Precedence: flags > DB > defaults. Existing installs: one-shot TOML import backfill (same pattern as librarian.backfilled) so /etc/kreeader keeps working and nothing is retyped. 3. **First-run preflight warnings.** On first run, warn on the CLI if tesseract is missing (it is exec'd, so this is detectable, and OCR features gate off via ocr.Available()). Warn if the CUDA OpenCV path is unavailable (CPU fallback engaged). NOTE the hard constraint: OpenCV itself is dynamically linked — if libopencv is absent the loader kills the process before main(), so no in-binary warning is possible for that case; mitigation is packaging-side (release-notes dependency list + container image). 4. **Settings: manual tool paths.** A Settings card for external-tool paths, starting with the tesseract binary path (validated when set); the same card is the future home for other Tier-1 external tools. ## Repo & branch kreeader-server. Library paths becoming runtime-editable is the largest sub-task (libpath roots are registered at startup; changing them live touches the relative-path machinery) and may deserve its own branch/issue when picked up. ## Staged order (1) settings precedence + TOML-import backfill, (2) library paths runtime-editable, (3) `service generate` subcommand + preflight warnings + tool-path Settings card, (4) per-platform release artifacts + container image. ## Constraints - api/openapi.yaml is a hand-maintained contract: mirror any new/changed routes. - The ComicVine key in config.toml.example is intentionally committed — never scrub it. - Existing butcher deployment must upgrade cleanly (pacman-owned unit and /etc/kreeader untouched by default). ## Acceptance criteria - Fresh box: download binary → run with `-port`/`-library` args → open web UI → everything else configured from Settings; args persisted to DB. - `service generate` prints a correct unit; `--write` honors the chosen placement; never enables/installs. - First run without tesseract prints a clear warning; Settings path field restores OCR without reinstalling. - Existing TOML-based install upgrades with zero behavior change.
Author
Owner

All stages shipped and deployed (r329): service generate subcommand (stdout-first, --write/--user, never installs), first-run preflight warnings, CLI-args→AppSettings persistence with flags>DB>file>defaults precedence, one-shot TOML import (config.toml_imported.v1). Library paths now DB-resolvable. Verified live on butcher.

All stages shipped and deployed (r329): `service generate` subcommand (stdout-first, --write/--user, never installs), first-run preflight warnings, CLI-args→AppSettings persistence with flags>DB>file>defaults precedence, one-shot TOML import (config.toml_imported.v1). Library paths now DB-resolvable. Verified live on butcher.
Sign in to join this conversation.
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
kreeader/kreeader-server#35
No description provided.