Fixes the analytics API call by correctly formatting the query parameters in the `AnalyticsHistory.tsx` component. Enhances the `restart_frontend.sh` script for more aggressive process killing and port cleanup to prevent 'address already in use' errors. Also, adds a check for the `country` column existence in the database schema, addressing a potential mismatch between development and production environments. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 23dd17a9-47b9-4533-bf4c-8b5cfdb426b4 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/x5P9dcJ
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Restart IDS Frontend (Node.js/Express/Vite)
|
|
# Utility per restart manuale del server frontend
|
|
#
|
|
|
|
set -e
|
|
|
|
echo "🔄 Restart Frontend Node.js..."
|
|
|
|
# Kill AGGRESSIVO di tutti i processi Node/Vite
|
|
echo "⏸️ Stopping all Node/Vite processes..."
|
|
pkill -9 -f "node.*tsx" 2>/dev/null || true
|
|
pkill -9 -f "vite" 2>/dev/null || true
|
|
pkill -9 -f "npm run dev" 2>/dev/null || true
|
|
sleep 2
|
|
|
|
# Kill processo sulla porta 5000 (se esiste)
|
|
echo "🔍 Liberando porta 5000..."
|
|
lsof -ti:5000 | xargs kill -9 2>/dev/null || true
|
|
sleep 1
|
|
|
|
# Verifica porta LIBERA
|
|
if lsof -Pi :5000 -sTCP:LISTEN -t >/dev/null 2>&1; then
|
|
echo "❌ ERRORE: Porta 5000 ancora occupata!"
|
|
echo "Processi sulla porta:"
|
|
lsof -i:5000
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Porta 5000 libera"
|
|
|
|
# Restart usando check_frontend.sh
|
|
echo "🚀 Starting frontend..."
|
|
/opt/ids/deployment/check_frontend.sh
|
|
|
|
# Attendi avvio completo
|
|
sleep 5
|
|
|
|
# Verifica avvio
|
|
if pgrep -f "vite" > /dev/null; then
|
|
PID=$(pgrep -f "vite")
|
|
echo "✅ Frontend avviato con PID: $PID"
|
|
echo "📡 Server disponibile su: http://localhost:5000"
|
|
|
|
# Test rapido
|
|
sleep 2
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/ 2>/dev/null || echo "000")
|
|
if [ "$HTTP_CODE" = "200" ]; then
|
|
echo "✅ HTTP test OK (200)"
|
|
else
|
|
echo "⚠️ HTTP test: $HTTP_CODE"
|
|
fi
|
|
else
|
|
echo "❌ Errore: Frontend non avviato!"
|
|
echo "📋 Controlla log: tail -f /var/log/ids/frontend.log"
|
|
exit 1
|
|
fi
|