forked from mtusi2026/mtusi2026lab2
17 lines
451 B
Batchfile
17 lines
451 B
Batchfile
@echo off
|
|
setlocal
|
|
cd /d "%~dp0\.."
|
|
docker compose --env-file .env restart postgres redis api
|
|
if errorlevel 1 exit /b 1
|
|
set /a i=0
|
|
:wait
|
|
docker compose --env-file .env exec -T api python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)" >nul 2>&1
|
|
if not errorlevel 1 exit /b 0
|
|
set /a i+=1
|
|
if %i% geq 60 (
|
|
echo restart: API not ready within 60s >&2
|
|
exit /b 1
|
|
)
|
|
timeout /t 1 /nobreak >nul
|
|
goto wait
|