ci: reach postgres at container port 5432 (POSTGRES_PORT), not the published host port

d266f2e · gmorell · 2026-07-03 00:26

5 files +3 -1

Files changed

modified .github/workflows/ci.yml
+2 −0
@@ -17,6 +17,8 @@ jobs:
17 17 # Under forgejo-runner/act the job runs in a container, so the postgres
18 18 # service is reached by its service name, not localhost.
19 19 POSTGRES_HOST: postgres
20 + # service is reached at its container port under forgejo-runner
21 + POSTGRES_PORT: 5432
20 22 # Cap the test DB pool below the Postgres service's default
21 23 # max_connections (100); big CI runners otherwise scale pool to cores×2
22 24 # and exhaust connections.
modified config/test.exs
+1 −1
@@ -12,7 +12,7 @@ config :diogramos, Diogramos.Repo,
12 12 username: "postgres",
13 13 password: "postgres",
14 14 hostname: System.get_env("POSTGRES_HOST") || "localhost",
15 − port: 54329,
15 + port: String.to_integer(System.get_env("POSTGRES_PORT") || "54329"),
16 16 database: "diogramos_test#{System.get_env("MIX_TEST_PARTITION")}",
17 17 pool: Ecto.Adapters.SQL.Sandbox,
18 18 # One sandbox connection per concurrent async test. On a many-core CI runner

Parents: dc00577