feat: добавить API, compose, nginx и отчёт для лабораторной 3

Co-authored-by: aider (deepseek/deepseek-chat) <aider@aider.chat>
This commit is contained in:
Evgeny Bushkov
2026-11-06 00:22:31 +03:00
co-authored by aider
parent d8ba046033
commit 158dc10344
26 changed files with 1110 additions and 13 deletions
+18
View File
@@ -14,3 +14,21 @@ while [ "$i" -lt 60 ]; do
done
echo "api did not become ready" >&2
exit 1
#!/bin/sh
set -eu
# Restart API replicas and PostgreSQL preserving volumes and data.
# Does NOT remove volumes, does NOT re-seed, does NOT print credentials.
cd "$(dirname "$0")/.."
docker compose --env-file .env restart postgres
docker compose --env-file .env restart api-1 api-2
# Wait for readiness through the LB.
i=0
while [ $i -lt 60 ]; do
if curl -fsS http://localhost:8080/health/ready >/dev/null 2>&1; then
exit 0
fi
i=$((i+1))
sleep 1
done
echo "readiness timeout" >&2
exit 1
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
set -eu
# Stop exactly one API replica identified by TARGET_INSTANCE_ID (api-1 or api-2).
# Leaves it stopped; does not touch DB/LB/volumes.
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
cd "$(dirname "$0")/.."
case "$TARGET_INSTANCE_ID" in
api-1|api-2) ;;
*) echo "unknown TARGET_INSTANCE_ID: $TARGET_INSTANCE_ID" >&2; exit 2 ;;
esac
docker compose --env-file .env stop "$TARGET_INSTANCE_ID"
exit 0