chore: refresh evidence

This commit is contained in:
2026-11-01 18:05:27 +03:00
parent 252ebd017a
commit 5e4342ce8b
10 changed files with 366 additions and 369 deletions
+39 -39
View File
@@ -1,6 +1,6 @@
# Отказы зависимостей, ошибки LB, expiry
# date: 2026-11-01T14:27:40Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:57:16Z
# commit: 252ebd0
## 1. Redis остановлен: вход и Bearer через PostgreSQL; logout — 503 без отзыва (токен остаётся действующим)
$ docker compose stop redis
@@ -9,9 +9,9 @@ $ docker compose stop redis
$ python3 scripts/probe.py logout
register -> 201
login -> 201 expires_at: 2026-11-01T15:27:41.083Z
login -> 201 expires_at: 2026-11-01T15:57:17.123Z
GET /api/v1/users/me -> 200
DELETE /api/v1/auth/sessions/current -> 503 {"error": {"code": "unavailable", "message": "session cache unavailable", "request_id": "7aff0b0d-d263-4bad-ae24-534ed11e5885"}}
DELETE /api/v1/auth/sessions/current -> 503 {"error": {"code": "unavailable", "message": "session cache unavailable", "request_id": "98fedb58-4eb5-4e13-a7cb-e6469a78d258"}}
GET /api/v1/users/me -> 200
$ docker compose start redis
@@ -25,7 +25,7 @@ $ docker compose start redis
## 2. Redis снова доступен: logout отзывает токен на всех репликах
$ python3 scripts/probe.py logout
register -> 201
login -> 201 expires_at: 2026-11-01T15:27:46.084Z
login -> 201 expires_at: 2026-11-01T15:57:21.659Z
GET /api/v1/users/me -> 200
DELETE /api/v1/auth/sessions/current -> 204
GET /api/v1/users/me -> 401
@@ -39,10 +39,10 @@ $ python3 scripts/probe.py status GET /health/live
GET /health/live (anonymous) -> 200 {"status": "ok"}
$ python3 scripts/probe.py status GET /api/v1/chats Bearer unknown-token
GET /api/v1/chats (Bearer unknown-token) -> 503 {"error": {"code": "unavailable", "message": "database unavailable", "request_id": "084e5aa0-f8c4-44c2-91a6-5672ab0fe7f9"}}
GET /api/v1/chats (Bearer unknown-token) -> 503 {"error": {"code": "unavailable", "message": "database unavailable", "request_id": "0ff1f01f-8cd5-40f7-b590-02e64814442f"}}
$ python3 scripts/probe.py status GET /api/v1/users/me
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "f041cada-528c-4d13-bf1e-fefc33ec422e"}}
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "3bbc22fc-5459-4c57-af1f-d63e72844729"}}
$ docker compose start postgres
Container messenger-lab3-secrets-init-1 Starting
@@ -57,13 +57,13 @@ ready
## 4. Все реплики API остановлены: LB отвечает 503 в формате ошибки контракта
$ docker compose stop api
Container messenger-lab3-api-11 Stopping
Container messenger-lab3-api-12 Stopping
Container messenger-lab3-api-12 Stopped
Container messenger-lab3-api-11 Stopped
Container messenger-lab3-api-13 Stopping
Container messenger-lab3-api-14 Stopping
Container messenger-lab3-api-14 Stopped
Container messenger-lab3-api-13 Stopped
$ python3 scripts/probe.py status GET /api/v1/users/me
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "4e1d1184-174b-47c6-9406-6d5e3e7457de"}}
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "1f889229-367b-4fa7-8ca1-2c1cda2dce86"}}
$ docker compose start api
Container messenger-lab3-secrets-init-1 Starting
@@ -78,47 +78,47 @@ $ docker compose start api
Container messenger-lab3-migrate-1 Started
Container messenger-lab3-migrate-1 Waiting
Container messenger-lab3-migrate-1 Exited
Container messenger-lab3-api-12 Starting
Container messenger-lab3-api-12 Started
Container messenger-lab3-api-11 Starting
Container messenger-lab3-api-11 Started
Container messenger-lab3-api-14 Starting
Container messenger-lab3-api-14 Started
Container messenger-lab3-api-13 Starting
Container messenger-lab3-api-13 Started
$ python3 scripts/probe.py ready
ready
## 5. Живая, но неготовая реплика: PostgreSQL отклоняет подключения только от одной API (pg_hba reject)
target=b446d5242566 ip=172.25.0.6
$ docker exec b446d5242566 node -e let n=0;const g=p=>require('http').get('http://127.0.0.1:8080'+p,r=>{console.log(p,r.statusCode);r.resume();if(++n===2)process.exit(0)});g('/health/live');g('/health/ready')
target=dfa1f6b6a59a ip=172.25.0.6
$ docker exec dfa1f6b6a59a node -e let n=0;const g=p=>require('http').get('http://127.0.0.1:8080'+p,r=>{console.log(p,r.statusCode);r.resume();if(++n===2)process.exit(0)});g('/health/live');g('/health/ready')
/health/live 200
/health/ready 503
$ python3 scripts/probe.py instances 10
register -> 201
login -> 201 expires_at: 2026-11-01T15:28:12.845Z
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
login -> 201 expires_at: 2026-11-01T15:57:47.146Z
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
Server api/api2 is UP, reason: Layer7 check passed, code: 200, check duration: 2ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 4ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Server api/api1 is UP, reason: Layer7 check passed, code: 200, check duration: 2ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 6ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
### доступ возвращён: реплика снова готова и получает запросы
$ python3 scripts/probe.py instances 6
register -> 201
login -> 201 expires_at: 2026-11-01T15:28:17.742Z
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: b446d5242566
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: b446d5242566
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: b446d5242566
login -> 201 expires_at: 2026-11-01T15:57:52.149Z
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: dfa1f6b6a59a
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: dfa1f6b6a59a
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: dfa1f6b6a59a
## 6. Expiry: реплики пересозданы с SESSION_TTL_SECONDS=2
$ sh -c docker exec $(docker compose ps -q api | head -1) printenv SESSION_TTL_SECONDS
@@ -126,7 +126,7 @@ $ sh -c docker exec $(docker compose ps -q api | head -1) printenv SESSION_TTL_S
$ python3 scripts/probe.py expiry 2
register -> 201
login -> 201 expires_at: 2026-11-01T14:28:30.603Z
login -> 201 expires_at: 2026-11-01T14:58:04.884Z
GET /api/v1/users/me (fresh) -> 200
GET /api/v1/users/me (after 3s) -> 401