#!/usr/bin/env bash # Orchestrates the Phase 6F Step 23 ROOT_ V1 multi-student pilot rehearsal: brings up the real # dev stack, bootstraps an owner, runs test-phase6f-root-v1-pilot.js (real cohort, real # classroom session, real disposable Labs, a real validation failure/fix, a real Lab reap), 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}" export LAB_IMAGE_REF="${LAB_IMAGE_REF:-rootnode-academy:test}" 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 p6f-pilot-owner@rootnode.test "P6F Pilot Owner" 'RehearsalPass!2026' ) echo "==> Running the rehearsal" OWNER_EMAIL=p6f-pilot-owner@rootnode.test OWNER_PASSWORD='RehearsalPass!2026' \ node ../infra/scripts/drills/test-phase6f-root-v1-pilot.js