16 lines
472 B
Bash
Executable File
16 lines
472 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
: "${TARGET_INSTANCE_ID:?Set TARGET_INSTANCE_ID to the API replica alias}"
|
|
containers=$(docker compose --env-file "${COMPOSE_ENV_FILE:-.env}" ps -q api)
|
|
for container in $containers; do
|
|
if [ "$(docker exec "$container" cat /tmp/lab-instance-id)" = "$TARGET_INSTANCE_ID" ]; then
|
|
docker stop -t 3 "$container"
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
echo "API replica $TARGET_INSTANCE_ID is not running in this project" >&2
|
|
exit 1
|