fix(deploy): move PostgREST host port to 3011 to coexist with dev stack
Build / build (push) Has been cancelled
Deploy to route.crispygoat.com / deploy (push) Failing after 13s

The dev PostgREST (started outside docker compose for local development)
and the production PostgREST (started by docker compose up) were both
trying to bind 127.0.0.1:3001. Even with fuser -k in the deploy cleanup,
something on tyler's host (likely a process supervisor restarting the
dev PostgREST) keeps reclaiming 3001 between our check and the
docker bind.

Move the production PostgREST to host port 3011, keeping the container's
internal port at 3001 (PostgREST's default). This lets dev and prod
coexist on the same host without fighting over a port.

Update NEXT_PUBLIC_API_URL to http://localhost:3011 in:
- Build step env (so the build bakes in the right URL)
- Start Docker stack .env append (so docker compose + app see the URL)
- Deploy step .env.production writing (so runtime app uses 3011)
This commit is contained in:
2026-06-06 00:05:18 +00:00
parent e6911a184c
commit 9759dd042e
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -49,6 +49,7 @@ jobs:
echo "MINIO_ROOT_USER=${MINIO_ROOT_USER}" echo "MINIO_ROOT_USER=${MINIO_ROOT_USER}"
echo "MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}" echo "MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}"
echo "POSTGREST_JWT_SECRET=${POSTGREST_JWT_SECRET}" echo "POSTGREST_JWT_SECRET=${POSTGREST_JWT_SECRET}"
echo "NEXT_PUBLIC_API_URL=http://localhost:3011"
} >> .env } >> .env
# Bring the stack up fresh — --force-recreate ensures no stale # Bring the stack up fresh — --force-recreate ensures no stale
# network/container references from prior failed attempts # network/container references from prior failed attempts
@@ -85,6 +86,7 @@ jobs:
- name: Build - name: Build
env: env:
NODE_ENV: production NODE_ENV: production
NEXT_PUBLIC_API_URL: http://localhost:3011
DATABASE_URL: ${{ secrets.DATABASE_URL }} DATABASE_URL: ${{ secrets.DATABASE_URL }}
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }} BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }} BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }}
@@ -109,6 +111,7 @@ jobs:
- name: Deploy - name: Deploy
env: env:
NEXT_PUBLIC_API_URL: http://localhost:3011
DATABASE_URL: ${{ secrets.DATABASE_URL }} DATABASE_URL: ${{ secrets.DATABASE_URL }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
@@ -146,6 +149,7 @@ jobs:
# Write env file from secrets (preserves existing .env for docker compose) # Write env file from secrets (preserves existing .env for docker compose)
{ {
printf "DATABASE_URL=%s\n" "$DATABASE_URL" printf "DATABASE_URL=%s\n" "$DATABASE_URL"
printf "NEXT_PUBLIC_API_URL=%s\n" "$NEXT_PUBLIC_API_URL"
printf "POSTGRES_USER=%s\n" "$POSTGRES_USER" printf "POSTGRES_USER=%s\n" "$POSTGRES_USER"
printf "POSTGRES_PASSWORD=%s\n" "$POSTGRES_PASSWORD" printf "POSTGRES_PASSWORD=%s\n" "$POSTGRES_PASSWORD"
printf "POSTGRES_DB=%s\n" "$POSTGRES_DB" printf "POSTGRES_DB=%s\n" "$POSTGRES_DB"
+1 -1
View File
@@ -36,7 +36,7 @@ services:
PGRST_OPENAPI_MODE: disabled PGRST_OPENAPI_MODE: disabled
PGRST_DB_EXTRA_SEARCH_PATH: public,extensions PGRST_DB_EXTRA_SEARCH_PATH: public,extensions
ports: ports:
- "127.0.0.1:3001:3001" - "127.0.0.1:3011:3001"
minio: minio:
image: minio/minio:latest image: minio/minio:latest