forked from mtusi2026/mtusi2026lab3
feat: implement lab3 load balancing and idempotency
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
docker compose --env-file .env restart -t 2 postgres redis api1 api2 lb
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
docker compose --env-file .env restart -t 2 postgres redis api1 api2 lb >/dev/null
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
docker compose --env-file .env up -d --no-deps api1 api2 >/dev/null
|
||||
@@ -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 }
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user