add lab3
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
docker compose restart postgres
|
||||
docker compose up -d --wait postgres
|
||||
docker compose restart api-a api-b load_balancer
|
||||
docker compose up -d --wait api-a api-b load_balancer
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
for service in api-a api-b; do
|
||||
container="$(docker compose ps -q "$service")"
|
||||
[ -n "$container" ] || continue
|
||||
hostname="$(docker inspect --format '{{.Config.Hostname}}' "$container")"
|
||||
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
|
||||
docker compose stop "$service"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf '%s\n' 'TARGET_INSTANCE_ID does not match a running API replica' >&2
|
||||
exit 2
|
||||
Reference in New Issue
Block a user