Skip to content

feat(docker): support starting Silo without root through the silo entrypoint - #3338

Merged
Quick104 merged 3 commits into
mainfrom
feat/docker-nonroot-silo-entrypoint
Nov 1, 2026
Merged

Quick104 merged 3 commits into
mainfrom
feat/docker-nonroot-silo-entrypoint

Conversation

@Quick104

@Quick104 Quick104 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none. #1177 C1–C3 ran nodes on this image, which already refused a node without NODE_URL. The Jellyfin Web installer change is on the path of #1246 C1, which has not been run.

Since Silo ships as one image, a deployment that runs PostgreSQL in its own container can no longer run Silo's container as an unprivileged user. The image starts s6-overlay's /init, whose first steps remap the silo account and re-own directories, so docker run --user 1000:1000 --cap-drop ALL --security-opt no-new-privileges … stops with usermod: cannot lock /etc/passwd. A user running the separate-container layout reported this as a security downgrade from the old base image and suggested the fix this change takes: keep Silo's own behavior out of the init scripts and document starting silo as the entrypoint.

Two things stood in the way. A proxy or transcode node without NODE_URL was refused only by init-config; Silo itself guessed a URL from its listen port, which gives two nodes on one port the same identity. And the Jellyfin Web installer let npm cache under HOME, which is / for a uid with no passwd entry, so an install failed with EACCES.

Approach

  • Silo refuses MODE=proxy or MODE=transcode without NODE_URL in config.LoadBootstrap, next to the existing SECRET_KEY check. The listen-port fallback and the duplicate check in init-config are removed.
  • The Jellyfin Web installer points npm's cache at its per-install workspace, which it already creates and deletes.
  • init-envfile, the first init script, stops a non-root start with a message that says to start silo directly with an external DATABASE_URL.
  • docs/architecture/omnibus-image.md gains "Starting without root": the rule that init scripts only do container work (accounts, /config, ownership, bundled services) while anything Silo needs lives in the binary, and what a silo-entrypoint start gives up (bundled services, PUID, ownership changes, GPU group discovery, FILE__ secrets, supervision). docs/admin-api.md and a comment in docker-compose.advanced.yml follow.

An entrypoint wrapper that detected a non-root uid and ran Silo itself was tried first. It worked but put about 60 lines of shell, partly copying init-config, into the image, and it did nothing for images built around the binary.

Validation

  • Go: make embed-stub, go build ./..., gofmt, go vet ./..., make lint-changed, make lint-router-recovery pass. make test-go passes except internal/api/handlers and internal/ebookconvert, whose temp-directory permission checks reject the test host's umask 002; both packages pass when rerun with umask 022. Web code is unchanged; the web gate was not run.
  • Shell: make verify-shellcheck (ShellCheck 0.11.0) passes; make verify-local-paths passes.
  • Images built from this branch on a local Docker host:
    • --user 1000:1000, with and without --cap-drop ALL, no-new-privileges, and a /run tmpfs: prints the new message and exits 1.
    • --entrypoint silo, uid 1000, --cap-drop ALL, no-new-privileges, external PostgreSQL, /config mount containing silo: healthy in about 10 s. With an empty /config mount Silo does not start, because /var/lib/silo links to the missing /config/silo; the doc says to create it.
    • silo compat-web install in that container as uid 1000 with HOME=/: Jellyfin Web 12.1 installed. The same command on the published latest fails with npm error code EACCES.
    • MODE=transcode without NODE_URL: refused at startup with --entrypoint silo; under /init Silo exits and s6 restarts it every 5 s with the same message.
    • Default root start with the bundled PostgreSQL: healthy.
  • Not tested: GPU passthrough, Kubernetes, Unraid, or LXC with a non-root start.

Evidence

Operators see three changes at startup and install. Each was run against images built from this branch's first commit; the published latest (built from main at 84cab92f3) was the before.

  • Starting the image with --user 1000:1000 and no entrypoint override. Before: usermod: cannot lock /etc/passwd; try again later. and s6-rc: warning: unable to start service init-adduser: command exited 1. After: Started as uid 1000, but this image's init needs root. To run without root, start silo directly (--entrypoint silo, or entrypoint: ["silo"] in Compose) with DATABASE_URL set to an external PostgreSQL.
  • MODE=transcode without NODE_URL. Before, from source: Silo started and logged NODE_URL not set, using listen address. After: startup stops with bootstrap: MODE=transcode needs NODE_URL, ...; the wording after the comma changed in a later commit to this node's own URL, which matches it to its entry on the main server.
  • silo compat-web install as uid 1000 with HOME=/ (entrypoint silo). Before: npm error code EACCES / npm error syscall mkdir. After: Jellyfin Web 12.1 installs.

