Skip to content

fix: make server bind address configurable - #33

Merged
andrewchen5678 merged 1 commit into
mainfrom
configurable-bind-host
Sep 12, 2026
Merged

andrewchen5678 merged 1 commit into
mainfrom
configurable-bind-host

Conversation

@andrewchen5678

Copy link
Copy Markdown
Contributor

Problem

The container image hardcoded its bind address in the Dockerfile CMD:

CMD ["uvicorn", "app.server:app", "--host", "0.0.0.0", "--port", "8000"]

That bypassed the s3player CLI entirely, so the address could only be changed by overriding the whole CMD. app.server.run() had the mirror-image problem — host="127.0.0.1", port=8000 and reload=True all hardcoded for local dev.

Change

  • SERVER_HOST / SERVER_PORT settings (defaults 127.0.0.1 / 8000), with empty values treated as unset so a copied .env.example can't yield a blank host or crash on int("").
  • s3player server gained --host, --port, --reload. Precedence: flags > env > defaults.
  • The image sets ENV SERVER_HOST=0.0.0.0 and runs CMD ["s3player", "server"]. It still listens on all interfaces out of the box, but that's now an overridable default rather than baked-in argv, and the container and local dev share one code path.
  • Reload became opt-in (--reload) — it had to, since the container now goes through the same entrypoint.

Release workflow

Replaces docker-build.yml with build.yml, adapted from s3browser's: a manual workflow_dispatch that reads the version from pyproject.toml, opens a draft release, builds and pushes multi-arch images to ghcr, then publishes the release — which is what creates the tag, so a failed build leaves no published tag behind. Dispatching from a non-main branch marks it a prerelease and skips the latest tags. No wheel/sdist jobs: s3player's wheel doesn't bundle the frontend, so it isn't a useful artifact today.

pyproject.toml version bumped 0.0.0 → 0.0.1 so the first dispatch cuts v0.0.1.

Validation

ruff check, ruff format --check, basedpyright clean; 95 tests pass. Host/port resolution verified by patching uvicorn — env yields 0.0.0.0:9001, flags override to 127.0.0.1:1234. Frontend is untouched and its deps aren't installed locally, so CI covers biome/tsc. The image itself was not built locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BRfdTTUtJsAqqAnUs94oVY

The Dockerfile pinned the bind address in its CMD (`uvicorn --host 0.0.0.0`),
bypassing the CLI entirely, so there was no way to change it at run time.
`app.server.run()` had the opposite problem: 127.0.0.1 and reload=True
hardcoded for dev.

Host and port now come from SERVER_HOST/SERVER_PORT (defaults 127.0.0.1:8000),
overridable by `--host`/`--port` on `s3player server`. The image sets
SERVER_HOST=0.0.0.0 as an env default and runs the CLI, so the container still
listens on all interfaces but the value can be overridden. Reload is now an
opt-in `--reload` flag rather than always-on.

Also replaces docker-build.yml with a manual release workflow adapted from
s3browser: version comes from pyproject.toml, draft release first, multi-arch
images to ghcr, publish last (which creates the tag).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BRfdTTUtJsAqqAnUs94oVY
@andrewchen5678
andrewchen5678 merged commit 1358cd6 into main Sep 12, 2026
2 checks passed
@andrewchen5678
andrewchen5678 deleted the configurable-bind-host branch September 12, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant