fix: CI Postgres via hostname, sem bind :5432 no host
act_runner em VPS compartilhada falhava com port already allocated; jobs usam service postgres na rede do job. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,7 +18,9 @@ env:
|
|||||||
BCRYPT_ROUNDS: 4
|
BCRYPT_ROUNDS: 4
|
||||||
CACHE_STORE: database
|
CACHE_STORE: database
|
||||||
DB_CONNECTION: pgsql
|
DB_CONNECTION: pgsql
|
||||||
DB_HOST: 127.0.0.1
|
# Service hostname on the job network (act_runner). Do not publish
|
||||||
|
# host port 5432 — shared VPS runners collide (Bind … already allocated).
|
||||||
|
DB_HOST: postgres
|
||||||
DB_PORT: 5432
|
DB_PORT: 5432
|
||||||
DB_DATABASE: amare_test
|
DB_DATABASE: amare_test
|
||||||
DB_USERNAME: amare
|
DB_USERNAME: amare
|
||||||
@@ -68,8 +70,6 @@ jobs:
|
|||||||
POSTGRES_DB: amare_test
|
POSTGRES_DB: amare_test
|
||||||
POSTGRES_USER: amare
|
POSTGRES_USER: amare
|
||||||
POSTGRES_PASSWORD: secret
|
POSTGRES_PASSWORD: secret
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U amare -d amare_test"
|
--health-cmd "pg_isready -U amare -d amare_test"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
@@ -108,8 +108,6 @@ jobs:
|
|||||||
POSTGRES_DB: amare_test
|
POSTGRES_DB: amare_test
|
||||||
POSTGRES_USER: amare
|
POSTGRES_USER: amare
|
||||||
POSTGRES_PASSWORD: secret
|
POSTGRES_PASSWORD: secret
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U amare -d amare_test"
|
--health-cmd "pg_isready -U amare -d amare_test"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
@@ -141,8 +139,6 @@ jobs:
|
|||||||
POSTGRES_DB: amare_test
|
POSTGRES_DB: amare_test
|
||||||
POSTGRES_USER: amare
|
POSTGRES_USER: amare
|
||||||
POSTGRES_PASSWORD: secret
|
POSTGRES_PASSWORD: secret
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "pg_isready -U amare -d amare_test"
|
--health-cmd "pg_isready -U amare -d amare_test"
|
||||||
--health-interval 5s
|
--health-interval 5s
|
||||||
@@ -170,7 +166,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Run browser tests against FrankenPHP container
|
- name: Run browser tests against FrankenPHP container
|
||||||
run: |
|
run: |
|
||||||
|
# Join the job/service network so nested app reaches service "postgres"
|
||||||
|
# without publishing host :5432 (collides on shared act_runner hosts).
|
||||||
|
JOB_CID="$(hostname)"
|
||||||
|
JOB_NET="$(docker inspect -f '{{range $k, $_ := .NetworkSettings.Networks}}{{println $k}}{{end}}' "$JOB_CID" | head -n1)"
|
||||||
|
test -n "$JOB_NET"
|
||||||
|
|
||||||
docker run -d --name amare-web \
|
docker run -d --name amare-web \
|
||||||
|
--network "$JOB_NET" \
|
||||||
-e APP_ENV=testing \
|
-e APP_ENV=testing \
|
||||||
-e APP_KEY="${APP_KEY}" \
|
-e APP_KEY="${APP_KEY}" \
|
||||||
-e APP_URL=http://127.0.0.1:8000 \
|
-e APP_URL=http://127.0.0.1:8000 \
|
||||||
@@ -178,7 +181,7 @@ jobs:
|
|||||||
-e APP_FALLBACK_LOCALE=pt_BR \
|
-e APP_FALLBACK_LOCALE=pt_BR \
|
||||||
-e APP_TIMEZONE=America/Sao_Paulo \
|
-e APP_TIMEZONE=America/Sao_Paulo \
|
||||||
-e DB_CONNECTION=pgsql \
|
-e DB_CONNECTION=pgsql \
|
||||||
-e DB_HOST=host.docker.internal \
|
-e DB_HOST=postgres \
|
||||||
-e DB_PORT=5432 \
|
-e DB_PORT=5432 \
|
||||||
-e DB_DATABASE=amare_test \
|
-e DB_DATABASE=amare_test \
|
||||||
-e DB_USERNAME=amare \
|
-e DB_USERNAME=amare \
|
||||||
@@ -186,7 +189,6 @@ jobs:
|
|||||||
-e SESSION_DRIVER=database \
|
-e SESSION_DRIVER=database \
|
||||||
-e CACHE_STORE=database \
|
-e CACHE_STORE=database \
|
||||||
-e QUEUE_CONNECTION=database \
|
-e QUEUE_CONNECTION=database \
|
||||||
--add-host=host.docker.internal:host-gateway \
|
|
||||||
-v "${GITHUB_WORKSPACE}/storage/app/public:/app/storage/app/public" \
|
-v "${GITHUB_WORKSPACE}/storage/app/public:/app/storage/app/public" \
|
||||||
-p 8000:8000 \
|
-p 8000:8000 \
|
||||||
amare-app:ci
|
amare-app:ci
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ Workflows live in [`.gitea/workflows/`](../../.gitea/workflows/).
|
|||||||
|
|
||||||
`actions/cache` and Docker Buildx `type=gha` are **not** used: the act_runner cache server is not reachable from job containers by default (`getCacheEntry` ETIMEDOUT). Re-enable only after configuring a reachable `cache.host`/`external_server` on the runner.
|
`actions/cache` and Docker Buildx `type=gha` are **not** used: the act_runner cache server is not reachable from job containers by default (`getCacheEntry` ETIMEDOUT). Re-enable only after configuring a reachable `cache.host`/`external_server` on the runner.
|
||||||
|
|
||||||
|
CI Postgres services must **not** publish host port `5432` (use service hostname `postgres` on the job network). Publishing `5432:5432` on a shared VPS runner fails with `Bind for 0.0.0.0:5432 failed: port is already allocated` when another job/orphan still holds the port.
|
||||||
|
|
||||||
### Staging (automatic)
|
### Staging (automatic)
|
||||||
|
|
||||||
[`.gitea/workflows/deploy-staging.yml`](../../.gitea/workflows/deploy-staging.yml)
|
[`.gitea/workflows/deploy-staging.yml`](../../.gitea/workflows/deploy-staging.yml)
|
||||||
|
|||||||
Reference in New Issue
Block a user