Files
uberbringer/docs/development.md
T
57_WolveandClaude Opus 5.5 3d451eb0b7
Security / Vulnerability check (push) Successful in 39s
Test / Lint and test (push) Successful in 1m57s
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>
2026-11-30 22:33:08 -06:00

5.8 KiB

Development

Contents

Running from source

Build from a clone of the repository.

cp configs/config.example.toml config.toml
go run ./cmd/uberbringer secret        # paste into api.secret
$EDITOR config.toml                    # set printer.address
go run ./cmd/uberbringer token         # prints a bearer token
make run

Go version

The Go version is the go 1.27.4 line in go.mod, the latest Go release:

  • It is the minimum for building, and builds with GOTOOLCHAIN=local need at least that. With the default GOTOOLCHAIN=auto, an older local Go downloads go1.27.4 by itself.
  • CI tests, scans and releases with exactly that release; the workflows read it from go.mod. There is no separate toolchain line.
  • To move to a new Go release, change the go line (go mod edit -go=1.27.5). In the same commit, bump the tool modules golang.org/x/tools, golang.org/x/vuln and honnef.co/go/tools.

Make targets

make check      # the CI gate, below
make build      # bin/uberbringer
make fmt        # gofmt + goimports
make vuln       # govulncheck
make generate   # regenerate docs/swagger.json and the license notices (go generate ./...)
make snapshot   # release archives in dist/; publishes nothing

make check runs the same steps as .gitea/workflows/test.yml, in the same order: gofmt and goimports, go mod tidy -diff, go vet, staticcheck, a check that go generate ./... leaves the generated files unchanged, go test -race -timeout 5m, and goreleaser check, which validates the release config without building. It needs goreleaser installed. govulncheck is not part of it; run make vuln. Run make snapshot after changing .goreleaser.yaml or packaging/. make builds report the version without the leading v, e.g. 0.1.2-3-gabc1234, as release binaries do.

The linters are pinned as Go tools in go.mod, so go tool staticcheck, go tool govulncheck and go tool goimports need no separate install.

Generated files

Never edit these by hand. Change their sources, run go generate ./..., and commit the result with the change.

  • docs/swagger.json is generated by tools/genopenapi from the route table in internal/app/uberbringer/server/routes.go, which the server also registers its routes from. The schemas come from the Go types the routes name: their json and jsonschema tags and their doc comments.
  • THIRD-PARTY-LICENSES.md and its copy internal/app/uberbringer/licenses_embed.md, which the binary embeds and uberbringer licenses prints, are generated by tools/genlicenses. They hold the license and notice files of the Go distribution and of every module that ./cmd/uberbringer links on the release platforms; modules that only the tools and tests use are left out. Regenerate them after adding, bumping or dropping a dependency. The generator fails on a module that ships no license file, or whose license it does not recognize; teach licenseMarkers in tools/genlicenses/notices.go its wording once the license is acceptable.

Package layout

The module path is uberbringer, so packages import as uberbringer/internal/....

cmd/uberbringer/            main: build info, signals, exit code
internal/app/uberbringer/   CLI commands and wiring
  server/                   Fiber HTTP API, auth, health
internal/pkg/config/        Config from TOML and UBERBRINGER_* variables (Viper): defaults, validation
internal/pkg/escpos/        ESC/POS command builder, code pages, barcodes, QR, raster, status, interpreter
internal/pkg/receipt/       Job format, validation, text folding, word wrap, blocks, rendering, preview
internal/pkg/modules/       Modules that build jobs from plain payloads: note, notify, ntfy; notification cards, markdown
internal/pkg/ntfy/          ntfy's message types; the subscriber: stream, cursor, repeats, paper budget, quiet hours
internal/pkg/raster/        Image decoding, scaling and dithering
internal/pkg/safehttp/      SSRF-guarded image fetching
internal/pkg/printer/       TCP printer client (port 9100) and status queries
internal/pkg/printqueue/    Job queue, worker and status history
configs/                    Example configuration
examples/                   Example jobs, such as the block calibration receipt
packaging/                  systemd unit
tools/genlicenses/          Generates THIRD-PARTY-LICENSES.md and its embedded copy from the linked modules
tools/genopenapi/           Generates docs/swagger.json from the route table
docs/                       User docs, API reference, OpenAPI document, design notes and feature plans

CI and releases

CI runs on the Gitea runner from .gitea/workflows/. The repository has no .github/ directory.

  • test.yml runs the make check gate on every branch push. It builds no binaries, and it does not run on pull requests or tags.
  • security.yml runs govulncheck on pushes to main and every Monday at 06:00 UTC. Scheduled runs use main's copy of the workflow.
  • release.yml builds and publishes a release with goreleaser 2.20.3 when a v* tag is pushed.
    • It runs only for tags whose commit is on main, and refuses any other tag.
    • vX.Y.Z-rc.N tags are published as prereleases, so they never become the latest release that install.sh installs.
    • Each archive holds the binary, LICENSE.txt, THIRD-PARTY-LICENSES.md, README.md, CHANGELOG.md, configs/config.example.toml, packaging/uberbringer.service, docs/swagger.json and, from docs/, install.md, docker.md, configuration.md, security.md, api.md, ntfy.md and cli.md.
    • The release notes link to CHANGELOG.md at the tag.