feat: полная реализация

This commit is contained in:
2026-11-10 15:27:10 +03:00
parent 7734b222f8
commit 5cf99b5384
18 changed files with 935 additions and 211 deletions
+20 -4
View File
@@ -1,7 +1,23 @@
#!/bin/bash
#!/usr/bin/env bash
set -uo pipefail
REPLICA=$1
REPLICA="${1:-api1}"
docker compose start ${REPLICA}
if [[ "$REPLICA" != "api1" && "$REPLICA" != "api2" ]]; then
echo "Usage: $0 [api1|api2]"
exit 1
fi
echo "=== Starting $REPLICA ==="
docker compose start "$REPLICA"
sleep 10
curl -I http://localhost:8080/health
echo "=== Status ==="
docker compose ps
echo "=== Load balancing check ==="
for i in 1 2 3 4; do
curl -sI http://localhost:8080/health | grep -i x-instance-id
done
exit 0
+20 -4
View File
@@ -1,7 +1,23 @@
#!/bin/bash
#!/usr/bin/env bash
set -uo pipefail
REPLICA=$1
REPLICA="${1:-${TARGET_INSTANCE_ID:-api1}}"
docker compose stop ${REPLICA}
if [[ "$REPLICA" != "api1" && "$REPLICA" != "api2" ]]; then
echo "Usage: $0 [api1|api2] (or set TARGET_INSTANCE_ID)"
exit 1
fi
echo "=== Stopping $REPLICA ==="
docker compose stop "$REPLICA"
echo "=== Status ==="
docker compose ps
curl -I http://localhost:8080/health
echo "=== Health check ==="
curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:8080/health
echo "=== X-Instance-Id ==="
curl -sI http://localhost:8080/health | grep -i x-instance-id
exit 0