- 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>
348 lines
8.7 KiB
Batchfile
348 lines
8.7 KiB
Batchfile
@echo off
|
|
REM Script de lancement pour Windows - Visual Workflow Builder
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
REM Couleurs (limitées sur Windows)
|
|
set "RED=[91m"
|
|
set "GREEN=[92m"
|
|
set "YELLOW=[93m"
|
|
set "BLUE=[94m"
|
|
set "PURPLE=[95m"
|
|
set "CYAN=[96m"
|
|
set "NC=[0m"
|
|
|
|
REM Variables par défaut
|
|
set "MODE=dev"
|
|
set "FRONTEND_PORT=3000"
|
|
set "BACKEND_PORT=5001"
|
|
set "COMMAND="
|
|
|
|
REM Fonction d'aide
|
|
:show_help
|
|
echo %BLUE%Visual Workflow Builder - Script de Lancement Windows%NC%
|
|
echo.
|
|
echo Usage: %0 [COMMAND] [OPTIONS]
|
|
echo.
|
|
echo %YELLOW%Commandes:%NC%
|
|
echo start Demarrer l'application complete (backend + frontend)
|
|
echo stop Arreter l'application complete
|
|
echo status Afficher le statut des services
|
|
echo setup Configuration initiale
|
|
echo test Lancer les tests
|
|
echo clean Nettoyer les fichiers temporaires
|
|
echo.
|
|
echo %YELLOW%Options:%NC%
|
|
echo --dev Mode developpement (defaut)
|
|
echo --prod Mode production
|
|
echo --help Afficher cette aide
|
|
echo.
|
|
echo %YELLOW%Exemples:%NC%
|
|
echo %0 start --dev # Demarrer en mode developpement
|
|
echo %0 start --prod # Demarrer en mode production
|
|
echo %0 status # Verifier le statut
|
|
echo.
|
|
goto :eof
|
|
|
|
REM Parser les arguments
|
|
:parse_args
|
|
if "%~1"=="" goto :end_parse
|
|
if "%~1"=="start" set "COMMAND=start" & shift & goto :parse_args
|
|
if "%~1"=="stop" set "COMMAND=stop" & shift & goto :parse_args
|
|
if "%~1"=="status" set "COMMAND=status" & shift & goto :parse_args
|
|
if "%~1"=="setup" set "COMMAND=setup" & shift & goto :parse_args
|
|
if "%~1"=="test" set "COMMAND=test" & shift & goto :parse_args
|
|
if "%~1"=="clean" set "COMMAND=clean" & shift & goto :parse_args
|
|
if "%~1"=="--dev" set "MODE=dev" & shift & goto :parse_args
|
|
if "%~1"=="--prod" set "MODE=prod" & shift & goto :parse_args
|
|
if "%~1"=="--help" call :show_help & exit /b 0
|
|
echo %RED%Option inconnue: %~1%NC%
|
|
call :show_help
|
|
exit /b 1
|
|
|
|
:end_parse
|
|
|
|
REM Si aucune commande, afficher l'aide
|
|
if "%COMMAND%"=="" (
|
|
call :show_help
|
|
exit /b 1
|
|
)
|
|
|
|
REM Fichiers PID pour Windows (utilisation de fichiers temporaires)
|
|
set "BACKEND_PID_FILE=%TEMP%\vwb_backend.pid"
|
|
set "FRONTEND_PID_FILE=%TEMP%\vwb_frontend.pid"
|
|
|
|
REM Fonction pour vérifier si un processus est en cours
|
|
:is_running
|
|
set "pid_file=%~1"
|
|
if exist "%pid_file%" (
|
|
set /p pid=<"%pid_file%"
|
|
tasklist /FI "PID eq !pid!" 2>nul | find "!pid!" >nul
|
|
if !errorlevel! equ 0 (
|
|
exit /b 0
|
|
) else (
|
|
del "%pid_file%" 2>nul
|
|
exit /b 1
|
|
)
|
|
)
|
|
exit /b 1
|
|
|
|
REM Fonction pour arrêter un processus
|
|
:stop_process
|
|
set "pid_file=%~1"
|
|
set "name=%~2"
|
|
|
|
call :is_running "%pid_file%"
|
|
if !errorlevel! equ 0 (
|
|
set /p pid=<"%pid_file%"
|
|
echo %YELLOW%Arret de %name% (PID: !pid!)...%NC%
|
|
taskkill /PID !pid! /F >nul 2>&1
|
|
del "%pid_file%" 2>nul
|
|
echo %GREEN%%name% arrete%NC%
|
|
) else (
|
|
echo %CYAN%%name% n'est pas en cours d'execution%NC%
|
|
)
|
|
goto :eof
|
|
|
|
REM Commande START
|
|
:cmd_start
|
|
echo %PURPLE%🚀 Demarrage de Visual Workflow Builder%NC%
|
|
echo %CYAN%Mode: %MODE%%NC%
|
|
echo %CYAN%Frontend: http://localhost:%FRONTEND_PORT%%NC%
|
|
echo %CYAN%Backend: http://localhost:%BACKEND_PORT%%NC%
|
|
echo.
|
|
|
|
REM Démarrer le backend
|
|
echo %BLUE%Demarrage du backend sur le port %BACKEND_PORT%...%NC%
|
|
cd backend
|
|
|
|
REM Vérifier l'environnement virtuel
|
|
if not exist "venv" (
|
|
echo %YELLOW%Creation de l'environnement virtuel...%NC%
|
|
python -m venv venv
|
|
)
|
|
|
|
REM Activer l'environnement virtuel
|
|
call venv\Scripts\activate.bat
|
|
|
|
REM Installer les dépendances si nécessaire
|
|
if not exist ".deps_installed" (
|
|
echo %YELLOW%Installation des dependances Python...%NC%
|
|
pip install -r requirements.txt
|
|
echo. > .deps_installed
|
|
)
|
|
|
|
REM Démarrer le backend
|
|
set "PORT=%BACKEND_PORT%"
|
|
set "FLASK_ENV=%MODE%"
|
|
|
|
start /B python app.py > ..\backend.log 2>&1
|
|
for /f "tokens=2" %%i in ('tasklist /FI "IMAGENAME eq python.exe" /FO CSV ^| find "python.exe"') do (
|
|
echo %%i > "%BACKEND_PID_FILE%"
|
|
goto :backend_started
|
|
)
|
|
:backend_started
|
|
|
|
cd ..
|
|
|
|
REM Attendre que le backend soit prêt
|
|
echo %YELLOW%Attente du demarrage du backend...%NC%
|
|
timeout /t 10 /nobreak >nul
|
|
|
|
REM Démarrer le frontend
|
|
echo %BLUE%Demarrage du frontend sur le port %FRONTEND_PORT%...%NC%
|
|
cd frontend
|
|
|
|
REM Installer les dépendances si nécessaire
|
|
if not exist "node_modules" (
|
|
echo %YELLOW%Installation des dependances Node.js...%NC%
|
|
npm install
|
|
)
|
|
|
|
REM Configurer les variables d'environnement
|
|
set "PORT=%FRONTEND_PORT%"
|
|
set "REACT_APP_API_URL=http://localhost:%BACKEND_PORT%"
|
|
|
|
if "%MODE%"=="dev" (
|
|
start /B npm start > ..\frontend.log 2>&1
|
|
) else (
|
|
if not exist "build" (
|
|
echo %YELLOW%Build de production...%NC%
|
|
npm run build
|
|
)
|
|
start /B npx serve -s build -l %FRONTEND_PORT% > ..\frontend.log 2>&1
|
|
)
|
|
|
|
REM Sauvegarder le PID (approximatif pour Windows)
|
|
for /f "tokens=2" %%i in ('tasklist /FI "IMAGENAME eq node.exe" /FO CSV ^| find "node.exe"') do (
|
|
echo %%i > "%FRONTEND_PID_FILE%"
|
|
goto :frontend_started
|
|
)
|
|
:frontend_started
|
|
|
|
cd ..
|
|
|
|
echo.
|
|
echo %GREEN%✅ Application demarree avec succes!%NC%
|
|
echo %CYAN%🌐 Ouvrez http://localhost:%FRONTEND_PORT% dans votre navigateur%NC%
|
|
echo %CYAN%📊 API disponible sur http://localhost:%BACKEND_PORT%%NC%
|
|
echo.
|
|
echo %YELLOW%Pour arreter: %0 stop%NC%
|
|
echo %YELLOW%Pour voir le statut: %0 status%NC%
|
|
goto :eof
|
|
|
|
REM Commande STOP
|
|
:cmd_stop
|
|
echo %PURPLE%🛑 Arret de Visual Workflow Builder%NC%
|
|
|
|
call :stop_process "%FRONTEND_PID_FILE%" "Frontend"
|
|
call :stop_process "%BACKEND_PID_FILE%" "Backend"
|
|
|
|
echo %GREEN%✅ Application arretee%NC%
|
|
goto :eof
|
|
|
|
REM Commande STATUS
|
|
:cmd_status
|
|
echo %PURPLE%📊 Statut de Visual Workflow Builder%NC%
|
|
echo.
|
|
|
|
REM Statut du backend
|
|
call :is_running "%BACKEND_PID_FILE%"
|
|
if !errorlevel! equ 0 (
|
|
set /p backend_pid=<"%BACKEND_PID_FILE%"
|
|
echo %GREEN%✅ Backend: En cours (PID: !backend_pid!, Port: %BACKEND_PORT%)%NC%
|
|
) else (
|
|
echo %RED%❌ Backend: Arrete%NC%
|
|
)
|
|
|
|
REM Statut du frontend
|
|
call :is_running "%FRONTEND_PID_FILE%"
|
|
if !errorlevel! equ 0 (
|
|
set /p frontend_pid=<"%FRONTEND_PID_FILE%"
|
|
echo %GREEN%✅ Frontend: En cours (PID: !frontend_pid!, Port: %FRONTEND_PORT%)%NC%
|
|
) else (
|
|
echo %RED%❌ Frontend: Arrete%NC%
|
|
)
|
|
|
|
echo.
|
|
echo %CYAN%💻 Informations systeme:%NC%
|
|
echo OS: Windows
|
|
python --version 2>nul && echo Python: Installe || echo Python: Non installe
|
|
node --version 2>nul && echo Node.js: Installe || echo Node.js: Non installe
|
|
npm --version 2>nul && echo npm: Installe || echo npm: Non installe
|
|
goto :eof
|
|
|
|
REM Commande SETUP
|
|
:cmd_setup
|
|
echo %PURPLE%⚙️ Configuration initiale de Visual Workflow Builder%NC%
|
|
echo.
|
|
|
|
REM Vérifier les prérequis
|
|
echo %BLUE%Verification des prerequis...%NC%
|
|
|
|
python --version >nul 2>&1
|
|
if !errorlevel! neq 0 (
|
|
echo %RED%❌ Python n'est pas installe%NC%
|
|
exit /b 1
|
|
)
|
|
echo %GREEN%✅ Python: Installe%NC%
|
|
|
|
node --version >nul 2>&1
|
|
if !errorlevel! neq 0 (
|
|
echo %RED%❌ Node.js n'est pas installe%NC%
|
|
exit /b 1
|
|
)
|
|
echo %GREEN%✅ Node.js: Installe%NC%
|
|
|
|
npm --version >nul 2>&1
|
|
if !errorlevel! neq 0 (
|
|
echo %RED%❌ npm n'est pas installe%NC%
|
|
exit /b 1
|
|
)
|
|
echo %GREEN%✅ npm: Installe%NC%
|
|
|
|
REM Configuration du backend
|
|
echo %BLUE%Configuration du backend...%NC%
|
|
cd backend
|
|
|
|
if not exist "venv" (
|
|
python -m venv venv
|
|
)
|
|
|
|
call venv\Scripts\activate.bat
|
|
pip install -r requirements.txt
|
|
echo. > .deps_installed
|
|
|
|
cd ..
|
|
|
|
REM Configuration du frontend
|
|
echo %BLUE%Configuration du frontend...%NC%
|
|
cd frontend
|
|
npm install
|
|
cd ..
|
|
|
|
echo %GREEN%✅ Configuration terminee%NC%
|
|
echo.
|
|
echo %CYAN%Vous pouvez maintenant demarrer l'application avec:%NC%
|
|
echo %YELLOW%%0 start%NC%
|
|
goto :eof
|
|
|
|
REM Commande TEST
|
|
:cmd_test
|
|
echo %PURPLE%🧪 Tests de Visual Workflow Builder%NC%
|
|
echo.
|
|
|
|
REM Vérifier que l'application est démarrée
|
|
call :is_running "%BACKEND_PID_FILE%"
|
|
set "backend_running=!errorlevel!"
|
|
call :is_running "%FRONTEND_PID_FILE%"
|
|
set "frontend_running=!errorlevel!"
|
|
|
|
if !backend_running! neq 0 (
|
|
echo %YELLOW%Demarrage de l'application pour les tests...%NC%
|
|
call :cmd_start
|
|
timeout /t 5 /nobreak >nul
|
|
)
|
|
|
|
echo %BLUE%Test de l'import/export...%NC%
|
|
if exist "test_import_export.sh" (
|
|
bash test_import_export.sh
|
|
)
|
|
|
|
echo %GREEN%✅ Tests termines%NC%
|
|
goto :eof
|
|
|
|
REM Commande CLEAN
|
|
:cmd_clean
|
|
echo %PURPLE%🧹 Nettoyage des fichiers temporaires%NC%
|
|
|
|
call :cmd_stop
|
|
|
|
del backend.log 2>nul
|
|
del frontend.log 2>nul
|
|
del "%BACKEND_PID_FILE%" 2>nul
|
|
del "%FRONTEND_PID_FILE%" 2>nul
|
|
|
|
if exist "backend\__pycache__" (
|
|
rmdir /s /q "backend\__pycache__"
|
|
)
|
|
|
|
if exist "frontend\build" (
|
|
rmdir /s /q "frontend\build"
|
|
)
|
|
|
|
echo %GREEN%✅ Nettoyage termine%NC%
|
|
goto :eof
|
|
|
|
REM Point d'entrée principal
|
|
call :parse_args %*
|
|
|
|
REM Exécuter la commande
|
|
if "%COMMAND%"=="start" call :cmd_start
|
|
if "%COMMAND%"=="stop" call :cmd_stop
|
|
if "%COMMAND%"=="status" call :cmd_status
|
|
if "%COMMAND%"=="setup" call :cmd_setup
|
|
if "%COMMAND%"=="test" call :cmd_test
|
|
if "%COMMAND%"=="clean" call :cmd_clean
|
|
|
|
endlocal |