Files
honeyDueAPI/start.sh
Trey t 8022e03246 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>
2025-11-29 11:12:26 -06:00

35 lines
781 B
Bash

#!/bin/sh
set -e
cd /app
echo "Contents of /app:"
ls
if [ ! -f server.js ]; then
echo "ERROR: /app/server.js not found. Check your Docker COPY paths."
exit 1
fi
# 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
sleep 3
# If Node crashed immediately, bail out so you can see the logs
if ! kill -0 "$NODE_PID" 2>/dev/null; then
echo "ERROR: Next.js server process exited. Check logs above for stack trace."
exit 1
fi
# Start Go API on main PORT that Dokku expects
echo "Starting Go API on :${API_PORT}..."
export PORT="${API_PORT}"
exec /app/api