Files
storyforge/scripts/start_business.sh

40 lines
945 B
Bash
Executable File

#!/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 n8n
python3 - <<'PY'
import time
import urllib.request
checks = [
("collector", "http://127.0.0.1:8081/healthz"),
("n8n", "http://127.0.0.1:5670/healthz"),
]
deadline = time.time() + 45
pending = dict(checks)
while pending and time.time() < deadline:
for name, url in list(pending.items()):
try:
with urllib.request.urlopen(url, timeout=5) as resp:
print(f"{name} ready: {resp.status}")
pending.pop(name, None)
except Exception:
pass
if pending:
time.sleep(1)
if pending:
print("startup timeout:", ", ".join(pending))
raise SystemExit(1)
PY
echo "business started"
echo "collector: http://127.0.0.1:8081/healthz"
echo "n8n: http://127.0.0.1:5670/healthz"