- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
159 lines
4.3 KiB
Bash
Executable File
159 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script de démarrage complet - Visual Workflow Builder
|
|
# Auteur : Dom, Alice, Kiro - 8 janvier 2026
|
|
# Lance le backend et le frontend en parallèle
|
|
|
|
echo "=========================================="
|
|
echo "Visual Workflow Builder - Démarrage"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
# Couleurs
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Fonction pour nettoyer les processus à la sortie
|
|
cleanup() {
|
|
echo ""
|
|
echo -e "${YELLOW}Arrêt des services...${NC}"
|
|
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
|
|
exit 0
|
|
}
|
|
|
|
trap cleanup SIGINT SIGTERM
|
|
|
|
# Fonction pour nettoyer les ports utilisés
|
|
cleanup_ports() {
|
|
echo -e "${BLUE}🧹 Nettoyage des ports utilisés...${NC}"
|
|
|
|
# Nettoyer le port 5002 (backend VWB)
|
|
local backend_pids=$(lsof -ti:5002 2>/dev/null)
|
|
if [ ! -z "$backend_pids" ]; then
|
|
echo -e "${YELLOW} Arrêt des processus sur le port 5002...${NC}"
|
|
echo "$backend_pids" | xargs -r kill -9 2>/dev/null
|
|
sleep 1
|
|
fi
|
|
|
|
# Nettoyer le port 3000 (frontend React)
|
|
local frontend_pids=$(lsof -ti:3000 2>/dev/null)
|
|
if [ ! -z "$frontend_pids" ]; then
|
|
echo -e "${YELLOW} Arrêt des processus sur le port 3000...${NC}"
|
|
echo "$frontend_pids" | xargs -r kill -9 2>/dev/null
|
|
sleep 1
|
|
fi
|
|
|
|
echo -e "${GREEN}✓ Ports nettoyés${NC}"
|
|
}
|
|
|
|
# Vérifier que nous sommes dans le bon répertoire
|
|
if [ ! -d "backend" ] || [ ! -d "frontend" ]; then
|
|
echo -e "${RED}Erreur: Ce script doit être exécuté depuis visual_workflow_builder/${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Nettoyer les ports avant de commencer
|
|
cleanup_ports
|
|
|
|
# Démarrer le backend
|
|
echo -e "${GREEN}1. Démarrage du backend Flask...${NC}"
|
|
|
|
# Vérifier l'environnement virtuel
|
|
if [ ! -d "../venv_v3" ]; then
|
|
echo -e "${RED} Erreur: Environnement virtuel venv_v3 non trouvé${NC}"
|
|
echo " Exécutez d'abord: python3 -m venv ../venv_v3"
|
|
exit 1
|
|
else
|
|
source ../venv_v3/bin/activate
|
|
fi
|
|
|
|
cd backend
|
|
PORT=5002 python app.py > ../backend.log 2>&1 &
|
|
BACKEND_PID=$!
|
|
cd ..
|
|
|
|
# Attendre que le backend soit prêt
|
|
echo " Attente du backend..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:5002/health > /dev/null 2>&1; then
|
|
echo -e "${GREEN} ✓ Backend prêt sur http://localhost:5002${NC}"
|
|
break
|
|
fi
|
|
if [ $i -eq 30 ]; then
|
|
echo -e "${RED} ✗ Timeout: Le backend n'a pas démarré${NC}"
|
|
echo " Vérifiez backend.log pour plus de détails"
|
|
kill $BACKEND_PID 2>/dev/null
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
# Démarrer le frontend
|
|
echo ""
|
|
echo -e "${GREEN}2. Démarrage du frontend React...${NC}"
|
|
cd frontend
|
|
|
|
# Vérifier si node_modules existe
|
|
if [ ! -d "node_modules" ]; then
|
|
echo -e "${YELLOW} Installation des dépendances npm...${NC}"
|
|
npm install
|
|
fi
|
|
|
|
# Démarrer le serveur de développement
|
|
BROWSER=none npm start > ../frontend.log 2>&1 &
|
|
FRONTEND_PID=$!
|
|
cd ..
|
|
|
|
# Attendre que le frontend soit prêt
|
|
echo " Attente du frontend..."
|
|
for i in {1..60}; do
|
|
if curl -s http://localhost:3000 > /dev/null 2>&1; then
|
|
echo -e "${GREEN} ✓ Frontend prêt sur http://localhost:3000${NC}"
|
|
break
|
|
fi
|
|
if [ $i -eq 60 ]; then
|
|
echo -e "${RED} ✗ Timeout: Le frontend n'a pas démarré${NC}"
|
|
echo " Vérifiez frontend.log pour plus de détails"
|
|
cleanup
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
# Afficher les informations
|
|
echo ""
|
|
echo "=========================================="
|
|
echo -e "${GREEN}✓ Visual Workflow Builder est prêt !${NC}"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "URLs:"
|
|
echo " • Frontend: http://localhost:3000"
|
|
echo " • Backend: http://localhost:5002"
|
|
echo " • Health: http://localhost:5002/health"
|
|
echo ""
|
|
echo "Logs:"
|
|
echo " • Backend: tail -f backend.log"
|
|
echo " • Frontend: tail -f frontend.log"
|
|
echo ""
|
|
echo "Pour arrêter: Ctrl+C"
|
|
echo ""
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
# Ouvrir le navigateur automatiquement (optionnel)
|
|
if command -v xdg-open > /dev/null; then
|
|
xdg-open http://localhost:3000 2>/dev/null
|
|
elif command -v open > /dev/null; then
|
|
open http://localhost:3000 2>/dev/null
|
|
fi
|
|
|
|
# Attendre indéfiniment
|
|
echo "Services en cours d'exécution..."
|
|
echo "Appuyez sur Ctrl+C pour arrêter"
|
|
echo ""
|
|
|
|
wait
|