#!/usr/bin/env bash # deploy.sh - Update and restart YEG SpookyBooth set -e echo "🚀 Starting deployment..." # Navigate to project directory cd "$(dirname "$0")/.." # 1. Pull latest code (if using git on server) if [ -d ".git" ]; then echo "📥 Pulling latest git commits..." git pull fi # 2. Install dependencies (devDependencies needed for next build & tailwind) echo "📦 Installing npm dependencies..." npm ci || npm install # 3. Build Next.js application echo "🔨 Building production Next.js build..." npm run build # 4. Start or reload PM2 if pm2 list | grep -q "photobooth_web_v1"; then echo "🔄 Reloading PM2 process..." pm2 reload ecosystem.config.cjs --update-env else echo "▶️ Starting PM2 process..." pm2 start ecosystem.config.cjs fi pm2 save echo "✅ Deployment successful! Service running on port 34821."