Skip to content

fix(coolify): suppress host port binding with empty ports_mappings#118

Open
rdemeritt wants to merge 10 commits into
mainfrom
fix/coolify-host-port-binding
Open

fix(coolify): suppress host port binding with empty ports_mappings#118
rdemeritt wants to merge 10 commits into
mainfrom
fix/coolify-host-port-binding

Conversation

@rdemeritt
Copy link
Copy Markdown
Member

Summary

  • With proxy_type=none, Coolify binds ports_exposes directly to the host machine as a -p PORT:PORT Docker mapping
  • All sites default to ports_exposes: '3000' → second deploy always fails with port already allocated
  • Fix: pass ports_mappings: '' on app creation to suppress host binding; ports_exposes stays so hermithost's Traefik still knows the internal container port

Changes

  • api/src/services/coolify.ts — added ports_mappings?: string to CoolifyCreateApplicationPayload
  • api/src/routes/sites.ts — pass ports_mappings: '' on site create
  • api/src/services/backup.ts — pass ports_mappings: '' on restore/import

Test plan

  • Deploy a site — verify no host port binding on host (docker ps shows no 0.0.0.0:3000->3000 mapping)
  • Deploy a second site on same port — verify no conflict
  • Traefik still routes to deployed sites correctly
  • Restore from backup — verify restored sites also have no host binding

Note

Existing deployed sites retain their current host-port bindings (port mappings are immutable post-creation in Coolify). Conflicting old sites must be deleted and redeployed.

rdemeritt added 10 commits May 9, 2026 22:48
127.0.0.1:9080:9080 causes ERR_EMPTY_RESPONSE on macOS Docker Desktop —
TCP handshake completes but data transfer silently drops. Binding to all
interfaces (9080:9080) resolves host-level access to the HermitHost UI.
…ected

Docker Desktop returns 403 with 'already exists in network' when a
container is already a member of the target network. Previously this was
treated as a proxy denial and the whole route provision aborted. Detect
this specific message and treat it as the existing 409 no-op path.
PAT set as URL username (https://PAT@github.com) caused git to prompt
for a password — no TTY in Coolify helper container → deploy failure.
GitHub requires the PAT as the password: https://x-access-token:PAT@github.com.
GET /api/sites was firing listDeployments() for every app (N extra
calls per request). Startup sync was calling getApplication() per
dockercompose app redundantly — listApplications() already returns
the same data. Combined these hit Coolify's 200 req/min rate limit
during development restarts, causing 429 → 500 on the sites page.

Fix: pass [] for deployments on list view (detail endpoint unchanged);
remove redundant getApplication() from startup sync.
With proxy_type=none, Coolify binds ports_exposes directly to the host.
All sites default to port 3000, so the second deploy always conflicts.
Empty ports_mappings suppresses host binding; ports_exposes stays for
internal Traefik routing.
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