Files
mtusi2026lab4/scripts/restart-one.sh
T

24 lines
420 B
Bash

#!/usr/bin/env bash
set -uo pipefail
REPLICA="${1:-api1}"
if [[ "$REPLICA" != "api1" && "$REPLICA" != "api2" ]]; then
echo "Usage: $0 [api1|api2]"
exit 1
fi
echo "=== Starting $REPLICA ==="
docker compose start "$REPLICA"
sleep 10
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