fix: use dedicated internal port to avoid collision with PORT env

If a platform injects PORT=3000 (e.g. Railway), nginx and Next.js
would both try to bind port 3000. Use a dedicated internal port (7901)
for the nginx→Next.js proxy to prevent this.
This commit is contained in:
Thomas Camlong committed 2026-06-08 16:53:43 +02:00
1 parent e004afa806
commit e85c407453
2 files changed
+4 -9

No files matched your search

+3 -6
View File
@@ -18,13 +18,10 @@ fi
export AUTH_SECRET=$(openssl rand -base64 32)
export PORT=${PORT:-7575}
export INTERNAL_NEXTJS_PORT=7901
# Start nginx proxy
# 1. Replace the HOSTNAME and PORT in the nginx template file
# 2. Create the nginx configuration file from the template
# 3. Start the nginx server
export HOSTNAME
envsubst '${HOSTNAME} ${PORT}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf
envsubst '${HOSTNAME} ${PORT} ${INTERNAL_NEXTJS_PORT}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf
# Start services in the background and store their PIDs
nginx -g 'daemon off;' &
NGINX_PID=$!
@@ -38,7 +35,7 @@ else
REDIS_PID=$!
fi
PORT=3000 node apps/nextjs/server.js &
PORT=$INTERNAL_NEXTJS_PORT node apps/nextjs/server.js &
NEXTJS_PID=$!
# Function to handle SIGTERM and shut down services