chore: add one-click startup script
This commit is contained in:
86
start-aivideo.bat
Normal file
86
start-aivideo.bat
Normal file
@@ -0,0 +1,86 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "ROOT=%~dp0"
|
||||
cd /d "%ROOT%"
|
||||
|
||||
echo [1/6] Checking Docker...
|
||||
where docker >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo Docker Desktop was not found in PATH.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [2/6] Starting mysql, redis and minio...
|
||||
docker compose up -d mysql redis minio
|
||||
if errorlevel 1 (
|
||||
echo Failed to start docker services.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%ROOT%backend\.env" (
|
||||
echo Missing backend\.env
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set "PYTHON_CMD="
|
||||
where py >nul 2>nul
|
||||
if not errorlevel 1 set "PYTHON_CMD=py -3"
|
||||
|
||||
if not defined PYTHON_CMD (
|
||||
where python >nul 2>nul
|
||||
if not errorlevel 1 set "PYTHON_CMD=python"
|
||||
)
|
||||
|
||||
if not defined PYTHON_CMD (
|
||||
echo Python was not found in PATH.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%ROOT%backend\.venv\Scripts\python.exe" (
|
||||
echo [3/6] Creating backend virtual environment...
|
||||
call %PYTHON_CMD% -m venv "%ROOT%backend\.venv"
|
||||
if errorlevel 1 (
|
||||
echo Failed to create backend virtual environment.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [4/6] Installing backend dependencies...
|
||||
call "%ROOT%backend\.venv\Scripts\python.exe" -m pip install --disable-pip-version-check -r "%ROOT%backend\requirements.txt"
|
||||
if errorlevel 1 (
|
||||
echo Failed to install backend dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
) else (
|
||||
echo [3/6] Backend virtual environment already exists.
|
||||
)
|
||||
|
||||
if not exist "%ROOT%node_modules" (
|
||||
echo [5/6] Installing frontend dependencies...
|
||||
call npm install
|
||||
if errorlevel 1 (
|
||||
echo Failed to install frontend dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
) else (
|
||||
echo [5/6] Frontend dependencies already exist.
|
||||
)
|
||||
|
||||
echo [6/6] Starting backend and unified frontend...
|
||||
start "AIVideo Backend" cmd /k "cd /d ""%ROOT%backend"" && ""%ROOT%backend\.venv\Scripts\python.exe"" -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000"
|
||||
start "AIVideo Frontend" cmd /k "cd /d ""%ROOT%"" && npm run dev"
|
||||
|
||||
echo.
|
||||
echo User UI: http://localhost:3000
|
||||
echo Admin UI: http://localhost:3000/admin/login
|
||||
echo API: http://localhost:8000
|
||||
echo.
|
||||
echo Two windows have been opened for backend and frontend.
|
||||
pause
|
||||
Reference in New Issue
Block a user