diff --git a/deploy/deploy.sh b/deploy/deploy.sh index bcb0786..8b8f961 100644 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -58,11 +58,11 @@ npm ci # Build frontend echo "🏗️ Build frontend Vite..." export NODE_ENV=production -./node_modules/.bin/vite build && ./node_modules/.bin/esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist +npm run build # Database migrations (serve Drizzle che è devDependency) echo "🗄️ Verifica database schema..." -./node_modules/.bin/drizzle-kit push --force || echo "⚠️ Schema push skipped (database già aggiornato)" +npm run db:push || echo "⚠️ Schema push skipped (database già aggiornato)" # NOTA: NON facciamo npm prune perché Vite serve a runtime per il middleware # Il server Express usa Vite per servire il frontend anche in produzione @@ -91,12 +91,8 @@ if $PM2_CMD show $APP_NAME > /dev/null 2>&1; then $PM2_CMD delete $APP_NAME fi -# Usa ecosystem.config.js se esiste, altrimenti comando diretto -if [ -f ecosystem.config.js ]; then - $PM2_CMD start ecosystem.config.js -else - $PM2_CMD start npm --name $APP_NAME -- start -fi +# Start con comando diretto (più affidabile) +$PM2_CMD start npm --name $APP_NAME -- start $PM2_CMD save # Health check