From 9759dd042e5f43c0e4e6644eecf590a67c549b05 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 6 Jun 2026 00:05:18 +0000 Subject: [PATCH] fix(deploy): move PostgREST host port to 3011 to coexist with dev stack 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) --- .gitea/workflows/deploy.yml | 4 ++++ docker-compose.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 29535c8..38b0c6f 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -49,6 +49,7 @@ jobs: echo "MINIO_ROOT_USER=${MINIO_ROOT_USER}" echo "MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}" echo "POSTGREST_JWT_SECRET=${POSTGREST_JWT_SECRET}" + echo "NEXT_PUBLIC_API_URL=http://localhost:3011" } >> .env # Bring the stack up fresh — --force-recreate ensures no stale # network/container references from prior failed attempts @@ -85,6 +86,7 @@ jobs: - name: Build env: NODE_ENV: production + NEXT_PUBLIC_API_URL: http://localhost:3011 DATABASE_URL: ${{ secrets.DATABASE_URL }} BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }} BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }} @@ -109,6 +111,7 @@ jobs: - name: Deploy env: + NEXT_PUBLIC_API_URL: http://localhost:3011 DATABASE_URL: ${{ secrets.DATABASE_URL }} POSTGRES_USER: ${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} @@ -146,6 +149,7 @@ jobs: # Write env file from secrets (preserves existing .env for docker compose) { 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_PASSWORD=%s\n" "$POSTGRES_PASSWORD" printf "POSTGRES_DB=%s\n" "$POSTGRES_DB" diff --git a/docker-compose.yml b/docker-compose.yml index 7b878b0..e38d11e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: PGRST_OPENAPI_MODE: disabled PGRST_DB_EXTRA_SEARCH_PATH: public,extensions ports: - - "127.0.0.1:3001:3001" + - "127.0.0.1:3011:3001" minio: image: minio/minio:latest