Реализация ЛР 3 на оценку 3: HAProxy, 2 реплики API, идемпотентность, evidence

This commit is contained in:
2026-11-10 01:26:52 +03:00
parent 0ab3a341aa
commit de55dd1d8a
29 changed files with 2032 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi-lab3-api-1 mtusi-messenger:lab3 "sh -c 'exec uvicorn…" api About an hour ago Exited (0) 28 seconds ago
mtusi-lab3-api-2 mtusi-messenger:lab3 "sh -c 'exec uvicorn…" api About an hour ago Up About an hour (healthy) 8080/tcp
mtusi-lab3-lb-1 haproxy:3.0.7-alpine "docker-entrypoint.s…" lb About an hour ago Up About an hour 127.0.0.1:8080->8080/tcp
mtusi-lab3-migrate-1 mtusi-messenger:lab3 "python -m src.migra…" migrate About an hour ago Exited (0) About an hour ago
mtusi-lab3-postgres-1 postgres:16.6-alpine "docker-entrypoint.s…" postgres About an hour ago Up About an hour (healthy) 5432/tcp
mtusi-lab3-valkey-1 valkey/valkey:8.0.1-alpine "docker-entrypoint.s…" valkey About an hour ago Up About an hour (healthy) 6379/tcp
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 122, "failed_attempts": 0, "first_recovery_seconds": 2.036}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+7
View File
@@ -0,0 +1,7 @@
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi-lab3-api-1 mtusi-messenger:lab3 "sh -c 'exec uvicorn…" api 2 hours ago Up 58 seconds (healthy) 8080/tcp
mtusi-lab3-api-2 mtusi-messenger:lab3 "sh -c 'exec uvicorn…" api 2 hours ago Exited (0) 21 seconds ago
mtusi-lab3-lb-1 haproxy:3.0.7-alpine "docker-entrypoint.s…" lb About an hour ago Up About an hour 127.0.0.1:8080->8080/tcp
mtusi-lab3-migrate-1 mtusi-messenger:lab3 "python -m src.migra…" migrate 2 hours ago Exited (0) 58 seconds ago
mtusi-lab3-postgres-1 postgres:16.6-alpine "docker-entrypoint.s…" postgres About an hour ago Up About an hour (healthy) 5432/tcp
mtusi-lab3-valkey-1 valkey/valkey:8.0.1-alpine "docker-entrypoint.s…" valkey 2 hours ago Up About an hour (healthy) 6379/tcp
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 121, "failed_attempts": 0, "first_recovery_seconds": 1.569}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+2
View File
@@ -0,0 +1,2 @@
5 x-instance-id: 98cca609117d
5 x-instance-id: bb44a95c7f25
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+7
View File
@@ -0,0 +1,7 @@
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi-lab3-api-1 mtusi-messenger:lab3 "sh -c 'exec uvicorn…" api 16 minutes ago Up 16 minutes (healthy) 8080/tcp
mtusi-lab3-api-2 mtusi-messenger:lab3 "sh -c 'exec uvicorn…" api 16 minutes ago Up 16 minutes (healthy) 8080/tcp
mtusi-lab3-lb-1 haproxy:3.0.7-alpine "docker-entrypoint.s…" lb About a minute ago Up About a minute 127.0.0.1:8080->8080/tcp
mtusi-lab3-migrate-1 mtusi-messenger:lab3 "python -m src.migra…" migrate 16 minutes ago Exited (0) About a minute ago
mtusi-lab3-postgres-1 postgres:16.6-alpine "docker-entrypoint.s…" postgres 12 minutes ago Up 12 minutes (healthy) 5432/tcp
mtusi-lab3-valkey-1 valkey/valkey:8.0.1-alpine "docker-entrypoint.s…" valkey 16 minutes ago Up 16 minutes (healthy) 6379/tcp
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.