forked from mtusi2026/mtusi2026lab3
Лабораторная 3: реализован стенд с балансировщиком и идемпотентностью
This commit is contained in:
@@ -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())
|
||||
Reference in New Issue
Block a user