ЛР 7 — БВТ2302 — Макаренко — TLS и управление секретами

This commit is contained in:
2026-12-04 13:41:59 +03:00
parent 20afc2c790
commit 8a3cf7f2dd
55 changed files with 1991 additions and 24 deletions
+13
View File
@@ -0,0 +1,13 @@
import os
import subprocess
from pathlib import Path
root = Path(__file__).resolve().parents[1]
for service in ("api","api2"):
probe = "import urllib.request;print(urllib.request.urlopen('http://127.0.0.1:8080/health/live').headers['X-Instance-Id'])"
alias = subprocess.check_output(["docker","compose","exec","-T",service,"python","-c",probe],cwd=root,text=True).strip()
if alias == os.environ["TARGET_INSTANCE_ID"]:
subprocess.run(["docker","compose","stop",service],cwd=root,check=True)
break
else:
raise SystemExit("Replica not found")