#!/bin/sh set -eu ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)" COMPOSE_FILE="$ROOT/docker-compose.yml" cd "$ROOT" docker compose -f "$COMPOSE_FILE" up -d --build collector python3 - <<'PY' import time import urllib.request url = "http://127.0.0.1:8081/healthz" deadline = time.time() + 30 last_error = "" while time.time() < deadline: try: with urllib.request.urlopen(url, timeout=5) as resp: print(f"collector ready: {resp.status} {resp.read().decode('utf-8', 'ignore')[:160]}") raise SystemExit(0) except Exception as exc: last_error = str(exc) time.sleep(1) print(f"collector start timeout: {last_error}") raise SystemExit(1) PY