fix: resolve multiple runtime and build issues

- Fix network binding to allow external access (0.0.0.0)
- Upgrade to Node.js 20.x for Next.js 16 compatibility
- Fix next-auth v4 configuration and session handling
- Add Steam client secret for Steam OAuth provider
- Fix Prisma schema unique constraint syntax
- Fix database creation script for automated deployment
- Fix game search API to use new IStoreService endpoint
- Fix session auth in API routes for Steam linking
- Add TypeScript types for next-auth session
This commit is contained in:
2026-02-21 22:51:45 +00:00
parent 14890b6875
commit 70726c50dc
13 changed files with 1064 additions and 112 deletions

19
deploy.sh Normal file → Executable file
View File

@@ -3,6 +3,8 @@ set -e
DOMAIN="${1:-192.168.2.175:3000}"
export PATH="$HOME/.local/node/bin:$PATH"
echo "=== FairReview Deployment Script ==="
echo "Target domain: $DOMAIN"
echo ""
@@ -22,6 +24,9 @@ fi
source .postgres-env
# Export database credentials for Node.js scripts
export DB_HOST DB_PORT DB_USER DB_PASS DB_NAME
# Validate credentials
if [ -z "$DB_PASS" ] || [ "$DB_PASS" = "your_password_here" ]; then
echo "Error: Please update .postgres-env with your actual database password."
@@ -47,7 +52,7 @@ fi
echo ""
echo "=== Installing required packages ==="
sudo apt update
sudo apt install -y curl build-essential git
sudo apt install -y curl build-essential git postgresql-client
# Install PM2 globally
echo ""
@@ -82,10 +87,18 @@ echo " Database: ${DB_HOST}:${DB_PORT}/${DB_NAME}"
echo ""
echo "IMPORTANT: Update STEAM_API_KEY in .env.local with your Steam Web API key!"
# Generate Prisma client and push schema
# Generate Prisma client
echo ""
echo "=== Setting up database ==="
npx prisma generate
# Create database if it doesn't exist
echo ""
echo "=== Creating database if not exists ==="
node scripts/create-db.js
# Push schema to database
export DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=require"
npx prisma db push
# Build for production
@@ -98,7 +111,7 @@ echo ""
echo "=== Starting application with PM2 ==="
pm2 stop fairreview 2>/dev/null || true
pm2 delete fairreview 2>/dev/null || true
pm2 start npm --name "fairreview" -- run start
pm2 start npm --name "fairreview" -- start -- -H 0.0.0.0
# Save PM2 config for restart on reboot
pm2 save