Risks

  • A proxy or transcode node started without NODE_URL outside this image, for example from the binary, now refuses to start instead of warning. Inside the image such a node already refused; it now restarts every 5 s with the error, as a bad SECRET_KEY does, instead of stopping the container.
  • The Jellyfin Web installer no longer reuses npm's cache in HOME between installs, so each install downloads its packages again.
  • The user manual needs a section on starting without root; an issue for Silo-Server/siloserver.org is drafted.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code, running in T3 Code
  • Tool(s): Claude Code, GitHub CLI; OpenAI Codex CLI for one review
  • Model(s): claude-opus-5-5 (implementation); claude-fable-5-1 and gpt-6-astra (reviews)
  • Involvement: Fully AI-generated at the maintainer's direction; human verification pending
  • Adversarial review: claude-fable-5-1 (high effort, Claude Code subagent) and gpt-6-astra (Codex) independently reviewed the container image, its init scripts and Compose files, and the earlier wrapper version of this change. Both found the non-root path crossed no privilege boundary. Their other image-hardening findings are outside this pull request. The final version, which drops the wrapper, was not separately reviewed.

🤖 Generated with Claude Code

Note

Support running Silo container without root via silo entrypoint

  • config.LoadBootstrap now returns an error when proxy or transcode mode starts without NODE_URL, replacing the check in the init-config shell script (bootstrap.go, covered by new table-driven tests)
  • cmd/silo/main.go removes the localhost URL fallback and warning; startup relies on NODE_URL as required
  • init-envfile exits with a diagnostic when run as a non-root uid, before its existing setup
  • New docs section in omnibus-image.md explains starting Silo directly as a non-root user: storage paths, bundled services, env-file loading, GPU group discovery, HOME, and NET_ADMIN effects
  • Jellyfin web install now sets npm_config_cache to a cache dir inside the temporary install workspace (web_component.go)
  • Risk: proxy or transcode deployments that relied on the guessed localhost URL from the listen port will now fail to start without an explicit NODE_URL

Macroscope summarized a5d2fbe.

…rypoint

The image's s6 init needs root, so a container started with user: stopped
at usermod. Keep Silo's own checks in the binary so the image can be run
with entrypoint ["silo"] as an unprivileged uid:

- Silo refuses MODE=proxy or transcode without NODE_URL instead of
  guessing one from its listen port; init-config no longer checks it.
- The Jellyfin Web installer keeps npm's cache in its install workspace,
  since HOME is / for a uid with no passwd entry.
- init-envfile stops a non-root start with a pointer to the silo
  entrypoint.
- docs/architecture/omnibus-image.md describes starting without root and
  the rule that init scripts only do container work.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 1, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T02:53:29.175429Z a5d2fbe New commits
🔒 Security Review ✅ Completed 2026-11-01T02:54:20.258869Z a5d2fbe New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42c9b477-0fb3-48ef-8725-6e4c71e4a280
Commits

Reviewing files that changed from the base of the PR and between 8bae8fa and a5d2fbe.

Files selected for processing: 3
  • docker-compose.advanced.yml
  • docs/architecture/omnibus-image.md
  • internal/config/bootstrap.go
Files skipped from review as they are similar to previous changes: 2
  • docker-compose.advanced.yml
  • internal/config/bootstrap.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The PR moves the NODE_URL requirement for proxy and transcode modes into Silo, adds a direct non-root startup path for the omnibus image, and sets a workspace-local npm cache for web component installation.

Changes: Proxy and transcode node URL contract

Layer / File(s) Summary
Bootstrap node URL validation
internal/config/bootstrap.go, internal/config/bootstrap_test.go
LoadBootstrap rejects proxy and transcode modes when NODE_URL is empty. Tests cover these modes and modes that do not require the URL.
Startup and documented node identity
omnibus/rootfs/etc/s6-overlay/scripts/init-config, cmd/silo/main.go, docs/admin-api.md, docs/architecture/omnibus-image.md
Omnibus initialization no longer checks NODE_URL. Silo reads the variable directly and rejects proxy and transcode modes without it. The documentation describes the requirement and node URL matching.

Direct non-root startup

