Implement lab 2 messenger with PostgreSQL and Docker

This commit is contained in:
Ilia Sokolov
2026-10-13 01:01:44 +03:00
parent 65003b6119
commit e83ed9e747
22 changed files with 2453 additions and 15 deletions
+23
View File
@@ -0,0 +1,23 @@
@echo off
rem Full restart of API and PostgreSQL, volumes are preserved (Windows). No secrets are printed.
setlocal
cd /d "%~dp0.." || exit /b 1
docker compose stop 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
exit /b %errorlevel%