26 lines
759 B
Batchfile
26 lines
759 B
Batchfile
@echo off
|
|
rem Full restart of LB, all API replicas and PostgreSQL, volumes are preserved (Windows). No secrets are printed.
|
|
setlocal
|
|
cd /d "%~dp0.." || exit /b 1
|
|
|
|
docker compose stop lb api postgres >nul 2>&1
|
|
if errorlevel 1 exit /b 1
|
|
docker compose start postgres >nul 2>&1
|
|
if errorlevel 1 exit /b 1
|
|
|
|
set /a tries=0
|
|
:waitpg
|
|
docker compose exec -T postgres sh -c "pg_isready -q -U $POSTGRES_USER -d $POSTGRES_DB" >nul 2>&1
|
|
if not errorlevel 1 goto pgready
|
|
set /a tries+=1
|
|
if %tries% GEQ 45 exit /b 1
|
|
rem ping instead of timeout: timeout fails when stdin is redirected (as in tests/resilience.py)
|
|
ping -n 2 127.0.0.1 >nul
|
|
goto waitpg
|
|
|
|
:pgready
|
|
docker compose start api >nul 2>&1
|
|
if errorlevel 1 exit /b 1
|
|
docker compose start lb >nul 2>&1
|
|
exit /b %errorlevel%
|