Skeleton contracts / contracts (pull_request) Blocked by required conditions
Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
39 lines
1.2 KiB
Bash
Executable File
39 lines
1.2 KiB
Bash
Executable File
# Shared Compose helpers for lab7.
|
|
ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
|
|
cd "$ROOT"
|
|
COMPOSE="docker compose -p gavrilenko-lab7 --env-file .env"
|
|
API_REPLICAS=$(grep -E '^API_REPLICAS=' .env 2>/dev/null | tail -n1 | cut -d= -f2- || true)
|
|
API_REPLICAS=${API_REPLICAS:-2}
|
|
LB_PORT=$(grep -E '^LB_HOST_PORT=' .env 2>/dev/null | tail -n1 | cut -d= -f2- || true)
|
|
LB_PORT=${LB_PORT:-8443}
|
|
CA_FILE="$ROOT/secrets/ca.crt"
|
|
|
|
wait_lb_ready() {
|
|
timeout_sec=${1:-120}
|
|
deadline=$(($(date +%s) + timeout_sec))
|
|
while :; do
|
|
if curl -fsS --cacert "$CA_FILE" "https://127.0.0.1:${LB_PORT}/health/ready" >/dev/null 2>&1 \
|
|
&& curl -fsS --cacert "$CA_FILE" "https://127.0.0.1:${LB_PORT}/health/live" >/dev/null 2>&1; then
|
|
return 0
|
|
fi
|
|
if [ "$(date +%s)" -ge "$deadline" ]; then
|
|
echo "timeout waiting for HTTPS LB on port ${LB_PORT}" >&2
|
|
$COMPOSE ps >&2 || true
|
|
return 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
}
|
|
|
|
warm_s3() {
|
|
i=0
|
|
while [ "$i" -lt 40 ]; do
|
|
if $COMPOSE exec -T s3 wget -qO- http://127.0.0.1:9000/healthz >/dev/null 2>&1 \
|
|
&& $COMPOSE exec -T s3 wget -qO- http://127.0.0.1:9333/dir/status 2>/dev/null | grep -q Url; then
|
|
break
|
|
fi
|
|
i=$((i + 1))
|
|
sleep 1
|
|
done
|
|
sleep 4
|
|
} |