Make the listen port configurable via PORT
All checks were successful
Deploy / deploy (push) Successful in 22s
All checks were successful
Deploy / deploy (push) Successful in 22s
app.py's dev server and gunicorn both hardcoded 5000, which is awkward
locally — macOS ControlCenter already holds that port, so the app can't
bind on the dev laptop without editing source.
Both now read PORT, defaulting to 5000 so EXPOSE, the compose
`${HOST_PORT}:5000` mapping and the deployed container are unchanged.
Read at run time rather than import time so a dev harness can assign a
free port.
Also tracks .claude/launch.json with autoPort set. It doesn't actually
launch on this machine — the preview sandbox can't read files under
~/Desktop — so CLAUDE.md notes that running from a shell with an
explicit PORT is the working local path.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
95b7ce7c03
commit
f572d95bd0
4 changed files with 32 additions and 2 deletions
|
|
@ -1,8 +1,12 @@
|
|||
# Gunicorn configuration
|
||||
import os
|
||||
|
||||
workers = 2 # 2 workers × 4 threads = 8 concurrent requests; fewer cold-cache workers
|
||||
threads = 4
|
||||
worker_class = "gthread"
|
||||
bind = "0.0.0.0:5000"
|
||||
# Defaults to 5000 to match EXPOSE, the `${HOST_PORT}:5000` mapping in
|
||||
# docker-compose.yml, and app.py's own dev-server default.
|
||||
bind = "0.0.0.0:" + os.environ.get("PORT", "5000")
|
||||
timeout = 30 # fail fast — app has its own 5s internal deadline
|
||||
keepalive = 5
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue