Лабораторная 3: реализован стенд с балансировщиком и идемпотентностью

This commit is contained in:
2026-11-22 16:11:18 +03:00
parent 0ab3a341aa
commit 752995515f
31 changed files with 1576 additions and 23 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
"""Restart all services preserving volumes — called by resilience.py persistence test."""
import subprocess
import sys
import os
def main():
# Change to repo root
repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.chdir(repo_root)
# Restart running services; up -d brings any stopped replica back up
result = subprocess.run(["docker", "compose", "restart", "--timeout", "15"], capture_output=True)
if result.returncode != 0:
print(f"docker compose restart failed: {result.stderr.decode()}", file=sys.stderr)
return 1
result = subprocess.run(["docker", "compose", "up", "-d"], capture_output=True)
if result.returncode != 0:
print(f"docker compose up -d failed: {result.stderr.decode()}", file=sys.stderr)
return 1
return 0
if __name__ == "__main__":
sys.exit(main())