"""One-host bootstrap. Only mtusi-lab7 Compose project is mutated.""" import os from pathlib import Path import subprocess import sys import time ROOT=Path(__file__).resolve().parents[1] def run(*args): subprocess.run(args,cwd=ROOT,check=True) def compose(*args): run('docker','compose','--env-file','.env',*args) if __name__=='__main__': run(sys.executable,'scripts/setup.py') compose('build','api1','s3','s3-bootstrap') compose('run','--rm','--no-deps','operator','python','scripts/pki.py') run(sys.executable,'scripts/setup.py') compose('run','--rm','volume-init') compose('up','-d','postgres','broker','s3','openbao') for attempt in range(20): try: compose('run','--rm','--no-deps','operator','python','scripts/bootstrap.py') compose('run','--rm','s3-bootstrap') break except subprocess.CalledProcessError: if attempt==19:raise time.sleep(2) compose('up','-d','--no-build') compose('up','-d','--no-deps','--force-recreate','api1-tls','api2-tls','broker-tls','otel-collector-tls','prometheus-tls','loki-tls','tempo-tls','grafana-tls') print('Lab7 deployed. Public CA: pki/ca.crt; endpoint https://localhost:8443. Wait for healthy APIs.')