Layer / File(s) Summary
Non-root entrypoint and setup
omnibus/rootfs/etc/s6-overlay/scripts/init-envfile, docs/architecture/omnibus-image.md, docker-compose.advanced.yml
init-envfile exits when run as a non-root user. The container comment and omnibus documentation describe starting Silo directly without root and list the effects of bypassing the init scripts.

Web component install cache

Layer / File(s) Summary
Workspace-local npm cache
internal/jellycompat/web_component.go
The default command runner is created after the temporary workspace and sets npm_config_cache to a directory inside it. The runner retains command execution and error handling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

Suggested labels: bug, impact: usability, needs-review, size/S

Suggested reviewers: rhainland, darthshadow

Merge Risk: Low · up to a5d2f

Non-root Compose deployments may fail until the documentation clearly explains the required service-level entrypoint and user settings.

Security architecture risk: Low · up to a5d2f

Non-root startup reduces required privileges, and node identity checks now apply consistently to direct startup. Operators must supply secrets, writable storage, and external services when bypassing container initialization. No introduced security vulnerability was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed startup boundary is selected through deployment-owned entrypoint, uid, and environment configuration, not a newly added request-controlled selector. Its immediate scope is the configured Silo process, writable storage, and supplied database and Redis connections. Deployment control-plane authorization is outside the available evidence.

Trust Boundaries and Controls

  • observed — Direct startup skips the init layer’s root-validated FILE__ secret-file handling rather than weakening that validation. The documented contract requires secrets to be supplied through application configuration, and bootstrap continues to reject a missing or short SECRET_KEY. No alternate secret authority is introduced by the changed code.

Resilience and Maintainability Implications

  • observed — The cache change preserves the installer’s existing operation locking, staged publication, and deferred workspace cleanup on returning success, failure, or cancellation paths. Repeated installations receive separate workspaces. Abrupt process termination and existing activation-recovery limitations are not repaired by this PR, but the cache change does not alter those transitions.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the primary change: supporting non-root Silo container startup through the silo entrypoint.
Description check Passed The description directly explains the non-root startup change and also documents the related NODE_URL validation and Jellyfin Web installer updates.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 4 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-triage silo-triage Bot added documentation Improvements or additions to documentation enhancement New feature or request go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Nov 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bae8fa216

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/architecture/omnibus-image.md Resolved
…ployment

The architecture doc kept a deployment checklist for starting without root; operator guides belong in the user manual. Keep the init-versus-binary rule and what code must not assume, and link siloserver.org for the steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@macroscopeapp

macroscopeapp Bot commented Nov 1, 2026

Copy link
Copy Markdown

This PR changes operator-visible startup and installer behavior, but the Evidence section says there is no user-visible change. Please add before-and-after terminal captures (with the image/build or commit identified) showing: the non-root omnibus start’s new actionable refusal; a proxy or transcode start without NODE_URL now failing instead of using the listen-address guess; and silo compat-web install with HOME=/ succeeding under a non-root uid instead of failing with npm EACCES.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 350d5530-7b01-4a65-ac51-a64b9b4a584b
Commits

Reviewing files that changed from the base of the PR and between 84cab92 and 8bae8fa.

Files selected for processing: 9
  • cmd/silo/main.go
  • docker-compose.advanced.yml
  • docs/admin-api.md
  • docs/architecture/omnibus-image.md
  • internal/config/bootstrap.go
  • internal/config/bootstrap_test.go
  • internal/jellycompat/web_component.go
  • omnibus/rootfs/etc/s6-overlay/scripts/init-config
  • omnibus/rootfs/etc/s6-overlay/scripts/init-envfile
Files with no reviewable changes: 1
  • omnibus/rootfs/etc/s6-overlay/scripts/init-config

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment thread docker-compose.advanced.yml Resolved
Comment thread docs/architecture/omnibus-image.md Resolved
Comment thread docs/architecture/omnibus-image.md Resolved
…-check URL

The main server checks a node's health at its registered stream_nodes URL, which can differ from NODE_URL. Also say a deployment that sets user: must set the entrypoint to silo itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai coderabbitai Bot added bug Something isn't working impact: usability Core flow broken or severely blocked needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. size/S 0–49 added + deleted lines (all files); change volume, not priority. labels Nov 1, 2026
@Quick104
Quick104 merged commit 01cb809 into main Nov 1, 2026
34 checks passed
@Quick104
Quick104 deleted the feat/docker-nonroot-silo-entrypoint branch November 1, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request go Pull requests that update go code impact: usability Core flow broken or severely blocked needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority. size/S 0–49 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant