Files
mtusi2026lab5/scripts/restart.bat
T

26 lines
869 B
Batchfile

@echo off
REM Windows-эквивалент scripts/restart.sh для lab4
REM Перезапускаем LB, обе реплики API, PostgreSQL, Redis, MinIO и s3_cleanup (тома сохраняются)
setlocal enableextensions
docker compose --env-file .env restart lb api postgres redis minio s3_cleanup >nul 2>&1
if errorlevel 1 (
docker restart mtuci-lb >nul 2>&1
docker restart mtuci-postgres >nul 2>&1
docker restart mtuci-redis >nul 2>&1
docker restart mtuci-minio >nul 2>&1
for /f "tokens=*" %%c in ('docker ps -a --filter "name=mtuci2026lab4_api" -q') do (
docker restart %%c >nul 2>&1
)
)
REM Ждём readiness до 90 секунд
set /a i=0
:wait_loop
if %i% geq 90 exit /b 1
curl -fsS http://localhost:8080/health/ready >nul 2>&1
if not errorlevel 1 exit /b 0
set /a i+=1
timeout /t 1 /nobreak >nul
goto wait_loop