ЛР 3: масштабирование и отказоустойчивость API

This commit is contained in:
EgorAnti
2026-11-03 20:53:02 +03:00
parent 0ab3a341aa
commit 8105f90097
115 changed files with 5018 additions and 38 deletions
+16
View File
@@ -0,0 +1,16 @@
@echo off
setlocal EnableExtensions
cd /d "%~dp0\.."
set /a REPLICA_COUNT=0
for /f "usebackq delims=" %%C in (`docker compose --env-file .env ps -q api`) do set /a REPLICA_COUNT+=1
if %REPLICA_COUNT% LSS 2 exit /b 2
for /f "usebackq delims=" %%C in (`docker compose --env-file .env ps -q api`) do call :replace_one %%C
exit /b 0
:replace_one
docker stop --time 10 %1 >nul || exit /b 1
docker rm %1 >nul || exit /b 1
docker compose --env-file .env up -d --wait --wait-timeout 90 --no-deps --scale api=2 api >nul || exit /b 1
exit /b 0