Skip to content

fix: allow configure of API binding and workers - #6967

Open
kquinsland01 wants to merge 2 commits into
keephq:mainfrom
kquinsland01:fix/api-ipv6-bind
Open

kquinsland01 wants to merge 2 commits into
keephq:mainfrom
kquinsland01:fix/api-ipv6-bind

Conversation

@kquinsland01

@kquinsland01 kquinsland01 commented Nov 14, 2026 •

Copy link
Copy Markdown

The API image hardcodes its bind address and worker count in the Gunicorn command, so deployments must replace the entire command to enable IPv6 or tune process count.

This PR adds a few knobs to change this using env-vars:

  • Small bit of python code into the existing Gunicorn configuration; preserving the existing defaults: 0.0.0.0:8080 and four workers.
  • KEEP_API_BIND allows opt-in IPv6 (for example [::]:8080); the default bind honors PORT but an explicit bind includes its own port.
  • KEEP_API_WORKERS adjusts API worker count; GUNICORN_CMD_ARGS and explicit CLI flags retain their usual higher precedence.

The existing entrypoint, Uvicorn worker class, preload, migration/provisioning hooks, and ARQ command remain intact.
Hosts without IPv6 support continue to work with the default configuration and use of IPv6 wildcard listeners will accept IPv4 connections only when the host supports dual-stack sockets.

Validation: nine tests pass against Gunicorn 23.0.0, covering image defaults, environment/CLI precedence, invalid worker counts, hook retention, ARQ/API worker separation, a real IPv4 default listener, and opt-in IPv6 plus host-supported dual-stack connections.

Resolves: #6968

@mintlify

mintlify Bot commented Nov 14, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 2c0144d.

Approve preview

@CLAassistant

CLAassistant commented Nov 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

[➕ Feature]: Allow API bind address and worker count to be configured via environment variables

2 participants