#!/bin/sh set -eu ROOT=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) cd "$ROOT" . "$(dirname "$0")/_lib.sh" if [ ! -f .env ]; then cp .env.example .env fi bash scripts/bootstrap-pki.sh export DOCKER_BUILDKIT=1 export COMPOSE_DOCKER_CLI_BUILD=1 $COMPOSE up -d postgres redis rabbitmq openbao otel-collector loki tempo for _ in $(seq 1 60); do $COMPOSE ps postgres redis rabbitmq 2>/dev/null | grep -q healthy && break || true sleep 2 done sleep 5 bash scripts/bootstrap-openbao.sh $COMPOSE up -d broker-gw $COMPOSE run --rm --build s3-config-init $COMPOSE up -d --build s3 sleep 8 $COMPOSE run --rm --build migrate $COMPOSE up -d --build --scale "api=${API_REPLICAS}" worker $COMPOSE up -d --build --force-recreate --scale "api=${API_REPLICAS}" api worker $COMPOSE up -d lb prometheus grafana wait_lb_ready 300 || { $COMPOSE logs --tail=60 api worker lb broker-gw otel-collector openbao >&2 exit 1 } $COMPOSE ps echo "lab7 stack ready at https://127.0.0.1:${LB_PORT}"