Files
uberbringer/docs/docker.md
T
57_WolveandClaude Opus 5.5 4eb620dde0 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>
2026-12-01 16:39:48 -06:00

2.8 KiB

Running in Docker

The image built from the root Dockerfile 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.

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 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. Publish port 8080 only to the proxy, never directly to the internet.

The config

In the mounted config.toml (configuration.md):

  • 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. 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

Health checks

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.

ntfy subscriptions

ntfy subscriptions keep their state in /var/lib/uberbringer, which the image sets as state.dir. The daemon does not start if it cannot write there. Mount a volume there: without one the state lives in the container, and a new container, after a pull or an upgrade, forgets what was printed and what was held.

docker run -d -p 127.0.0.1:8080:8080 -v "$PWD/config.toml:/etc/uberbringer/config.toml:ro" \
  -v uberbringer-state:/var/lib/uberbringer uberbringer

Subscriptions are set in config.toml only, so a container with one needs the file. The image runs as user and group 10001, so give a token file to that ID, mode 600, and mount it read-only next to the config:

sudo chown 10001:10001 ntfy.token && sudo chmod 600 ntfy.token
docker run ... -v "$PWD/ntfy.token:/etc/uberbringer/ntfy.token:ro" uberbringer