two api-replicas with LB-nginx
This commit is contained in:
+99
-3
@@ -1,5 +1,101 @@
|
||||
# Доказательства
|
||||
# Доказательства лабораторной 3
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
Прогон от 04.11.2026, автор: Григорян Илья Мурадович, БПИ2303. Цель — оценка 4.
|
||||
Команды выполнялись на незакоммиченном рабочем дереве поверх commit
|
||||
`f20b751207ed9948bfcdab829c458a4af122d611`, а не на чистом состоянии этого commit.
|
||||
Состав исполняемого кода и конфигурации закреплён в [source-sha256.txt](source-sha256.txt).
|
||||
Документация не включена в этот fingerprint; её подготовка продолжалась после тестов.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
## Артефакты
|
||||
|
||||
| Файл | Содержание |
|
||||
| --- | --- |
|
||||
| [run.json](run.json) | Время прогона, базовый commit, версии Docker/Compose/Python, оборудование, параметры, лимиты и команды. |
|
||||
| [test-output.txt](test-output.txt) | Реальный stdout/stderr полного `test-grade4`: 156 pytest, smoke, конкурентные повторы, persistence, failover, SIGTERM, rolling и остановка каждой реплики. Абсолютный путь checkout заменён на `<repository>`. |
|
||||
| [nginx-output.txt](nginx-output.txt) | Реальный вывод отдельного `test-nginx`, включая gzip, ограничение частоты и DNS. |
|
||||
| [metrics.json](metrics.json) | Машиночитаемые строки метрик и состояний реплик из полного вывода, без пересчёта чисел. |
|
||||
| [source-sha256.txt](source-sha256.txt) | SHA-256 исходников, скриптов, тестов и конфигурации, использованных при запуске. Проверка: `sha256sum -c evidence/source-sha256.txt`. |
|
||||
| [cleanup.txt](cleanup.txt) | Итоговая проверка удаления ресурсов лабораторной; conserver и его данные сохранены. |
|
||||
|
||||
Результаты относятся только к этому прогону и составу файлов. После изменения кода,
|
||||
окружения или ресурсов их нужно получить заново. Ниже приведён способ повторения;
|
||||
старые численные значения при новом запуске не обязаны совпасть.
|
||||
|
||||
## Как повторить
|
||||
|
||||
Нужны Docker, Compose и Python 3.12 с зависимостями проекта. Из корня:
|
||||
|
||||
```sh
|
||||
test -f .env || cp .env.example .env
|
||||
make prepare-secrets PYTHON=.venv/bin/python
|
||||
make test-grade4 PYTHON=.venv/bin/python
|
||||
make test-nginx PYTHON=.venv/bin/python
|
||||
```
|
||||
|
||||
Существующий `.env` не заменяется. Пароли находятся в `secrets/`, а не в артефактах.
|
||||
`test-grade4` создаёт отдельный проект `mtusi-messenger-lab3-test` с двумя API,
|
||||
PostgreSQL, Redis, migrate и Nginx. Вход — localhost:18080, PostgreSQL:15432,
|
||||
Redis:16379. Фактические параметры этого запуска перечислены в `run.json`.
|
||||
В конце, включая ошибку, тестовые контейнеры, сеть и volumes удаляются.
|
||||
|
||||
## Что измерялось
|
||||
|
||||
1. Контракт и OpenAPI; 156 pytest с реальными PostgreSQL и Redis, включая реальный
|
||||
restart Redis. Собственные тесты используют отдельную БД `<DB_NAME>_test`
|
||||
и Redis DB 15; API стенда использует свою основную БД и Redis DB 0.
|
||||
2. Публичный HTTP smoke, 24 одновременных повтора одного ключа восемью потоками
|
||||
через Nginx, restart всех компонентов с сохранением volumes и существующей
|
||||
сессии, публичный failover.
|
||||
3. Проверка фактических Docker CPU/RAM, портов, read-only секретов и окружения.
|
||||
Пароли не считываются в вывод inspect; аудит проверяет имена переменных/монтирований.
|
||||
4. SIGTERM одной API: незавершённый POST удерживается PostgreSQL advisory lock,
|
||||
сигнал отправляется процессу, проверяются ready=503/live=200/новая работа=503.
|
||||
Через 1,2 с блокировка освобождается; исходный POST получает 201. Проверяются
|
||||
выход без OOM/SIGKILL, бюджет <8 с и наличие сообщения в истории. API восстановлена.
|
||||
5. Rolling: два клиента пишут в общий чат, timeout 2 с, пауза 80 мс после каждой
|
||||
попытки, одна секунда до и после обновления. Новая метка `API_BUILD_REVISION`
|
||||
даёт новый образ с прежним бизнес-кодом. Сборка одна, `alembic upgrade head`
|
||||
вызван один раз без ожидающих новых миграций. Перед каждой остановкой проверяются
|
||||
две другие здоровые API; в конце оба старых контейнера и образ API заменены.
|
||||
6. Отказ каждой из двух актуальных API: два клиента, закрытый цикл без заданного
|
||||
arrival rate, 2 с прогрева, остановка выбранной API с timeout 8 с, 10 с после
|
||||
завершения hook. При ошибке пауза 100 мс, ключ сохраняется до успешного ответа.
|
||||
Перед следующим отказом предыдущая API восстановлена и отвечает через LB.
|
||||
Состояния `before`, `stopped`, `restored` записаны для каждой цели.
|
||||
7. После обновления и отказов прочитана полная история: все подтверждённые ID
|
||||
присутствуют, текстовые метки не дублируются. Nginx отдельно проверен временными
|
||||
HTTP-backend без данных мессенджера, включая третью реплику через DNS без reload.
|
||||
|
||||
RPS rolling = успешные ответы запросов, начатых в интервале обновления / длительность
|
||||
этого интервала. Его p95 относится к этим успешным запросам. Счётчик ошибок rolling
|
||||
охватывает всё время работы двух клиентов, включая секунду до и после.
|
||||
RPS failover = число успешных ответов / время от запуска клиентов до последнего
|
||||
успешного завершения. Это ответы, а не обязательно число новых уникальных строк:
|
||||
ответ на повтор ключа также считается успешным. `first_recovery_seconds` — время
|
||||
от начала hook до первого завершения успешного POST, начатого после конца hook.
|
||||
Показатель включает длительность команды остановки, а не только сетевой простой.
|
||||
|
||||
Ошибки разделены на `http_429` (ограничитель), `http_503` (временная недоступность),
|
||||
`connection` и `contract`; в успешном прогоне последние две категории отсутствовали
|
||||
в rolling и последовательном failover. Нельзя приписывать все ошибки отказу API:
|
||||
профиль также достигает ограничителя Nginx 50 запросов/с с burst=100.
|
||||
|
||||
## Ресурсы и границы
|
||||
|
||||
| Контейнер | CPU | RAM |
|
||||
| --- | ---: | ---: |
|
||||
| PostgreSQL | 1 | 512 MiB |
|
||||
| Redis | 0,5 | 512 MiB |
|
||||
| API, каждый | 1 | 512 MiB |
|
||||
| migrate | 0,5 | 256 MiB |
|
||||
| Nginx | 0,5 | 128 MiB |
|
||||
|
||||
Обычно работают две API, при обновлении временно три. Пулы БД: 5 + 10 на API,
|
||||
до 45 соединений на три API, не считая миграций и диагностики. Redis: AOF,
|
||||
appendfsync always, maxmemory 256 MiB, noeviction. Нагрузка синтетическая, один
|
||||
прогон на одном хосте. Это не поиск предельного RPS, не отказ хоста, диска или
|
||||
хранилища и не доказательство совместимости произвольных будущих миграций.
|
||||
|
||||
В доказательства не включены `.env`, пароли, токены сессий, cookies, приватные
|
||||
ключи, дампы БД и тела сообщений. При добавлении новых артефактов сохраняйте это
|
||||
правило; большие логи и бинарные traces храните отдельно по правилам преподавателя.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Cleanup at 2026-11-04T14:08:42.159262+00:00
|
||||
$ docker compose --env-file .env -p mtusi-messenger-lab3 -f compose.yaml down --volumes --remove-orphans
|
||||
|
||||
$ docker compose --env-file .env -p mtusi-messenger-lab3-test -f compose.yaml -f compose.test.yaml down --volumes --remove-orphans
|
||||
|
||||
Containers:
|
||||
conserver: Exited (128) 4 weeks ago
|
||||
Volumes:
|
||||
test_conserver-logs
|
||||
Images:
|
||||
mtusi-messenger:lab3
|
||||
conserver:latest
|
||||
postgres:16.10-bookworm
|
||||
nginx:1.28.0-alpine
|
||||
redis:7.4.2-bookworm
|
||||
Project containers and volumes: absent.
|
||||
Existing .env and secrets/: preserved.
|
||||
conserver and its volume: preserved.
|
||||
Only main Compose images and conserver image retained.
|
||||
@@ -0,0 +1,147 @@
|
||||
[
|
||||
{
|
||||
"observed_instances_before": 2,
|
||||
"successful_writes": 108,
|
||||
"failed_attempts": 4,
|
||||
"first_recovery_seconds": 1.845
|
||||
},
|
||||
{
|
||||
"scenario": "rolling update",
|
||||
"replacements": 2,
|
||||
"migration_runs": 1,
|
||||
"successful_writes": 456,
|
||||
"failed_attempts": 13,
|
||||
"errors_by_kind": {
|
||||
"http_503": 13
|
||||
},
|
||||
"elapsed_seconds": 23.627,
|
||||
"successful_rps": 19.3,
|
||||
"p95_seconds": 0.043
|
||||
},
|
||||
{
|
||||
"scenario": "replica_failure",
|
||||
"phase": "before",
|
||||
"target": "bcbb50630124",
|
||||
"replicas": [
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"scenario": "replica_failure",
|
||||
"phase": "stopped",
|
||||
"target": "bcbb50630124",
|
||||
"replicas": [
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"running": false,
|
||||
"health": "unhealthy"
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"scenario": "replica_failure",
|
||||
"phase": "restored",
|
||||
"target": "bcbb50630124",
|
||||
"replicas": [
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"successful_writes": 773,
|
||||
"failed_attempts": 83,
|
||||
"errors_by_kind": {
|
||||
"http_429": 67,
|
||||
"http_503": 16
|
||||
},
|
||||
"elapsed_seconds": 13.853,
|
||||
"successful_rps": 55.8,
|
||||
"first_recovery_seconds": 1.8
|
||||
},
|
||||
{
|
||||
"scenario": "replica_failure",
|
||||
"phase": "before",
|
||||
"target": "df18f4fb557f",
|
||||
"replicas": [
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"scenario": "replica_failure",
|
||||
"phase": "stopped",
|
||||
"target": "df18f4fb557f",
|
||||
"replicas": [
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"running": false,
|
||||
"health": "unhealthy"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"scenario": "replica_failure",
|
||||
"phase": "restored",
|
||||
"target": "df18f4fb557f",
|
||||
"replicas": [
|
||||
{
|
||||
"instance": "bcbb50630124",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"running": true,
|
||||
"health": "healthy"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"instance": "df18f4fb557f",
|
||||
"successful_writes": 773,
|
||||
"failed_attempts": 116,
|
||||
"errors_by_kind": {
|
||||
"http_429": 99,
|
||||
"http_503": 17
|
||||
},
|
||||
"elapsed_seconds": 13.875,
|
||||
"successful_rps": 55.71,
|
||||
"first_recovery_seconds": 1.782
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,11 @@
|
||||
.venv/bin/python scripts/check_nginx.py
|
||||
nginx version: nginx/1.28.0
|
||||
PASS: nginx -t и балансировка двух реплик
|
||||
PASS: gzip 2060 → 61 байт, содержимое сохранено
|
||||
PASS: JSON и заголовки ошибки API передаются без подмены
|
||||
PASS: отправленный POST не повторяется на другой реплике
|
||||
PASS: лимит вернул 391 ответов 429; health доступен
|
||||
PASS: третья реплика обнаружена через DNS без reload nginx
|
||||
PASS: отказ реплики, первое успешное чтение через 0.207 с
|
||||
PASS: недоступность всех backend возвращает JSON 503
|
||||
PASS: JSON access log содержит время backend и результат лимита
|
||||
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"started_at_utc": "2026-11-04T13:59:48.203542+00:00",
|
||||
"base_commit": "f20b751207ed9948bfcdab829c458a4af122d611",
|
||||
"worktree_dirty": true,
|
||||
"source_manifest_sha256": "73187c6a987b4fce648f79198a89a99b238bc5aa0617339d662b09c86cb423cb",
|
||||
"runtime_profile": {
|
||||
"API_REPLICAS": "2",
|
||||
"APP_PORT": "8080",
|
||||
"LB_HOST_PORT": "8080",
|
||||
"DB_HOST_PORT": "15432",
|
||||
"REDIS_HOST_PORT": "16379",
|
||||
"MAX_MESSAGES": "100000",
|
||||
"MAX_IN_FLIGHT": "16",
|
||||
"DB_POOL_SIZE": "5",
|
||||
"DB_MAX_OVERFLOW": "10",
|
||||
"DB_POOL_TIMEOUT_SECONDS": "3",
|
||||
"DB_CONNECT_TIMEOUT_SECONDS": "3",
|
||||
"DB_STATEMENT_TIMEOUT_MS": "5000",
|
||||
"REDIS_MAX_CONNECTIONS": "20",
|
||||
"REDIS_POOL_TIMEOUT_SECONDS": "1",
|
||||
"REDIS_CONNECT_TIMEOUT_SECONDS": "1",
|
||||
"REDIS_SOCKET_TIMEOUT_SECONDS": "0.5",
|
||||
"SESSION_TTL_SECONDS": "3600",
|
||||
"IDEMPOTENCY_TTL_SECONDS": "86400",
|
||||
"SHUTDOWN_DRAIN_SECONDS": "1",
|
||||
"GRACEFUL_SHUTDOWN_TIMEOUT_SECONDS": "5",
|
||||
"READINESS_TIMEOUT_SECONDS": "2"
|
||||
},
|
||||
"commands": [
|
||||
"make test-grade4 PYTHON=.venv/bin/python",
|
||||
"make test-nginx PYTHON=.venv/bin/python"
|
||||
],
|
||||
"local_python": "Python 3.12.14",
|
||||
"docker_compose": "5.6.1",
|
||||
"docker_host": {
|
||||
"server_version": "29.9.2",
|
||||
"os": "linux",
|
||||
"architecture": "x86_64",
|
||||
"cpus": 8,
|
||||
"memory_bytes": 16400363520,
|
||||
"kernel": "7.2.11-zen1-1-zen"
|
||||
},
|
||||
"host_cpu_model": "Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz",
|
||||
"finished_at_utc": "2026-11-04T14:07:19.867546+00:00",
|
||||
"results": {
|
||||
"test_grade4_exit_code": 0,
|
||||
"test_nginx_exit_code": 0,
|
||||
"pytest_passed": 156,
|
||||
"pytest_seconds": 42.3
|
||||
},
|
||||
"container_limits": {
|
||||
"postgres": {
|
||||
"cpus": 1,
|
||||
"memory_mib": 512
|
||||
},
|
||||
"redis": {
|
||||
"cpus": 0.5,
|
||||
"memory_mib": 512
|
||||
},
|
||||
"api_each": {
|
||||
"cpus": 1,
|
||||
"memory_mib": 512
|
||||
},
|
||||
"migrate": {
|
||||
"cpus": 0.5,
|
||||
"memory_mib": 256
|
||||
},
|
||||
"nginx": {
|
||||
"cpus": 0.5,
|
||||
"memory_mib": 128
|
||||
}
|
||||
},
|
||||
"test_profile": {
|
||||
"project": "mtusi-messenger-lab3-test",
|
||||
"compose_files": [
|
||||
"compose.yaml",
|
||||
"compose.test.yaml"
|
||||
],
|
||||
"lb_host_port": 18080,
|
||||
"api_replicas": 2,
|
||||
"test_postgres_port": 15432,
|
||||
"test_redis_port": 16379,
|
||||
"pytest_redis_db": 15,
|
||||
"rolling": {
|
||||
"clients": 2,
|
||||
"timeout_seconds": 2,
|
||||
"pause_after_attempt_seconds": 0.08,
|
||||
"warmup_seconds": 1,
|
||||
"after_update_seconds": 1,
|
||||
"image_change": "API_BUILD_REVISION label; same business code",
|
||||
"pending_migrations": false
|
||||
},
|
||||
"failover_each": {
|
||||
"clients": 2,
|
||||
"timeout_seconds": 2,
|
||||
"warmup_seconds": 2,
|
||||
"after_stop_hook_seconds": 10,
|
||||
"error_backoff_seconds": 0.1,
|
||||
"stop_timeout_seconds": 8
|
||||
}
|
||||
},
|
||||
"installed_local_packages": {
|
||||
"fastapi": "0.143.3",
|
||||
"uvicorn": "0.54.0",
|
||||
"pydantic": "2.14.1",
|
||||
"pydantic-settings": "2.16.0",
|
||||
"SQLAlchemy": "2.1.4",
|
||||
"alembic": "1.20.0",
|
||||
"asyncpg": "0.32.0",
|
||||
"redis": "8.1.0",
|
||||
"pytest": "9.1.1",
|
||||
"pytest-asyncio": "1.4.1"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"tag": "mtusi-messenger:lab3",
|
||||
"id": "sha256:9eb260e40dd7704888aa66098ff9514a13da1dcb28afb46eb4c8b2bd75b1f413",
|
||||
"repo_digests": [
|
||||
"mtusi-messenger@sha256:9eb260e40dd7704888aa66098ff9514a13da1dcb28afb46eb4c8b2bd75b1f413"
|
||||
],
|
||||
"revision": "verification-81ccd2376178"
|
||||
},
|
||||
{
|
||||
"tag": "postgres:16.10-bookworm",
|
||||
"id": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
|
||||
"repo_digests": [
|
||||
"postgres@sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74"
|
||||
],
|
||||
"revision": null
|
||||
},
|
||||
{
|
||||
"tag": "redis:7.4.2-bookworm",
|
||||
"id": "sha256:fbdbaea47b9ae4ecc2082ecdb4e1cea81e32176ffb1dcf643d422ad07427e5d9",
|
||||
"repo_digests": [
|
||||
"redis@sha256:fbdbaea47b9ae4ecc2082ecdb4e1cea81e32176ffb1dcf643d422ad07427e5d9"
|
||||
],
|
||||
"revision": null
|
||||
},
|
||||
{
|
||||
"tag": "nginx:1.28.0-alpine",
|
||||
"id": "sha256:30f1c0d78e0ad60901648be663a710bdadf19e4c10ac6782c235200619158284",
|
||||
"repo_digests": [
|
||||
"nginx@sha256:30f1c0d78e0ad60901648be663a710bdadf19e4c10ac6782c235200619158284"
|
||||
],
|
||||
"revision": null
|
||||
}
|
||||
],
|
||||
"manifest_scope": "Executable sources, tests and configuration; excludes documentation, .env and secrets."
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
ce3cd59eb07b3f3cfb85c19c9dfcba82aeca3b4231d523c6a2c85d28bf2b66f9 .env.example
|
||||
2ea849842e877eca40e5dd853a5299a81be15fa414476fbfe434ac487f59ec1f Dockerfile
|
||||
dd18f3dabac00cf562e2d4eec2615a3b7e37bb5343b47f1eb0f0fb49c2a11b7e Makefile
|
||||
274785e9cfb1af978fcdf254f3b9c93847216d9183cf290098f857f174f43b41 alembic.ini
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 app/__init__.py
|
||||
5839d94c506f0362278a4f85bca8346774f5f323112963dd3830e525a069fb61 app/__main__.py
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 app/core/__init__.py
|
||||
f66f54d722c4bde445e402c5f80fc2c826dd02a35b49a7ef8e78183aae577e30 app/core/config.py
|
||||
e9ae2ff773dfd0f3f0515b6fd29c8b23820cd1a3b83e2b99dccaca8f0ddf8a40 app/core/database.py
|
||||
da4dcfda3dabeb595aa7b917d321e794074676fd258828c84be4322b917ac43c app/core/instance.py
|
||||
aedcaa71c991f0147603bad32bbd105ebdc689cfc388d274e83ce693f32ba534 app/core/lifecycle.py
|
||||
69056a1660683bc5086b558b38660c304650d261f760248499ace499031c7e4e app/core/redis.py
|
||||
290d97e3551e1661feb04debc0272c9c91fe7636d1771de9e78055c64e23933c app/core/request_capacity.py
|
||||
e1f3f08c65cf17ea24574682050e0435d5a5c22b7b2194ea40aad941716871b4 app/core/request_id.py
|
||||
7717e9ea31415dd9803f14e6290e709bfb63aa38cb1524db9b04881cf2512256 app/core/security.py
|
||||
6acb951afe3a628d9bd9ae25ab8c321b8debb0f481c745881a7af1f48e620c90 app/domain/__init__.py
|
||||
d7026b518eb7f3f054a5aaa5307171db031718c0c70555d40c03e7aabc9f539d app/domain/auth.py
|
||||
33f20c63c3fdcb491adb2153a147e822e0a16de4a5f634355a6d2db514aaa668 app/domain/chats.py
|
||||
a2bc40d13dca0215bc817c8781038586827d8b5601dd916b18c0f472e28e17b3 app/domain/idempotency.py
|
||||
f127324bf34b423b33dd0e446ab049740ee6364785b34a805556331b8e324c22 app/domain/messages.py
|
||||
df9aa94fab247467fe5f6fa030bdf3e587b5749060f0c3d663f5bd3e57e8dfe9 app/domain/pagination.py
|
||||
31ec7ba4c47ae6c31661eb8b4231efe9f561784c3bc0555c7d9b9bde804fe88f app/domain/users.py
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 app/endpoints/__init__.py
|
||||
0cb1dded40038b80eafabcb288f43b1b7fcac1d8d41898e657eb9b62afaa2aab app/endpoints/auth.py
|
||||
2fc7d2b4f155e1cdba6d02ac157b1c2d74932c930d6cba7ac93c0a811af1494a app/endpoints/chats.py
|
||||
1980c53bce1e96c801bb0ad49c6d35957c07f3e50db1804475a67f07a7d96082 app/endpoints/dependencies.py
|
||||
2e1606211c689a8959041433bcb4b70e4c5fd1647038fe391eb5435b9d07ddca app/endpoints/health.py
|
||||
a6424660ce901defac67b5d66a882f8051a531328fc6d4aa998c407ca276c4e3 app/endpoints/messages.py
|
||||
13fe05bec4b4b0a9e7a2f90756065bf97e257601b119a71465b24fc0144f3bf9 app/endpoints/users.py
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 app/errors/__init__.py
|
||||
355a762e6dc81dd844671982a68d944fa10d9631ef91cd3afd9312f2cffb8ec2 app/errors/exceptions.py
|
||||
5e5616f8bb0b1b3fdaaba69f2e9248de79ebd3c1d0d123c9c613aa106e691960 app/errors/handlers.py
|
||||
21a24f61599534856d11c5ce574111ce8a1d395f06aef5618558c4e54afefbc0 app/main.py
|
||||
116ec0d604cecd9306827761bfa2290a87dc99c6c5519bfd5b618f0de6d6dddf app/models/__init__.py
|
||||
548f10800483dd91a4d321c3cef845f3f5b126169a50474bf846f78839fdb43e app/models/base.py
|
||||
7076f06111aca1e3845a8515112fa1302da9bd331cf79c699259c91d3d23c9cf app/models/chat.py
|
||||
dfb64d43bd519d06f09e479eab4bdd277f317fdb92e206fdedf0afbed1fe18ad app/models/chat_member.py
|
||||
35eaa453501b48d178d7b17fd22314783386b64951cbb518b450698ba65219f8 app/models/counter.py
|
||||
693039c889d92ebdb5ef3fc6833278f59b4aa88f802b4726b9c3bf441f83fb18 app/models/idempotency_key.py
|
||||
9bbf725b6eae51e23e4fc71aea3dbc137d5a275b069e7e378351773297a7559f app/models/message.py
|
||||
b5f1bbdc4370e2671427c8d7590aba58916b1981f225c4734d8bdeb944b1539a app/models/user.py
|
||||
7c9d4ef216ed8b027ddfbad9746147cf0fed6463baf396b7244bd9b1b286e9ee app/schemas/__init__.py
|
||||
9a3f14dc23e704d9fdce681ae7187a6b95638f9736711a8edef245fbbaea3eb6 app/schemas/base.py
|
||||
2111aef9c942b34d02afa99da6d23a1d5ca0f6cfd75a1c0ebfb2ba85a29584b1 app/schemas/chat.py
|
||||
defae263397458b7b7d1acdb3dfa2b774c00e5ec3981c8b098748d1586777fb6 app/schemas/message.py
|
||||
617bcba33dcb01e4f66a50b5c425ebcbc1aef1c6148148f0eb862a7743bcf9b6 app/schemas/session.py
|
||||
01fc238693c3686595cc910fadce6200e9753d0c4a0397ff327d8a0c937dc4df app/schemas/user.py
|
||||
33296ca85924a22644fda573be072e5b810a284b939469580445925a85f0b5e9 app/storage/__init__.py
|
||||
e479c8be1f56030fc4faaa74417fb959fb2c1f0c57f72974df8b538ff1209a7b app/storage/chats.py
|
||||
2a9243ad419e7cc48ce0c6da13053df6773bea53a2342eb408cb3ebe2455f921 app/storage/idempotency.py
|
||||
f196fc426771cc9a628d25f466113badd1de1f123e9b3adc3cff9dc96e49824d app/storage/messages.py
|
||||
aeb6851a54d71051912ad588c47de3d5a3d92d518a0a198dbb3e283dd64837c7 app/storage/sessions.py
|
||||
46a0562d557ac96bd49f9975ff25ac8cce7f7f803b8c280d1d0bf2463ebfdaec app/storage/types.py
|
||||
f9dc7df7affda7144991944ff20a1ae5b372921b14fd391afa189d0e613dc45e app/storage/users.py
|
||||
46f25ac85ff2a20a52cddf67b38c69f340bf007a355cd2e18c46e6aab9d22757 compose.test.yaml
|
||||
2a40970440a7c3fcdcb621a00ba9e55b3d5cae4c8da8cf2b8bef3b70dc29f263 compose.yaml
|
||||
d88506d8590ce549fd43dda7eea87f040dfff128af071f457b87e17df6282f5a infra/nginx/nginx.conf
|
||||
9d4e7faeab76340dadda9916430048c32c849fb2bf02206653ea827e3304b666 infra/redis/redis.conf
|
||||
0f6fe080f5f7cd1d77da5f8ee9989874e9617bd7f4830f90b91978a5bfb88056 infra/redis/start-redis.sh
|
||||
37dce514d48aa4e021e063f6ebb8fb3e34275f6a76f51926d789802cad8dfa75 migrations/env.py
|
||||
4ae6aee859bcbcdb238d4cb2fa35419503d7a1d5a3caaffd0f0d2e9e9dce2937 migrations/versions/49d2c947a3f1_add_idempotency_keys.py
|
||||
cbe0b9e7584f26c0b859936a2584c147fe3f1ffaa9eb55c85ff753ecb10aa5a4 migrations/versions/abd273076068_add_counters.py
|
||||
dd0e8073817e3a08bae19b17d4d502aa0dca0639f95d0b08caaf0e5dce16f302 migrations/versions/db06fd3126ff_create_initial_schema.py
|
||||
92ce287c8eb0aa508e0efd4553650b4ebd2474d1987587d6467c26e316e6a547 pytest.ini
|
||||
4cefdb67007caf026d1613be7c519c01b4c8343db7c4f4b618677e01cf113525 requirements-dev.txt
|
||||
6f31c6f105a5774db02e970977bf2d26fbdba47dbb6e81836124816555d6d83f requirements.txt
|
||||
599958169a2b3c35b72b9b27f54d1c156032b2fadf041cc0e905bd49e48d8c60 scripts/__init__.py
|
||||
7c4402c2a6ab80d3b4676e1866d6ecc87b6daea14c080bcb9be9a7e8b959d671 scripts/check_contract.py
|
||||
22befc4a28b1a08452c769d66106d0a5b7fabc4edca7d5be1657cdf72824d899 scripts/check_grade4.py
|
||||
1ebdc8a4423305b6b972254e0b856b9381f7a5279aaa537a3c9d3cdb791adccf scripts/check_idempotency.py
|
||||
c95f74ebfec55b047424d65ed201519a79cd3292b9067fcf6913f5ac1bf3ab0b scripts/check_nginx.py
|
||||
0926fac2e73573a6e8b32c254bfc635132823aed9c4b429e91bf180e047bc32f scripts/deployment.py
|
||||
4cf255992270adfdaa0a3fd304050ed858b7a49d9e3c8856337a310cf59f8596 scripts/expiry_demo.sh
|
||||
21f2e3baa4d9615e0411edbecfbdc394d471b70b4f237d1e45557c9602b0ecad scripts/explain_history.py
|
||||
af3422b5b039583980599765cea8315546a1a3de80671f78c7c205faa2bac65f scripts/failover_all.py
|
||||
e06776d5e44eded34a7fc849ba4cabe955428cf9f924e077a48511656538e7b2 scripts/failure_demo.sh
|
||||
a5dcd78d708a7d1e69d92f56cb97e0a0a4f69577aac530d8ee195cd293dfc0cc scripts/prepare_secrets.py
|
||||
0328246ba75defbced992104e986fde973f63e3830d83251eced5953263e944b scripts/restart.example.sh
|
||||
442cb99a2a32e91f6348b18e2729e777e4f14acf82ed8aa899abdd1bf19ca4cc scripts/restart.sh
|
||||
60d48ba1c8050a79f8a3725a0ea7bba34dadba3bef0b86bd2d2e6a768e6ca7d5 scripts/rolling_update.py
|
||||
1bcf34394520b89d95b7605ec56675be799eea920e83cfbba306d5dc0a6d9811 scripts/stop-one.example.sh
|
||||
c78f3fee788c907764162069ee09e3bd043b3b3eb3823f5bbb8f84dd1ab5bed0 scripts/stop-one.sh
|
||||
4e981acbfc10dac58817bf922d5896e996798551fedc1b2385130e1cddb13d54 scripts/validate_openapi.py
|
||||
fa12e0945cc8d7b3fdfbf476fd6a140c0a8262bb6728a1fd360cac335922da61 student-tests/conftest.py
|
||||
8c11a6fbc9003c2d92225bfc676edfffe416e70d8b6972a864cf6c5c0b64c95b student-tests/helpers.py
|
||||
20cd1c8ea397fe558a9ded78723dd319cabe47f520a631375171c448a01b1de2 student-tests/test_auth.py
|
||||
f57751337441fbc909549d553cd32e20d7f7918dc42f2000c15f9ba2706349a4 student-tests/test_chats.py
|
||||
b9c2ed985bb2cf0261bfb928f0bcc2694c8980a5c55fea4c445d0ca410ca30c6 student-tests/test_concurrency.py
|
||||
b8c9a1f7535318b946adff13b11ac2459622a1a9b23962f0981d0fc7793de0c9 student-tests/test_constraints.py
|
||||
76b4fe648fd257eb603cfc06da76b59b783986f96a9b357bc87238210757ef34 student-tests/test_errors.py
|
||||
045203d83f8ff50e48b8fad4328dba7f12de8adffebef597efadfd40c79ed5c1 student-tests/test_failures.py
|
||||
2594b7bce03d36e6c32c1644e76f4d8f40e7099de6c687e13a74706e329bcefe student-tests/test_health.py
|
||||
edaf79363adb942f9501d933deb86e39aed558f32c1a73188ae2d18d088378ae student-tests/test_history_plan.py
|
||||
640a12067597a7e576d3db0fb6f9bbb14639a14d701f6a9b682ed97ad70cdf8e student-tests/test_idempotency.py
|
||||
722951c437488d0c5d63839d418b2456c37a40c9e8dc55a52c7e8ea3a4066c3c student-tests/test_instance.py
|
||||
e39e046d8fd85711682f43220cbeded8212f9870fb6475d32f946a56b7864332 student-tests/test_lifecycle.py
|
||||
71e48fab2816753b213603bd977c9c1babb2b540596cd3401c1e62a6f538a3b5 student-tests/test_limits.py
|
||||
cc040ae5ee2f196362fab4c7006711bf8d8c7f5e2f56acc8c74646ef2efb801d student-tests/test_messages.py
|
||||
834077f0541a2a939adc726342fba70c0b7da4b54cd8715709685a3ad23cc16c student-tests/test_migrations.py
|
||||
2c573efd6b0a6204a8bac483bb6e2594c565f2d32faa04ebc3540298eb02af2d student-tests/test_pagination.py
|
||||
cb981f15ad186faa2e1f8b6aecb7766eed66378b6db9dfc496dd1d76afc94b1b student-tests/test_sessions.py
|
||||
bf840d8dcb6094412b9e2947df4a0a3c3f32c5d80af9df19693ed5b52b9c8d6d student-tests/test_users.py
|
||||
851376079a214a655f6343bbc3f34b0e57192d8f7d84c33eb4e0a79a22d6a1bb tests/__init__.py
|
||||
8d50976fc7c7bbb81e88a152f613c61ab25eaf53dba33c6a9dfab19f868d546d tests/client.py
|
||||
6d3511ea719c7a7e841083e73d435c86dcbfd9f4e5c2a07d62eb9614b01d9933 tests/load.py
|
||||
1f96663a174b3978d24eff66f2741f5f8c9b788d3242261d37a972720c52788b tests/resilience.py
|
||||
52ac38eb343ff7d43e7543588e1da58ca06c9fce74b2b0d0bf0e4982bc23c1db tests/smoke.py
|
||||
@@ -0,0 +1,254 @@
|
||||
make[1]: Entering directory '<repository>'
|
||||
.venv/bin/python -m scripts.prepare_secrets
|
||||
Готов файл secrets/db_password
|
||||
Готов файл secrets/redis_password
|
||||
.venv/bin/python scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
make[1]: Leaving directory '<repository>'
|
||||
make[1]: Entering directory '<repository>'
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env up -d --build
|
||||
Image mtusi-messenger:lab3 Building
|
||||
Image mtusi-messenger:lab3 Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.17kB done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [migrate internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 797B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [api internal] load metadata for docker.io/library/python:3.12.15-slim-bookworm
|
||||
#3 DONE 1.6s
|
||||
|
||||
#4 [api internal] load .dockerignore
|
||||
#4 transferring context: 196B done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [migrate internal] load build context
|
||||
#5 transferring context: 9.54kB done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [api 1/8] FROM docker.io/library/python:3.12.15-slim-bookworm@sha256:6a0e06f5ba0b373d051aabd3fffb9b873f27f9a2a3a14bcbe37dee6f0e3bbc70
|
||||
#6 resolve docker.io/library/python:3.12.15-slim-bookworm@sha256:6a0e06f5ba0b373d051aabd3fffb9b873f27f9a2a3a14bcbe37dee6f0e3bbc70 0.1s done
|
||||
#6 resolve docker.io/library/python:3.12.15-slim-bookworm@sha256:6a0e06f5ba0b373d051aabd3fffb9b873f27f9a2a3a14bcbe37dee6f0e3bbc70 0.1s done
|
||||
#6 DONE 0.1s
|
||||
|
||||
#7 [api 3/8] RUN useradd --system --uid 10001 --no-create-home appuser
|
||||
#7 CACHED
|
||||
|
||||
#8 [api 2/8] WORKDIR /app
|
||||
#8 CACHED
|
||||
|
||||
#9 [api 4/8] COPY requirements.txt .
|
||||
#9 CACHED
|
||||
|
||||
#10 [api 5/8] RUN pip install -r requirements.txt
|
||||
#10 CACHED
|
||||
|
||||
#11 [api 6/8] COPY alembic.ini ./
|
||||
#11 CACHED
|
||||
|
||||
#12 [migrate 7/8] COPY migrations ./migrations
|
||||
#12 CACHED
|
||||
|
||||
#13 [api 8/8] COPY app ./app
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 [api] exporting to image
|
||||
#14 exporting layers
|
||||
#14 exporting layers 0.2s done
|
||||
#14 exporting manifest sha256:a38b66c8e8c9b12b9eab37bd5b9001417df363c0db1c134dd9a886f1b1d38db0 0.1s done
|
||||
#14 exporting config sha256:85fe2165395388f47b557b69d0bcd64f5ca03b55e357bdf82a61d574a1e9d0a1 0.1s done
|
||||
#14 exporting attestation manifest sha256:2566fe78ad8b26cb5663b995fc409959a46564667f75ca05ca0a7f9f27b66cb9
|
||||
#14 exporting attestation manifest sha256:2566fe78ad8b26cb5663b995fc409959a46564667f75ca05ca0a7f9f27b66cb9 0.1s done
|
||||
#14 exporting manifest list sha256:435908277c9d70ce7fe230dc31513387f06f3db8988a195098d73696063f3019 0.0s done
|
||||
#14 naming to docker.io/library/mtusi-messenger:lab3 0.0s done
|
||||
#14 unpacking to docker.io/library/mtusi-messenger:lab3
|
||||
#14 unpacking to docker.io/library/mtusi-messenger:lab3 0.1s done
|
||||
#14 DONE 0.6s
|
||||
|
||||
#15 [migrate] exporting to image
|
||||
#15 exporting layers 0.2s done
|
||||
#15 exporting manifest sha256:31fea3178ed4db5e71fcf6539c49c1d989201a9a161da75e6c7cdd462f629b20 0.0s done
|
||||
#15 exporting config sha256:9f951ee3892d23fe585ad14c06c3d35f7b7ad9c7c1b22f2552f60aa9737267f0 0.1s done
|
||||
#15 exporting attestation manifest sha256:a9852058a36e506388255dc54e4ed346c65721e78d66eb74902a12a7f2805971 0.1s done
|
||||
#15 exporting manifest list sha256:7e9d2b8b999e69f985a7f29c0e29d0189287c744dc76e9a2e1d761c4ebba33f2 0.0s done
|
||||
#15 naming to docker.io/library/mtusi-messenger:lab3 0.0s done
|
||||
#15 unpacking to docker.io/library/mtusi-messenger:lab3 0.1s done
|
||||
#15 DONE 0.5s
|
||||
|
||||
#16 [migrate] resolving provenance for metadata file
|
||||
#16 DONE 0.0s
|
||||
|
||||
#17 [api] resolving provenance for metadata file
|
||||
#17 DONE 0.0s
|
||||
Image mtusi-messenger:lab3 Built
|
||||
Image mtusi-messenger:lab3 Built
|
||||
Volume mtusi-messenger-lab3-test_pgdata Creating
|
||||
Network mtusi-messenger-lab3-test_default Creating
|
||||
Volume mtusi-messenger-lab3-test_pgdata Creating
|
||||
Network mtusi-messenger-lab3-test_default Creating
|
||||
Volume mtusi-messenger-lab3-test_redisdata Creating
|
||||
Volume mtusi-messenger-lab3-test_redisdata Creating
|
||||
Volume mtusi-messenger-lab3-test_pgdata Created
|
||||
Volume mtusi-messenger-lab3-test_pgdata Created
|
||||
Volume mtusi-messenger-lab3-test_redisdata Created
|
||||
Volume mtusi-messenger-lab3-test_redisdata Created
|
||||
Network mtusi-messenger-lab3-test_default Created
|
||||
Network mtusi-messenger-lab3-test_default Created
|
||||
Container mtusi-messenger-lab3-test-redis-1 Creating
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Creating
|
||||
Container mtusi-messenger-lab3-test-redis-1 Created
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Created
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Creating
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Created
|
||||
Container mtusi-messenger-lab3-test-api-2 Creating
|
||||
Container mtusi-messenger-lab3-test-api-1 Creating
|
||||
Container mtusi-messenger-lab3-test-api-1 Created
|
||||
Container mtusi-messenger-lab3-test-api-2 Created
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Creating
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Created
|
||||
Container mtusi-messenger-lab3-test-redis-1 Starting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Starting
|
||||
Container mtusi-messenger-lab3-test-redis-1 Started
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Started
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Starting
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Started
|
||||
Container mtusi-messenger-lab3-test-redis-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-redis-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Exited
|
||||
Container mtusi-messenger-lab3-test-api-2 Starting
|
||||
Container mtusi-messenger-lab3-test-api-2 Started
|
||||
Container mtusi-messenger-lab3-test-api-1 Starting
|
||||
Container mtusi-messenger-lab3-test-api-1 Started
|
||||
Container mtusi-messenger-lab3-test-api-2 Waiting
|
||||
Container mtusi-messenger-lab3-test-api-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-api-2 Healthy
|
||||
Container mtusi-messenger-lab3-test-api-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Starting
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Started
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env exec -T postgres sh -c 'createdb -U "$POSTGRES_USER" "$POSTGRES_DB"_test 2>&1 | grep -v "already exists"; true'
|
||||
make[1]: Leaving directory '<repository>'
|
||||
make[1]: Entering directory '<repository>'
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 DOCKER_TESTS=1 .venv/bin/python -m pytest -q
|
||||
........................................................................ [ 46%]
|
||||
........................................................................ [ 92%]
|
||||
............ [100%]
|
||||
156 passed in 42.30s
|
||||
.venv/bin/python tests/smoke.py --base-url "http://localhost:18080"
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
.venv/bin/python -m scripts.check_idempotency --base-url "http://localhost:18080"
|
||||
PASS: 24 concurrent replays, 2 replicas, one message
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env ps
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-messenger-lab3-test-api-1 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 54 seconds (healthy) 8080/tcp
|
||||
mtusi-messenger-lab3-test-api-2 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 54 seconds (healthy) 8080/tcp
|
||||
mtusi-messenger-lab3-test-nginx-1 nginx:1.28.0-alpine "/docker-entrypoint.…" nginx About a minute ago Up 48 seconds (healthy) 80/tcp, 127.0.0.1:18080->8080/tcp
|
||||
mtusi-messenger-lab3-test-postgres-1 postgres:16.10-bookworm "docker-entrypoint.s…" postgres About a minute ago Up About a minute (healthy) 127.0.0.1:15432->5432/tcp
|
||||
mtusi-messenger-lab3-test-redis-1 redis:7.4.2-bookworm "/bin/sh /usr/local/…" redis About a minute ago Up 6 seconds (healthy) 127.0.0.1:16379->6379/tcp
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 .venv/bin/python tests/resilience.py --mode persistence --action-script scripts/restart.sh --base-url "http://localhost:18080"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env ps
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-messenger-lab3-test-api-1 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 11 seconds (healthy) 8080/tcp
|
||||
mtusi-messenger-lab3-test-api-2 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 11 seconds (healthy) 8080/tcp
|
||||
mtusi-messenger-lab3-test-nginx-1 nginx:1.28.0-alpine "/docker-entrypoint.…" nginx About a minute ago Up 5 seconds (healthy) 80/tcp, 127.0.0.1:18080->8080/tcp
|
||||
mtusi-messenger-lab3-test-postgres-1 postgres:16.10-bookworm "docker-entrypoint.s…" postgres About a minute ago Up 17 seconds (healthy) 127.0.0.1:15432->5432/tcp
|
||||
mtusi-messenger-lab3-test-redis-1 redis:7.4.2-bookworm "/bin/sh /usr/local/…" redis About a minute ago Up 21 seconds (healthy) 127.0.0.1:16379->6379/tcp
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env ps
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-messenger-lab3-test-api-1 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 12 seconds (healthy) 8080/tcp
|
||||
mtusi-messenger-lab3-test-api-2 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 12 seconds (healthy) 8080/tcp
|
||||
mtusi-messenger-lab3-test-nginx-1 nginx:1.28.0-alpine "/docker-entrypoint.…" nginx About a minute ago Up 5 seconds (healthy) 80/tcp, 127.0.0.1:18080->8080/tcp
|
||||
mtusi-messenger-lab3-test-postgres-1 postgres:16.10-bookworm "docker-entrypoint.s…" postgres About a minute ago Up 17 seconds (healthy) 127.0.0.1:15432->5432/tcp
|
||||
mtusi-messenger-lab3-test-redis-1 redis:7.4.2-bookworm "/bin/sh /usr/local/…" redis About a minute ago Up 21 seconds (healthy) 127.0.0.1:16379->6379/tcp
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 .venv/bin/python tests/resilience.py --mode failover --action-script scripts/stop-one.sh --base-url "http://localhost:18080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 108, "failed_attempts": 4, "first_recovery_seconds": 1.845}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env ps -a api
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-messenger-lab3-test-api-1 mtusi-messenger:lab3 "python -m app" api About a minute ago Exited (0) 13 seconds ago
|
||||
mtusi-messenger-lab3-test-api-2 mtusi-messenger:lab3 "python -m app" api About a minute ago Up 28 seconds (healthy) 8080/tcp
|
||||
COMPOSE_PROJECT_NAME=mtusi-messenger-lab3-test COMPOSE_FILE=compose.yaml:compose.test.yaml LB_HOST_PORT=18080 DB_HOST_PORT=15432 REDIS_HOST_PORT=16379 docker compose --env-file .env up -d --wait api
|
||||
Container mtusi-messenger-lab3-test-api-2 Running
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Running
|
||||
Container mtusi-messenger-lab3-test-redis-1 Running
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Starting
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Started
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-redis-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-redis-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Exited
|
||||
Container mtusi-messenger-lab3-test-api-1 Starting
|
||||
Container mtusi-messenger-lab3-test-api-1 Started
|
||||
Container mtusi-messenger-lab3-test-redis-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-api-2 Waiting
|
||||
Container mtusi-messenger-lab3-test-api-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Waiting
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Exited
|
||||
Container mtusi-messenger-lab3-test-redis-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Healthy
|
||||
Container mtusi-messenger-lab3-test-api-2 Healthy
|
||||
Container mtusi-messenger-lab3-test-api-1 Healthy
|
||||
make[1]: Leaving directory '<repository>'
|
||||
PASS infrastructure: CPU/RAM, private API ports, scoped read-only file secrets, no environment passwords
|
||||
PASS SIGTERM: readiness 503, live 200, new work 503, in-flight POST 201; exit in 2.145s
|
||||
Сборка нового образа API
|
||||
Однократное применение совместимых миграций
|
||||
Заменена реплика 5955785d8b55
|
||||
Заменена реплика 23feb43a87e9
|
||||
Готово: 2 здоровых реплик нового образа
|
||||
{"scenario": "rolling update", "replacements": 2, "migration_runs": 1, "successful_writes": 456, "failed_attempts": 13, "errors_by_kind": {"http_503": 13}, "elapsed_seconds": 23.627, "successful_rps": 19.3, "p95_seconds": 0.043}
|
||||
{"scenario": "replica_failure", "phase": "before", "target": "bcbb50630124", "replicas": [{"instance": "bcbb50630124", "running": true, "health": "healthy"}, {"instance": "df18f4fb557f", "running": true, "health": "healthy"}]}
|
||||
{"scenario": "replica_failure", "phase": "stopped", "target": "bcbb50630124", "replicas": [{"instance": "bcbb50630124", "running": false, "health": "unhealthy"}, {"instance": "df18f4fb557f", "running": true, "health": "healthy"}]}
|
||||
{"scenario": "replica_failure", "phase": "restored", "target": "bcbb50630124", "replicas": [{"instance": "bcbb50630124", "running": true, "health": "healthy"}, {"instance": "df18f4fb557f", "running": true, "health": "healthy"}]}
|
||||
{"instance": "bcbb50630124", "successful_writes": 773, "failed_attempts": 83, "errors_by_kind": {"http_429": 67, "http_503": 16}, "elapsed_seconds": 13.853, "successful_rps": 55.8, "first_recovery_seconds": 1.8}
|
||||
{"scenario": "replica_failure", "phase": "before", "target": "df18f4fb557f", "replicas": [{"instance": "bcbb50630124", "running": true, "health": "healthy"}, {"instance": "df18f4fb557f", "running": true, "health": "healthy"}]}
|
||||
{"scenario": "replica_failure", "phase": "stopped", "target": "df18f4fb557f", "replicas": [{"instance": "bcbb50630124", "running": true, "health": "healthy"}, {"instance": "df18f4fb557f", "running": false, "health": "unhealthy"}]}
|
||||
{"scenario": "replica_failure", "phase": "restored", "target": "df18f4fb557f", "replicas": [{"instance": "bcbb50630124", "running": true, "health": "healthy"}, {"instance": "df18f4fb557f", "running": true, "health": "healthy"}]}
|
||||
{"instance": "df18f4fb557f", "successful_writes": 773, "failed_attempts": 116, "errors_by_kind": {"http_429": 99, "http_503": 17}, "elapsed_seconds": 13.875, "successful_rps": 55.71, "first_recovery_seconds": 1.782}
|
||||
PASS infrastructure: CPU/RAM, private API ports, scoped read-only file secrets, no environment passwords
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Stopping
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Stopped
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Removing
|
||||
Container mtusi-messenger-lab3-test-nginx-1 Removed
|
||||
Container mtusi-messenger-lab3-test-api-3 Stopping
|
||||
Container mtusi-messenger-lab3-test-api-4 Stopping
|
||||
Container mtusi-messenger-lab3-test-api-3 Stopped
|
||||
Container mtusi-messenger-lab3-test-api-3 Removing
|
||||
Container mtusi-messenger-lab3-test-api-3 Removed
|
||||
Container mtusi-messenger-lab3-test-api-4 Stopped
|
||||
Container mtusi-messenger-lab3-test-api-4 Removing
|
||||
Container mtusi-messenger-lab3-test-api-4 Removed
|
||||
Container mtusi-messenger-lab3-test-redis-1 Stopping
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Stopping
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Stopped
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Removing
|
||||
Container mtusi-messenger-lab3-test-migrate-1 Removed
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Stopping
|
||||
Container mtusi-messenger-lab3-test-redis-1 Stopped
|
||||
Container mtusi-messenger-lab3-test-redis-1 Removing
|
||||
Container mtusi-messenger-lab3-test-redis-1 Removed
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Stopped
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Removing
|
||||
Container mtusi-messenger-lab3-test-postgres-1 Removed
|
||||
Volume mtusi-messenger-lab3-test_redisdata Removing
|
||||
Volume mtusi-messenger-lab3-test_pgdata Removing
|
||||
Network mtusi-messenger-lab3-test_default Removing
|
||||
Volume mtusi-messenger-lab3-test_pgdata Removed
|
||||
Volume mtusi-messenger-lab3-test_redisdata Removed
|
||||
Network mtusi-messenger-lab3-test_default Removed
|
||||
Reference in New Issue
Block a user