diff --git a/start_services.cmd b/start_services.cmd index 0c9c195..a3a312a 100644 --- a/start_services.cmd +++ b/start_services.cmd @@ -1,8 +1,55 @@ @echo off -REM Up the provider in windows -start ollama serve +REM Check if Docker is running +docker info >nul 2>&1 +if %ERRORLEVEL% neq 0 ( + echo Error: Docker daemon is not running or inaccessible. + echo Please ensure Docker Desktop is running. + exit /b 1 +) +REM Check if docker-compose.yml exists +if not exist docker-compose.yml ( + echo Error: docker-compose.yml not found in the current directory. + exit /b 1 +) + +REM Stop only containers in our project's network +echo Stopping project containers... +docker-compose down + +REM Start Ollama in the background +echo Starting Ollama... +start /B ollama serve + +REM First start python-env +echo Starting python-env service... +docker-compose up -d python-env +if %ERRORLEVEL% neq 0 ( + echo Error: Failed to start python-env container. + exit /b 1 +) + +REM Wait for python-env to be healthy +echo Waiting for python-env to be ready... +set /a count=0 +:wait_loop +docker inspect -f "{{.State.Running}}" python-env | findstr "true" >nul +if %ERRORLEVEL% neq 0 ( + set /a count+=1 + if %count% gtr 30 ( + echo Error: python-env failed to start properly after 30 seconds + docker-compose logs python-env + exit /b 1 + ) + timeout /t 1 /nobreak >nul + goto wait_loop +) + +echo python-env is ready! + +REM Now start the rest of the services +echo Starting remaining services... docker-compose up if %ERRORLEVEL% neq 0 ( echo Error: Failed to start containers. Check Docker logs with 'docker compose logs'.