Skip to content

Make every published host port overridable - #2

Merged
sahilkalgutkar merged 1 commit into
mainfrom
fix/overridable-host-ports
Sep 1, 2026
Merged

sahilkalgutkar merged 1 commit into
mainfrom
fix/overridable-host-ports

Conversation

@sahilkalgutkar

Copy link
Copy Markdown
Owner

Part of the same audit as sahilkalgutkar/modelforge#18 — checking the things CI never runs, the quickstart chief among them.

The quickstart's port table is followed by this note:

If a port above is already taken on your machine, override it, e.g. POSTGRES_HOST_PORT=5434 FRONTEND_HOST_PORT=5175 docker compose up --build.

That advice only worked for one of the four ports in the table. docker-compose.yml had POSTGRES_HOST_PORT and FRONTEND_HOST_PORT, but the core API (8000), the ingestion service (8080) and Redis (6379) were hard-coded — and Postgres, the one that does have a variable, was not even in the table. On a machine already running Redis, docker compose up fails on a port bind and the README's own remedy does not help.

This adds CORE_API_HOST_PORT, INGESTION_HOST_PORT and REDIS_HOST_PORT, and threads CORE_API_HOST_PORT through the frontend's VITE_API_BASE_URL build arg — otherwise moving the API's host port would leave the browser calling a port nothing is listening on. Only the host side of each mapping moves; service-to-service traffic inside the compose network is untouched. The table now names the variable per row and includes Postgres and Redis, and .env.example lists all five.

Verified with docker compose config: with all five set, the published ports resolve to the overrides and VITE_API_BASE_URL follows to http://localhost:8800. I could not bring the full stack up to confirm at runtime — the Docker daemon on this machine is out of disk and its storage has gone read-only — but the change is confined to variable substitution in the port mappings and one build arg, and docker compose config validates both the defaults and the overrides.

The quickstart lists four URLs and then says to override the port if one is
already taken -- but only the frontend's was actually a variable. Postgres had
POSTGRES_HOST_PORT and nothing else did, so the example in that note
(FRONTEND_HOST_PORT=5175) worked while the API on 8000, the ingestion service
on 8080 and Redis on 6379 were pinned, and 6379 in particular is usually
already in use on a machine that runs Redis for anything else.

Add CORE_API_HOST_PORT, INGESTION_HOST_PORT and REDIS_HOST_PORT, and build the
frontend against ${CORE_API_HOST_PORT} so the browser follows the API when it
moves. Only the host side of each mapping changes; inside the compose network
everything still talks on the standard ports. The URL table now names the
variable for each row, and .env.example lists all five.
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sahilkalgutkar
sahilkalgutkar merged commit ecd103c into main Sep 1, 2026
4 checks passed
@sahilkalgutkar
sahilkalgutkar deleted the fix/overridable-host-ports branch September 1, 2026 19:26
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