Files
uberbringer/README.md
T
57_WolveandClaude Opus 5.5 15f63b6846
Security / Vulnerability check (push) Successful in 42s
Test / Lint and test (push) Successful in 1m53s
Shorten the README's install script section to bullets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 08:18:50 -06:00

37 KiB
Raw Blame History

Überbringer

Bringer of information. A small daemon that takes print jobs as JSON over a REST API and prints them on an EPSON ESC/POS network receipt printer.

  • Queue with job status: jobs return immediately with an ID and print in order on a background worker, with retries when the printer is offline.
  • Plain-text input: send UTF-8 text, including accents, £ ° ± and box-drawing ┌─┐│└┘░▒▓. It is transcoded to the printer's code page (CP437 by default), and typographic quotes, dashes and the ellipsis print as ASCII look-alikes where the code page lacks them.
  • Word wrap: text wraps at word boundaries for the paper width and character size, so words are never cut in half.
  • Rich elements: bold, underline, inverse, sizes 1–8, two fonts, alignment, QR codes, EAN/UPC/CODE39/CODE128 barcodes, images, raw ESC/POS.
  • Boxes, rules and key-value rows: single or double CP437 borders with titles, dividers and footers, sized to the paper when the job prints.
  • Preview: see the exact lines a job prints, without using paper.
  • Images that print well: PNG, JPEG, GIF or WebP from a URL or base64, scaled to the paper and dithered. Image URLs can't reach internal network addresses unless you allow it.
  • Health endpoint with live printer status: paper low or out, cover open, errors.

Note

Pre-refactor code: no AI was used. The original Überbringer (v0.1.x), up to commit bb73348 from January 2025, was written without any AI. That commit shows the code as it was before the 0.2 refactor.

Contents

Quick start

Debian/Ubuntu server with Caddy and TLS

sudo ./install.sh printer.example.com you@example.com 192.168.1.245
  • Sets up a fresh Debian or Ubuntu host: the latest release, a systemd service, and Caddy for HTTPS with an automatic certificate. It does not upgrade a host set up by the 0.1 script.
  • Arguments: the server's domain, whose DNS must point at the server, with ports 80 and 443 free and reachable; the email address for the certificate account; and the printer's IP address or host name, without a port.
  • A given release, v0.2.0 or later: sudo UBERBRINGER_VERSION=v0.2.0 ./install.sh <domain> <acme-email> <printer-address>.
  • The config is /etc/uberbringer/config.toml. The first API token is in /etc/uberbringer/initial-token: copy it to your client, then delete the file. Issue more with uberbringer token --config /etc/uberbringer/config.toml --subject <client>.
  • Re-running the script upgrades the install and keeps the config. After editing the config, run systemctl restart uberbringer; after changing webserver.body_limit, bind_ip or port, re-run the script instead.
  • Change the systemd unit with systemctl edit uberbringer.
  • The install log is /var/log/uberbringer-install.log.

Docker

docker build -t uberbringer .
docker run -d -p 127.0.0.1:8080:8080 -v "$PWD/config.toml:/etc/uberbringer/config.toml:ro" uberbringer

The image is a microservice for running behind your own reverse proxy. It contains no proxy and no TLS: it serves plain HTTP on port 8080, and the proxy terminates HTTPS. The examples publish the port on the host's loopback address only, for a proxy on the host; a proxy in another container reaches it over a shared Docker network instead, with no -p at all. In the mounted config.toml:

  • Set bind_ip = "0.0.0.0" in [webserver].
  • Set trusted_proxies to the address the proxy's requests come from: its container network (e.g. ["172.18.0.0/16"]), or for a proxy on the host, the Docker bridge's gateway (usually 172.17.0.1). Have the proxy set X-Real-IP to the client's address. Otherwise every request appears to come from the proxy, and all clients share one rate limit.
  • Let the proxy pass request bodies up to webserver.body_limit (4 MiB by default).

The settings can come from environment variables instead (see Configuration). To run without a config file, set UBERBRINGER_CONFIG empty and put the variables in an env file that only you can read (chmod 600 uberbringer.env), so the secret stays off the command line:

