Self-hosted and Compose
You can run the uShelf image on any platform, such as Docker Compose, Kubernetes, or a PaaS, and still use the CLI and MCP bridge against it.
Run the image
Section titled “Run the image”The image is ghcr.io/karamouche/ushelf:<version>. Give it:
- A persistent volume mounted at
/data. USHELF_HOST=0.0.0.0so it listens inside the container, and optionallyUSHELF_PORT(default43110).USHELF_API_TOKEN, a random string of at least 32 characters, for example fromopenssl rand -base64 32.USHELF_APP_PASSWORD, at least 12 characters. Without it, the server refuses to start unless you also setUSHELF_PUBLISHED_HOST=127.0.0.1to declare that the port is published only on loopback, and it then answers only the host nameslocalhost,127.0.0.1, and[::1](other requests get421unless they carry the API token), so a proxy cannot use the reader.- HTTPS in front of it, preserving the original
Hostheader.
The container runs as an unprivileged user. If it starts as root, for example on a platform with root-owned volumes, it takes ownership of /data and drops privileges before starting the server. See Configuration for every variable.
Register it with the CLI
Section titled “Register it with the CLI”ushelf context add homelab --url https://ushelf.example.comThe CLI prompts for the token without echo (or reads USHELF_API_TOKEN), verifies it against the server, and makes the context current. Agent setup, Kindle, status, and doctor then work as usual. Lifecycle commands such as start, stop, and logs are left to the platform that runs it.
Docker Compose from a repository clone
Section titled “Docker Compose from a repository clone”The repository’s compose.yaml builds the image and stores the library on the host under ~/.ushelf.
cp .env.example .envprintf 'USHELF_UID=%s\nUSHELF_GID=%s\n' "$(id -u)" "$(id -g)" >> .envprintf 'USHELF_API_TOKEN=%s\n' "$(openssl rand -base64 32)" >> .envmkdir -p "$HOME/.ushelf/library/items" "$HOME/.ushelf/library/history" \ "$HOME/.ushelf/recipes" "$HOME/.ushelf/state" "$HOME/.ushelf/secrets"chmod 700 "$HOME/.ushelf/secrets"test -f "$HOME/.ushelf/recipes/default.md" || \ cp recipes/default.md "$HOME/.ushelf/recipes/default.md"docker compose up -d --buildushelf context add compose --url http://127.0.0.1:43110Compose publishes the port on 127.0.0.1 unless .env sets USHELF_HOST. If you publish it on 0.0.0.0 or a LAN address, also set USHELF_APP_PASSWORD in .env; without it, the server refuses to start.
To use another location, set an absolute USHELF_ROOT in .env and create the same directories there. USHELF_UID and USHELF_GID let the container access your files.
Common operations:
docker compose logs -f ushelfdocker compose restart ushelfdocker compose down
git pulldocker compose up -d --buildTo rebuild the index against the same bind mounts:
docker compose stop ushelfdocker compose run --rm --no-deps maintenance rebuild-indexdocker compose up -dSubpath deployments
Section titled “Subpath deployments”To serve uShelf under a path such as /reader/, set USHELF_WEB_BASE_PATH=/reader/ and include the path in the context URL. uShelf normalizes the trailing slash, and your reverse proxy must preserve the prefix.