forked from mtusi2026/mtusi2026lab7
30 lines
911 B
Python
30 lines
911 B
Python
#!/usr/bin/env python3
|
|
"""Bootstrap local secrets and start the lab7 stand."""
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def compose(*args):
|
|
subprocess.check_call(["docker", "compose", "--env-file", str(ROOT / ".env"), *args], cwd=ROOT)
|
|
|
|
|
|
def main() -> None:
|
|
subprocess.check_call([sys.executable, str(ROOT / "scripts" / "bootstrap.py")], cwd=ROOT)
|
|
compose("up", "-d", "--build", "--scale", "api=2")
|
|
ids = subprocess.check_output(
|
|
["docker", "compose", "--env-file", str(ROOT / ".env"), "ps", "-q", "api"],
|
|
cwd=ROOT,
|
|
text=True,
|
|
).split()
|
|
if len(ids) < 2:
|
|
raise SystemExit("expected two API replicas, got %s" % len(ids))
|
|
print("stand is up; wait for https://localhost:8443/health/ready")
|
|
print("CA_FILE=%s" % (ROOT / "secrets" / "certs" / "ca.crt"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|