"""Reproducible orchestration, scoped to this checkout and project.""" import argparse import json import os from pathlib import Path import ssl import subprocess import sys import time import urllib.request ROOT=Path(__file__).resolve().parents[1] os.chdir(ROOT) def compose(*args, **kwargs): return subprocess.run(['docker','compose',*args],check=True,**kwargs) def python(script,*args): subprocess.run([sys.executable,'-X','utf8',str(ROOT/script),*args],check=True) def env(): return dict(line.split('=',1) for line in (ROOT/'.env').read_text().splitlines() if '=' in line) def ready(): ctx=ssl.create_default_context(cafile=str(ROOT/'secrets/ca.crt')) endpoint='https://localhost:'+env()['HTTPS_PORT']+'/health/ready' deadline=time.monotonic()+120 while time.monotonic()