UBERBRINGER_CONFIG=
UBERBRINGER_WEBSERVER_BIND_IP=0.0.0.0
UBERBRINGER_WEBSERVER_TRUSTED_PROXIES=172.18.0.0/16
UBERBRINGER_API_SECRET=<the output of uberbringer secret>
UBERBRINGER_PRINTER_ADDRESS=192.168.1.245
docker run -d -p 127.0.0.1:8080:8080 --env-file uberbringer.env uberbringer

Publish port 8080 only to the proxy, never directly to the internet. For container health checks, use GET / to see whether the daemon is up. /healthz answers 503 while the printer is unreachable, so it suits alerting better than restarting the container.

From source

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

API

All /api/v1 routes need an Authorization: Bearer <token> header. Issue tokens with uberbringer token. Tokens created by the old install script keep working as long as the secret is unchanged. Tokens in query strings are not accepted, because they leak into proxy logs.

Responses from /healthz and every /api/v1 route, error responses included, carry Cache-Control: no-store.

Method Path Purpose
POST /api/v1/print Queue a print job
POST /api/v1/preview Show the lines a job prints, without printing it
GET /api/v1/jobs/:id Job status
GET /healthz Printer and queue health (no auth)
GET / Version information (no auth)

Print a receipt

curl -X POST https://printer.example.com/api/v1/print \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "elements": [
      {"type": "rule", "style": "dark"},
      {"type": "box", "fit": true, "padding": 3, "text": "!!! ACHTUNG !!!"},
      {"type": "text", "text": "Überbringer", "size": 2, "bold": true, "align": "center"},
      {"type": "feed"},
      {"type": "text", "text": "Long paragraphs wrap at word boundaries for the paper width, so a word is never split across two lines."},
      {"type": "text", "text": "Total: ", "newline": false},
      {"type": "text", "text": "£12.50", "bold": true},
      {"type": "qr", "data": "https://example.com", "align": "center"},
      {"type": "feed", "lines": 3}
    ]
  }'

The response is 202 Accepted with a Location header:

{"id": "job_01kbx4n6m3ex8tq0wq3r5vrzq1", "status": "queued", "created_at": "2026-11-29T21:04:05Z"}

Job IDs are TypeIDs: UUIDv7 values with a job_ prefix, so they sort by creation time.

Job status

curl -H "Authorization: Bearer $TOKEN" https://printer.example.com/api/v1/jobs/job_01kbx4n6m3ex8tq0wq3r5vrzq1
{
  "id": "job_01kbx4n6m3ex8tq0wq3r5vrzq1",
  "status": "done",
  "attempts": 1,
  "created_at": "2026-11-29T21:04:05Z",
  "started_at": "2026-11-29T21:04:05Z",
  "finished_at": "2026-11-29T21:04:06Z"
}

status is queued, printing, done or failed. A failed job includes an error field. The last queue.history finished jobs are kept.

Preview a receipt

POST /api/v1/preview takes the same body as /api/v1/print and validates it the same way, but prints nothing and fetches no images. It answers 200 with the lines the printer would print, as text/plain; charset=utf-8:

curl -X POST https://printer.example.com/api/v1/preview \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"elements": [{"type": "box", "fit": true, "padding": 3, "text": "!!! ACHTUNG !!!"},
                    {"type": "qr", "data": "https://example.com"}]}'
         ┌─────────────────────┐
         │   !!! ACHTUNG !!!   │
         └─────────────────────┘
