#!/usr/bin/env bash # Orchestrates the Phase 5B ยง18 self-paced dress rehearsal: brings up the real dev stack, # bootstraps an owner, runs test-phase5b-selfpaced-rehearsal.js, tears down. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/../../../platform" export PROVISIONER_SHARED_SECRET="${PROVISIONER_SHARED_SECRET:-rehearsal-shared-secret-not-for-production}" export INTEGRATION_SHARED_SECRET="${INTEGRATION_SHARED_SECRET:-dev-integration-secret-not-for-production}" docker compose -f docker-compose.dev.yml up -d --build cleanup() { echo "==> Tearing down" docker ps -aq --filter "name=rootnode-lab-" | xargs -r docker rm -f >/dev/null 2>&1 || true docker network ls --filter "name=rootnode-lab-net-" --format "{{.Name}}" | xargs -r -n1 docker network rm >/dev/null 2>&1 || true docker compose -f docker-compose.dev.yml down >/dev/null 2>&1 || true } trap cleanup EXIT echo "==> Waiting for the stack" for _ in $(seq 1 60); do curl -sf http://localhost:4300/healthz >/dev/null 2>&1 && curl -sf http://localhost:4200/healthz >/dev/null 2>&1 && break sleep 2 done echo "==> Bootstrapping the rehearsal owner" ( cd api && PLATFORM_DB_URL=postgres://postgres:postgres@localhost:5433/rootnode_platform \ node bootstrap-owner.js p5b-rehearsal-owner@rootnode.test "P5B Rehearsal Owner" 'RehearsalPass!2026' ) echo "==> Running the rehearsal" OWNER_EMAIL=p5b-rehearsal-owner@rootnode.test OWNER_PASSWORD='RehearsalPass!2026' \ INTEGRATION_KEY="$INTEGRATION_SHARED_SECRET" \ node ../infra/scripts/drills/test-phase5b-selfpaced-rehearsal.js