Fix port conflict: separate Next.js (3001) from Go API (PORT)
- Next.js admin now runs on internal port 3001 - Go API uses Dokku's PORT environment variable (5000) - Updated admin proxy default to localhost:3001 - Added /_next/* static asset proxy route This fixes the "address already in use" error when deploying to Dokku where both services were trying to bind to port 3000. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
12
start.sh
12
start.sh
@@ -11,8 +11,12 @@ if [ ! -f server.js ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting Next.js admin on :3000..."
|
||||
HOSTNAME="0.0.0.0" PORT=3000 NODE_ENV=production node server.js &
|
||||
# Save the main PORT for Go API (Dokku sets this)
|
||||
API_PORT="${PORT:-5000}"
|
||||
|
||||
# Start Next.js admin on internal port 3001
|
||||
echo "Starting Next.js admin on :3001..."
|
||||
HOSTNAME="0.0.0.0" PORT=3001 NODE_ENV=production node server.js &
|
||||
NODE_PID=$!
|
||||
|
||||
# Give Next.js a moment to boot
|
||||
@@ -24,5 +28,7 @@ if ! kill -0 "$NODE_PID" 2>/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting Go API on :${PORT:-5000}..."
|
||||
# Start Go API on main PORT that Dokku expects
|
||||
echo "Starting Go API on :${API_PORT}..."
|
||||
export PORT="${API_PORT}"
|
||||
exec /app/api
|
||||
|
||||
Reference in New Issue
Block a user