From 1bd43abb8feddf0a9eaf1e808f3a3d2da91ddd9f Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Sat, 25 Apr 2026 15:28:17 -0400 Subject: [PATCH] fix(ci): drop postgres host port mapping (multi-runner port collision) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With 3 Gitea Actions runners on the same homelab box, two simultaneous backend (or backend + e2e) jobs both try to bind 0.0.0.0:5432 for their postgres service containers. The second fails with: failed to set up container networking: ... Bind for 0.0.0.0:5432 failed: port is already allocated The host-port mapping isn't actually needed — the workflow uses \`DATABASE_URL: postgresql+asyncpg://...@postgres:5432/...\` (hostname \`postgres\` is the service container's docker-network DNS name). The tests run inside the act container which is on the same docker network, so they reach postgres without going through the host. Removing \`ports: 5432:5432\` from both backend and e2e job service definitions lets multiple postgres services run in parallel on different docker networks without colliding on the host. Surfaced when PR #150 ran in parallel with another job after the multi-runner setup. Backend instant-failed in 2s on the docker run. Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index a801f984..9ca994d4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -17,8 +17,11 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: resolutionflow_test - ports: - - 5432:5432 + # No host port mapping. Tests connect to `postgres:5432` (the service + # container's docker-network DNS name), not `localhost:5432`. With + # multiple Gitea runners on the same homelab box, host-port mapping + # would race — two backend/e2e jobs both binding 0.0.0.0:5432 → the + # second fails with "port is already allocated". options: >- --health-cmd pg_isready --health-interval 10s @@ -136,8 +139,11 @@ jobs: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: resolutionflow_test - ports: - - 5432:5432 + # No host port mapping. Tests connect to `postgres:5432` (the service + # container's docker-network DNS name), not `localhost:5432`. With + # multiple Gitea runners on the same homelab box, host-port mapping + # would race — two backend/e2e jobs both binding 0.0.0.0:5432 → the + # second fails with "port is already allocated". options: >- --health-cmd pg_isready --health-interval 10s