66 lines
1.8 KiB
Batchfile
66 lines
1.8 KiB
Batchfile
|
|
@echo off
|
||
|
|
REM ============================================================
|
||
|
|
REM Atomizer Dashboard Launcher
|
||
|
|
REM One-click: starts servers and opens dashboard in browser
|
||
|
|
REM ============================================================
|
||
|
|
|
||
|
|
title Atomizer
|
||
|
|
cd /d "%~dp0\.."
|
||
|
|
|
||
|
|
REM Ports (match vite.config.ts)
|
||
|
|
set BACKEND_PORT=8001
|
||
|
|
set FRONTEND_PORT=3003
|
||
|
|
set URL=http://localhost:%FRONTEND_PORT%
|
||
|
|
|
||
|
|
REM Check if already running
|
||
|
|
set BACKEND_RUNNING=0
|
||
|
|
set FRONTEND_RUNNING=0
|
||
|
|
|
||
|
|
netstat -ano | findstr "LISTENING" | findstr ":%BACKEND_PORT% " > nul 2>&1
|
||
|
|
if %errorlevel% equ 0 set BACKEND_RUNNING=1
|
||
|
|
|
||
|
|
netstat -ano | findstr "LISTENING" | findstr ":%FRONTEND_PORT% " > nul 2>&1
|
||
|
|
if %errorlevel% equ 0 set FRONTEND_RUNNING=1
|
||
|
|
|
||
|
|
REM If both running, just open browser and exit immediately
|
||
|
|
if %BACKEND_RUNNING% equ 1 (
|
||
|
|
if %FRONTEND_RUNNING% equ 1 (
|
||
|
|
start "" %URL%
|
||
|
|
exit
|
||
|
|
)
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Show brief splash while starting
|
||
|
|
echo.
|
||
|
|
echo Starting Atomizer Dashboard...
|
||
|
|
echo.
|
||
|
|
|
||
|
|
REM Start backend (hidden window)
|
||
|
|
if %BACKEND_RUNNING% equ 0 (
|
||
|
|
echo [1/2] Backend...
|
||
|
|
start /min "Atomizer Backend" cmd /c "cd /d %~dp0\..\atomizer-dashboard\backend && C:\Users\antoi\anaconda3\envs\atomizer\python.exe -m uvicorn api.main:app --host 0.0.0.0 --port %BACKEND_PORT%"
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Start frontend (hidden window)
|
||
|
|
if %FRONTEND_RUNNING% equ 0 (
|
||
|
|
echo [2/2] Frontend...
|
||
|
|
start /min "Atomizer Frontend" cmd /c "cd /d %~dp0\..\atomizer-dashboard\frontend && npm run dev"
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Wait for frontend to be ready (poll until port responds)
|
||
|
|
echo.
|
||
|
|
echo Waiting for servers to start...
|
||
|
|
:WAIT_LOOP
|
||
|
|
timeout /t 1 /nobreak > nul
|
||
|
|
netstat -ano | findstr "LISTENING" | findstr ":%FRONTEND_PORT% " > nul 2>&1
|
||
|
|
if %errorlevel% neq 0 goto WAIT_LOOP
|
||
|
|
|
||
|
|
REM Small extra delay to ensure Vite is fully ready
|
||
|
|
timeout /t 2 /nobreak > nul
|
||
|
|
|
||
|
|
REM Open browser
|
||
|
|
start "" %URL%
|
||
|
|
|
||
|
|
REM Close this launcher window
|
||
|
|
exit
|