feat: implement lab3 load balancing and idempotency

This commit is contained in:
Fedoroff
2026-10-27 20:34:22 +03:00
parent 0ab3a341aa
commit 35ae6f722e
43 changed files with 3045 additions and 42 deletions
+2
View File
@@ -0,0 +1,2 @@
docker compose --env-file .env restart -t 2 postgres redis api1 api2 lb
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
set -eu
docker compose --env-file .env restart -t 2 postgres redis api1 api2 lb >/dev/null
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
set -eu
docker compose --env-file .env up -d --no-deps api1 api2 >/dev/null
+4
View File
@@ -0,0 +1,4 @@
param([string]$Target = $env:TARGET_INSTANCE_ID)
if ($Target -notin @('api1','api2')) { throw "TARGET_INSTANCE_ID must be api1 or api2" }
docker compose --env-file .env stop -t 1 $Target
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID required}"
case "$TARGET_INSTANCE_ID" in
api1|api2) docker compose --env-file .env stop -t 1 "$TARGET_INSTANCE_ID" >/dev/null ;;
*) echo "Unknown instance alias" >&2; exit 2 ;;
esac