[qr: https://example.com]
 - - - - - - - partial cut - - - - - - - -
  • The preview is read back from the bytes the job renders to, so it shows what the printer receives: wrapping, folded characters, ? for missing ones and the final cut.
  • Centred and right-aligned text is indented as the printer places it, counted in Font A columns. Text at a larger size shows each character once.
  • QR codes, barcodes, images, raw bytes and cuts print as placeholders such as [barcode ean13: 4006381333931], [image 384 dots: logo.png] and [raw 3 bytes].

With Accept: application/json the answer carries the styles too. For [{"type": "kv", "pairs": [{"key": "Total", "value": "£12.50", "bold": true}]}, {"type": "text", "text": "Thanks 🎉", "align": "center"}, {"type": "qr", "data": "https://example.com"}]:

{"columns": 42, "codepage": "cp437", "line_count": 3,
 "lines": [{"kind": "text", "text": "Total ............................. £12.50",
            "runs": [{"from": 0, "to": 5, "bold": true}, {"from": 36, "to": 42, "bold": true}]},
           {"kind": "text", "text": "                 Thanks ?"},
           {"kind": "qr", "text": "[qr: https://example.com]", "data": "https://example.com"},
           {"kind": "cut", "text": " - - - - - - - partial cut - - - - - - - -", "data": "partial"}],
 "warnings": ["elements[1]: 1 character not in cp437 printed as ?"]}
Field Meaning
columns Font A characters per line
codepage The code page text is printed in
line_count Lines the receipt prints, all copies counted: text lines, fed lines, and one for each QR code, barcode and image. format.max_lines limits it
lines[].kind text, qr, barcode, image, raw or cut
lines[].text The line as it prints, or the placeholder
lines[].runs Styled parts of text, in characters from from up to to: bold, underline (1 or 2), invert, font (b), and width and height when scaled. Plain Font A text at size 1 has no run
lines[].data QR code or barcode data, the image URL (or base64), the number of raw bytes, or the cut mode
warnings Elements with characters the code page lacks, and images wider than the paper

A job that would print more than format.max_lines lines answers 422 too_many_lines, for example receipt would print 2412 lines, limit is 2000. Sent to /api/v1/print, the same job is accepted and then fails when the worker renders it, before anything is sent; its error reads rendering: receipt would print 2412 lines, limit is 2000.

Health

GET /healthz returns 200 when the printer is reachable and ready, and 503 when it is unreachable or not ready (paper out, cover open, error).

{"status": "ok", "printer": {"reachable": true, "status": "ready", "online": true, "cover_open": false, "paper": "near_end"}, "queue": {"pending": 0}}

A printer that accepts connections but does not answer status requests is reported as "status": "unknown" with HTTP 200.

Details:

  • Brief problems are re-checked. A printer that looks not ready is read again 750 ms later, and only a problem that is still there gives 503. While cutting or feeding, a printer can report a problem for a moment.
  • Timeouts. The printer accepts one connection at a time. While it is still taking in a large job, the 3-second health check can run out of time. That gives 503 with printer status "timeout", because the printer's state is unknown.
  • The cover flag is only reported while the printer is offline. Epson printers always go offline when the cover opens.
  • Paper low on the TM-T88VII. That model does not report paper near-end through real-time status, so "near_end" never appears for it; paper out is still reported.

Errors

Errors are JSON:

{"error": "invalid job", "code": "invalid_job", "details": ["elements[2] (text): size, width and height must be 1-8"]}
  • code is stable and meant for clients to match on.
  • error is for people and may change. It never repeats the HTTP framework's own text; for example, an unknown route answers not found.
  • details appears only when an invalid_job fails validation. Each entry names the element by its path, e.g. elements[0].children[3] (qr): not allowed inside a box; place it after the box.
Status code Meaning
400 invalid_job Malformed JSON, an unknown field, trailing data after the job, or invalid elements. When elements are invalid, details lists every problem. A {"data": [...]} body gets a message pointing to the new format
400 bad_request A malformed HTTP request, refused by the server itself
401 unauthorized missing bearer token, or invalid or expired token. Sent with WWW-Authenticate
404 not_found Unknown route
404 job_not_found Unknown, expired or malformed job ID
405 method_not_allowed Known route, wrong method, e.g. DELETE /api/v1/print with a valid token (without one, /api/v1 answers 401 first). Sent with Allow
408 request_timeout The request was not received in time
413 body_too_large Body larger than webserver.body_limit
422 too_many_lines From /api/v1/preview: the job would print more than format.max_lines lines
429 rate_limited Rate limit exceeded. Retry-After gives the seconds to wait
431 headers_too_large Request headers too large
500 internal_error Unexpected failure. The cause is logged and reported to Sentry, never sent to the client
501 not_implemented A request body with an unsupported transfer coding. An unknown HTTP method (e.g. FOO /healthz) is refused by the HTTP server itself with a plain-text 501
503 queue_full The print queue is full. Sent with Retry-After: 10
503 shutting_down The server is shutting down

Any other status that the HTTP layer produces itself gets the code http_<status>, e.g. http_502. /healthz answers 503 with its own body, shown under Health, not with this shape.

Validation happens before a job is queued. Images are fetched by the worker, so a blocked or broken image URL shows up as a failed job. Nothing is sent to the printer unless the whole receipt rendered.

Elements

A job is {"elements": [...], "copies": 1}. copies is 1–5, and each copy is cut separately. A partial cut is added after the last element unless that element is already a cut. Boxes, rules and key-value rows are described under Blocks.

text

Field Default Values
text "" UTF-8 text. \n starts a new line
size 1 1–8, sets width and height
width, height size 1–8 each, for stretched text
bold false
underline 0 0, 1 (thin) or 2 (thick)
invert false white on black
font a a, or b (smaller: 56 instead of 42 columns on a TM-T88)
align left left, center, right
newline true false keeps the next element on the same line
wrap true false sends the text as-is and lets the printer wrap

Encoding. Text is transcoded from UTF-8 to printer.codepage, CP437 by default. Control characters are removed so text can never be read as printer commands. Before that, the text is prepared for the code page:

  • It is composed (Unicode NFC), so a decomposed é (an e and a combining accent) prints as é.
  • Characters the code page lacks fold to look-alikes: “ ” „ print as ", ‘ ’ as ', – as -, — as --, … as ..., • as ·, → as ->, ← as <-, ✓ ✔ as √ (or x without √), × as x, € as EUR and ™ as TM. Where the code page has the character, as cp1252 has curly quotes and cp858 has €, it prints as itself.
  • An emoji prints as one ?, together with its skin tone, its variation selector and any emoji joined to it, so 👨‍👩‍👧 is one ?. Zero-width spaces and joiners are removed.
  • Any other character the code page lacks prints as ?. The preview lists the elements that have one.

Word wrap. The line width comes from the printer model and the character size: on a TM-T88, 42 characters at size 1, 21 at size 2, and so on. Lines break at spaces, and only a word longer than a whole line (a long URL, say) is split. The renderer tracks the position across "newline": false elements, so mixed sizes on one line still wrap correctly.

feed

Field Default Values
lines 1 1–255

qr

Field Default Values
data Required. Encoded as UTF-8, up to 7089 bytes
size 6 Module size in dots, 1–16
correction M L, M, Q, H
align left

barcode

Field Default Values
symbology Required. ean13, ean8, upca, upce, code39, code128
data Required. Digits for EAN/UPC, where a supplied check digit is verified. A–Z 0–9 -.$/+% and space for CODE39. Printable ASCII for CODE128
height 80 Bar height in dots, 1–255
width 3 Module width, 2–6
hri below Human-readable text: none, above, below, both
align left

image

Field Default Values
url http/https URL, or use base64
base64 Image data, or a data:image/png;base64,... URI
width natural Target width in dots, up to the model's print width (512 on a TM-T88)
align left

PNG, JPEG, GIF and WebP are supported. Images wider than the paper are scaled down to fit, and every image is dithered to black and white. URL fetches have a timeout, a size cap and a pixel cap. URLs that resolve to loopback, private or link-local addresses (including cloud metadata endpoints) are refused unless images.allow_private_networks is true or the host is in images.allowed_hosts.

raw

Field Values
hex ESC/POS bytes as hex, spaces allowed, e.g. "1B 61 01"

cut

Field Default Values
mode partial partial, full

Blocks

box, rule and kv are blocks: they are laid out when the job prints, from the printer model, so one job fits the TM-T88's 42 columns as well as the TM-T20's 48. A block starts on a new line, and what follows it starts at the left margin. These fields work on all three:

Field Default Values
size 1 1–3. Scales the borders and the text together: 42, 21 or 14 columns on a TM-T88
font a a, or b (56 columns at size 1 on a TM-T88)
columns the line 1–255. A fixed width in characters of the block's own size and font. It is cut to the line, and a narrower block is centred

Borders and fills are never bold, underlined or inverted. On the blocks, a field that does not apply is an error, e.g. elements[3] (rule): field "pairs" does not apply to rule. A long title, footer or label is cut with ... instead of failing.

box

{"type": "box", "style": "double", "title": "ACHTUNG", "title_style": "capped", "align": "center",
 "text": "The coffee machine is being descaled.\nDo not use until 10:30."}
╔═╡ ACHTUNG ╞════════════════════════════╗
║ The coffee machine is being descaled.  ║
║        Do not use until 10:30.         ║
╚════════════════════════════════════════╝
{"type": "box", "fit": true, "padding": 3, "text": "!!! ACHTUNG !!!"}
         ┌─────────────────────┐
         │   !!! ACHTUNG !!!   │
         └─────────────────────┘
Field Default Values
text The body. It wraps at word boundaries, and \n starts a new paragraph. Set text or children, not both
children The body as elements; see below
style single single ┌─┐, double ╔═╗, double-h ╒═╕ (double lines across, single down), double-v ╓─╖ (single across, double down), ascii +-+
title Text set into the top border
title_style inline inline ┌─ Title ───┐, or capped ╔═╡ Title ╞══╗
footer Text set into the bottom border, on the right: └──── footer ──┘
align left Alignment of text, and the default for text children
bold, underline, invert Styles of text, as on a text element
padding 1 0–3 spaces between the side borders and the body
fit false true shrinks the box to its widest line, title and footer included, and centres it. columns is then the most it may take

Children. A box takes one level of these, and each prints inside the borders:

Type Fields Inside a box
text text, bold, underline, invert, align, wrap size and font come from the box. "newline": false is not allowed. "wrap": false splits lines at the box edge instead of at spaces
feed lines Empty lines between the borders
rule style (single or double), text, align, bold A divider joined to the side borders: ├──┤, ╞══╡, ╟──╢ or ╠══╣ to suit the box. A label reads ├── Label ───┤
kv pairs, leader Key-value rows across the inside of the box

box, qr, barcode, image, raw and cut cannot go inside a box; place them after it. Children count toward the 500-element limit.

rule

Field Default Values
style single single ─, double ═, light ░, medium ▒, dark ▓, solid █, dashed - -, dotted ·, ascii -
text A label set into the line
align center Where the label sits: ───── TODAY ─────, or ── Notes ────── at the left
bold false Prints the label bold

kv

{"type": "kv", "pairs": [{"key": "Host", "value": "nas01"},
                         {"key": "Note", "value": "The scrub finished with 0 errors. Next scrub Sunday 03:00."},
                         {"key": "Used", "value": "94%", "bold": true}]}
Host ............................... nas01
Note ... The scrub finished with 0 errors.
                  Next scrub Sunday 03:00.
Used ................................. 94%
Field Default Values
pairs Required. 1–100 rows of {"key": "...", "value": "...", "bold": false}. key is required; bold prints the key and the value bold
leader . The fill between key and value: ., ·, " " (or "space"), _, - or ─

A value too long for its line wraps into the room after the key, and its further lines are right-aligned. A key too long for the line is cut with ....

Glyphs and code pages

CP437, the default, has every glyph the blocks draw with. Other code pages fall back, and the preview shows the result:

Code page Boxes Rules
cp437 All styles as listed All styles
cp850, cp858 double-h and double-v print as double. A divider whose junction the page lacks switches to the other line weight, so ╞══╡ prints as ├──┤ and ╟──╢ as ╠══╣. A capped title on double lines uses ╣ ╠ All styles
cp1252 Every box is ascii, drawn with +, - and |, with = for double dividers ─ ═ print as - =, shades as #

For your own text on CP437:

  • Prints: box drawing ┌─┐│└┘├┤┬┴┼ ╔═╗║╚╝╠╣╦╩╬ ╒╓╕╖╘╙╛╜╞╟╡╢╤╥╧╨╪╫, shades and blocks ░▒▓█▀▄▌▐■, and · ∙ √ ° ± » « £ ¥ ½ ¼ and accented Latin letters.
  • Never prints as itself: • and emoji, and ► ◄ → ← and the other symbols CP437 keeps at byte values below 0x20, which the printer reads as commands. • folds to · and → ← to -> <-; the rest print as ?. Use · ∙ ■ » √ ° instead.

examples/blocks.json prints every style, padding, size and junction on one receipt, for checking the borders on paper. Send it as the body of /api/v1/print, or look at it first with uberbringer preview examples/blocks.json.

Migrating from the old format

The endpoint is still POST /api/v1/print, but the body changed from {"data": [...]} to {"elements": [...]}. The response changed from the text OK - <id> to the JSON shown above. Old-format bodies get a 400 that points here.

Old type Old meaning New element
1 Text {"type": "text", "text": "...", "size": n, "newline": false}
2 Bold text {"type": "text", "text": "...", "bold": true, "newline": false}
3 QR code {"type": "qr", "data": "...", "size": n, "correction": "H"}
4 Line feed {"type": "feed"}
5 n line feeds {"type": "feed", "lines": n}
6 Raw hex {"type": "raw", "hex": "..."}, or plain UTF-8 text for CP437 art
7 Image URL {"type": "image", "url": "..."}

Old text items did not end the line, hence "newline": false. You can usually drop it now and let each text element be a line. Hex-encoded CP437 box drawing can become plain text: B3 20 21 21 21 is "│ !!!".

These changes also affect 0.1 clients and configs. CHANGELOG.md lists every change.

  • Tokens are read only from the Authorization header. A ?token= query string gets 401.
  • Errors have the JSON shape above instead of {"message": "..."} or plain text.
  • printer.model defaults to tm-t88 (512 dots). On a TM-T20, set model = "tm-t20" to use the full 576-dot width.
  • A 0.1 config needs a [printer] section with address before 0.2 starts, because printer.address is now required. The 0.1 install script did not write one.
  • install.sh sets up a fresh host. It does not upgrade a server set up by the 0.1 install script.

Configuration

Copy configs/config.example.toml to config.toml. Only api.secret (at least 32 bytes) and printer.address are required; every other setting has a default, which the example shows. Configs from 0.1 still load, because their keys are unchanged, but printer.address is now required. Unknown keys are reported as errors, so a typo can't silently fall back to a default, and so are two keys that differ only in case. A duration is a string such as "5s"; a bare number is refused.

Every key can also be set by an environment variable named UBERBRINGER_<SECTION>_<KEY>, such as UBERBRINGER_PRINTER_ADDRESS for printer.address, and a variable wins over the file:

  • Values are written without quotes: decimal digits for a number, true or false for a flag, 5s for a duration. Lists take comma-separated values, e.g. UBERBRINGER_WEBSERVER_TRUSTED_PROXIES=127.0.0.1,::1; an empty item, from a doubled or trailing comma, is an error. In the file, a number, flag or list may also be written as such a string.
  • An empty variable counts as unset, and one that holds only spaces is an error. Variables that name no key are ignored, but when the configuration fails to load, the error names them, since they are likely misspelt.
  • --config names the file, and defaults to config.toml or to UBERBRINGER_CONFIG when that is set. --config "", or an empty UBERBRINGER_CONFIG, reads no file, so the settings come from the environment and the defaults alone.

Settings worth knowing:

  • printer.model sets the print width and characters per line:

    Model Printers Width Font A / B columns
    tm-t88 (default) TM-T88IV, V, VI, VII 512 dots (180 dpi) 42 / 56
    tm-m50 TM-m50, TM-m50II 512 dots (180 dpi) 42 / 56
    tm-t20 TM-T20, II, III 576 dots (203 dpi) 48 / 64
    generic-80mm other 80 mm, 203 dpi 576 dots 48 / 64
    generic-58mm 58 mm paper, 203 dpi 384 dots 32 / 42

    For 58 mm paper on a 180-dpi printer (TM-T88VII, TM-m50II), use a tm-t88 or tm-m50 model with paper_width = 360 (30 Font A columns).

    If words break at the right edge (for example seve on one line and ral on the next), the model is wider than the printer. paper_width (dots) and columns (Font A characters per line) override the model.

  • printer.codepage: cp437 (default), cp850, cp858 (has €) or cp1252.

  • printer.box_line_spacing (default 0): the line spacing, in motion units (ESC 3, 0–255), used while a box prints. Lines of box drawing leave small gaps in the vertical borders at the printer's default spacing; a value checked on paper closes them. 0 keeps the default, which was checked on a TM-T88IV with examples/blocks.json and looks fine.

  • format.max_lines (default 2000): a job that would print more lines, all copies counted, fails instead of printing. It is a backstop against runaway text; /api/v1/preview answers such a job with 422.

  • webserver.trusted_proxies / proxy_header: the real client IP for per-client rate limits comes from the X-Real-IP header set by the reverse proxy (Caddy, as install.sh configures it) on 127.0.0.1.

  • sentry.dsn: error reporting. When neither the file nor UBERBRINGER_SENTRY_DSN sets it, it falls back to the SENTRY_DSN environment variable, then to a DSN built into release binaries (from the SENTRY_DSN CI secret). Request bodies and the Authorization header are never sent to Sentry.

  • log.level (debug, info, warn, error) and log.format (text or json) control what is logged:

    • Each request is logged once, as request: at INFO, or at WARN when the status is 5xx. Only the path is logged, never the query string, the body or the token.
    • An unexpected failure adds one ERROR request failed line, with err and request_id, and one Sentry event.
    • A recovered panic adds one ERROR panic line, with panic and stack, and one Sentry event.
    • A print job that fails after its retries is logged as ERROR job failed with its job_id, and is reported to Sentry.
    • Refusals are never logged at ERROR and never go to Sentry. Refusals are 4xx answers, the queue_full and shutting_down 503s, and 503s from /healthz.

Command line

uberbringer [--config config.toml]           run the daemon (default command)
uberbringer secret                           print a new random API secret
uberbringer token [--subject s] [--ttl 720h] print a signed bearer token
uberbringer preview [file.json|-]            show the lines a job would print
uberbringer config get <key>                 print one setting, e.g. webserver.port
uberbringer version                          print the version

config get prints a setting as the daemon would use it, from the file, UBERBRINGER_* variables and the defaults, and fails when the configuration does not load. Durations print as 15s, lists comma-separated. It never prints api.secret.

Every command that reads the config takes --config (-c); see Configuration for its default and for running without a file.

preview reads a job from the file, or from standard input with - or no argument, and lays it out for the printer in the config, as /api/v1/preview does. It prints nothing and fetches no images. On a terminal it shows bold, underlined and inverted text as such; warnings go to standard error. It reads the same config as the daemon, so api.secret and printer.address must be set even though neither is used.

The daemon shuts down gracefully on SIGINT/SIGTERM. A receipt that is already printing is finished, and jobs still waiting are marked failed.

Development

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 check      # the CI gate, below
make build      # bin/uberbringer
make fmt        # gofmt + goimports
make vuln       # govulncheck
make snapshot   # release archives in dist/; publishes nothing

make check runs the same steps as .gitea/workflows/test.yml, in the same order:

  1. fmt-check: gofmt and goimports.
  2. tidy-check: go mod tidy -diff.
  3. go vet.
  4. staticcheck.
  5. go test -race -timeout 5m.
  6. release-check: goreleaser check, which validates the release config without building.

It needs goreleaser installed. govulncheck is not part of it; run make vuln. make snapshot builds the release archives locally; run it 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. The module path is uberbringer, so packages import as uberbringer/internal/.... Build from a clone of the repository.

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/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
docs/                       Design notes and feature plans

docs/design.md explains why the daemon is shaped as it is. CHANGELOG.md lists the changes in each release.

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 lints, tests and validates the release config, but builds no binaries, and it does not run on pull requests or tags. Binaries are built only by release.yml.
  • 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, README.md, configs/config.example.toml and packaging/uberbringer.service.
    • The release notes link to CHANGELOG.md at the tag.

License

Copyright © 2025-2026 William Gill.

Licensed under the European Union Public Licence v. 1.2 (EUPL-1.2). The full text is in LICENSE.txt, and translations into every official EU language are equally valid. Releases up to and including 0.1.2 were published under the GNU Affero General Public License v3.0.