Record level 3 evidence and fill in the report

Save sanitized outputs from a stand started from a clean state: the
clean clone run, smoke through the balancer, the stack view with the
replica hostnames, ports, networks, limits and the balancer server
states, the probe with two replicas behind one token and the eight
way race on one key, a failover run for each replica with the
container left exited and its graceful shutdown log, the hook
negative cases and the balancer answer without replicas, the
persistence run with StartedAt of every container before and after,
schema, migration rerun, KDF prefix, ignore rules, own tests and the
lab 2 stack fault tests through the balancer, plus the environment.

The report covers the clean clone start, the architecture, the
X-Instance-Id and idempotency decisions, the balancer settings, the
role to service table, the mapping of .env.example to the real
variables, one evidence row per level 3 criterion and the carried
lab 2 minimum, and the failure table for level 3.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Artyom
2026-10-28 11:53:11 +03:00
co-authored by Claude Opus 5.5
parent 0796e291b7
commit 957eabdfc3
17 changed files with 657 additions and 18 deletions
+27
View File
@@ -0,0 +1,27 @@
date: 2026-10-28T08:44:21Z commit: ae8fb0a
$ git clone … && git checkout solution/bpi2303-kostylev
$ make secrets
sh scripts/secrets.sh
создан secrets/postgres_password
создан secrets/database_url
создан secrets/cursor_secret
создан secrets/valkey_password
создан secrets/valkey.conf
создан secrets/cache_url
создан .env из .env.example
$ sed LB_HTTP_PORT=18083 LB_STATS_PORT=23083 .env # 8080 на этой машине занят стендами других лаб
$ docker compose --env-file .env config --quiet && echo valid
valid
$ make up # docker compose up -d --build --wait
Container mtusi2026lab3-postgres-1 Healthy
Container mtusi2026lab3-migrate-1 Exited
Container mtusi2026lab3-postgres-1 Healthy
Container mtusi2026lab3-migrate-1 Exited
Container mtusi2026lab3-valkey-1 Healthy
Container mtusi2026lab3-api-2 Healthy
Container mtusi2026lab3-api-1 Healthy
Container mtusi2026lab3-lb-1 Healthy
up --wait: 15 s
$ make test BASE_URL=http://localhost:18083
python3 tests/smoke.py --base-url "http://localhost:18083"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
+32
View File
@@ -0,0 +1,32 @@
date: 2026-10-28T08:48:40Z commit: 0796e29
host: Apple M4 Max, 16 CPU, 48 GiB RAM, macOS 15.1
docker: 28.3.2, VM: 16 CPU, 8217190400 bytes
compose: 2.38.2-desktop.1
images:
image: ${API_IMAGE:-mtusi-messenger:lab3}
image: haproxy:3.2.26-alpine@sha256:5893840576071e6217cd52ebdcc14f454c6f7a631056fa6f4e0f40d3cac4215b
image: postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b
image: valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS builder
COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS runtime
python in image: Python 3.14.7
haproxy: HAProxy version 3.2.26-3e0f11a 2026/10/14 - https://haproxy.org/
packages (uv.lock):
fastapi 0.141.1
uvicorn 0.54.0
uvicorn-worker 0.4.0
gunicorn 26.2.0
asyncpg 0.32.0
argon2-cffi 25.1.0
pydantic 2.13.5
pydantic-settings 2.15.0
dishka 1.10.1
structlog 26.1.0
redis 8.1.0
process users (service uid command):
api 10001 python
lb 99 haproxy
postgres 70 postgres
valkey 999 tini
valkey 999 valkey-server
+30
View File
@@ -0,0 +1,30 @@
date: 2026-10-28T08:47:27Z commit: 0796e29
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
302cfee8f673 running started=2026-10-28T08:47:14.781792917Z finished=2026-10-28T08:47:07.856233678Z
b582bd503bdd running started=2026-10-28T08:47:14.713654417Z finished=2026-10-28T08:47:07.971063344Z
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:18083"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 123, "failed_attempts": 0, "first_recovery_seconds": 1.212}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
== after: api replicas
302cfee8f673 exited started=2026-10-28T08:47:14.781792917Z finished=2026-10-28T08:47:28.65076559Z
b582bd503bdd running started=2026-10-28T08:47:14.713654417Z finished=2026-10-28T08:47:07.971063344Z
== stopped replica: 302cfee8f673; last log lines of its process
{"event":"service.stopped","level":"info","ts":"2026-10-28T08:47:28.456077Z"}
{"event":"Application shutdown complete.","level":"info","ts":"2026-10-28T08:47:28.456276Z"}
{"event":"Finished server process [8]","level":"info","ts":"2026-10-28T08:47:28.456336Z"}
{"event":"Worker (pid:7) was sent SIGTERM!","level":"info","ts":"2026-10-28T08:47:28.459598Z"}
{"event":"Worker (pid:8) was sent SIGTERM!","level":"info","ts":"2026-10-28T08:47:28.459755Z"}
{"event":"Shutting down: Master","level":"info","ts":"2026-10-28T08:47:28.568492Z"}
$ scripts/restore.sh
Container mtusi2026lab3-api-2 Running
Container mtusi2026lab3-api-1 Starting
Container mtusi2026lab3-api-1 Started
Container mtusi2026lab3-api-2 Waiting
Container mtusi2026lab3-api-1 Waiting
Container mtusi2026lab3-api-2 Healthy
Container mtusi2026lab3-api-1 Healthy
== after restore
302cfee8f673 running started=2026-10-28T08:47:43.609172555Z finished=2026-10-28T08:47:28.65076559Z
b582bd503bdd running started=2026-10-28T08:47:14.713654417Z finished=2026-10-28T08:47:07.971063344Z
+30
View File
@@ -0,0 +1,30 @@
date: 2026-10-28T08:47:47Z commit: 0796e29
== before: api replicas (hostname = X-Instance-Id), state, StartedAt, FinishedAt
302cfee8f673 running started=2026-10-28T08:47:43.609172555Z finished=2026-10-28T08:47:28.65076559Z
b582bd503bdd running started=2026-10-28T08:47:14.713654417Z finished=2026-10-28T08:47:07.971063344Z
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:18083"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 118, "failed_attempts": 0, "first_recovery_seconds": 1.726}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
== after: api replicas
302cfee8f673 running started=2026-10-28T08:47:43.609172555Z finished=2026-10-28T08:47:28.65076559Z
b582bd503bdd exited started=2026-10-28T08:47:14.713654417Z finished=2026-10-28T08:47:48.23612871Z
== stopped replica: b582bd503bdd; last log lines of its process
{"event":"service.stopped","level":"info","ts":"2026-10-28T08:47:47.995678Z"}
{"event":"Application shutdown complete.","level":"info","ts":"2026-10-28T08:47:47.995877Z"}
{"event":"Finished server process [8]","level":"info","ts":"2026-10-28T08:47:47.995948Z"}
{"event":"Worker (pid:7) was sent SIGTERM!","level":"info","ts":"2026-10-28T08:47:48.041499Z"}
{"event":"Worker (pid:8) was sent SIGTERM!","level":"info","ts":"2026-10-28T08:47:48.041664Z"}
{"event":"Shutting down: Master","level":"info","ts":"2026-10-28T08:47:48.152563Z"}
$ scripts/restore.sh
Container mtusi2026lab3-api-1 Running
Container mtusi2026lab3-api-2 Starting
Container mtusi2026lab3-api-2 Started
Container mtusi2026lab3-api-2 Waiting
Container mtusi2026lab3-api-1 Waiting
Container mtusi2026lab3-api-2 Healthy
Container mtusi2026lab3-api-1 Healthy
== after restore
302cfee8f673 running started=2026-10-28T08:47:43.609172555Z finished=2026-10-28T08:47:28.65076559Z
b582bd503bdd running started=2026-10-28T08:48:03.240408759Z finished=2026-10-28T08:47:48.23612871Z
+31
View File
@@ -0,0 +1,31 @@
date: 2026-10-28T08:49:44Z commit: 0796e29
$ make test-faults BASE_URL=http://localhost:18083 # тесты стенда лабы 2 через балансировщик
BASE_URL="http://localhost:18083" .venv/bin/pytest -m stack -v -s student-tests/stack
============================= test session starts ==============================
collected 10 items
student-tests/stack/test_faults.py гонка 50 регистраций: 201×1, 409×49
.чат с несуществующим участником: 400
.неверный пароль: 401 за 0.012 с
неизвестный пользователь: 401 за 0.012 с
.logout: 204, затем 401, повтор 401
.5 проверок токена: keyspace_hits 394 → 399
.valkey остановлен, действующий токен: 200 за 0.004 с
valkey остановлен, неизвестный токен: 401 за 0.002 с
valkey остановлен: ready 200, вход 201, выход 503
valkey снова запущен: повторный выход 204
.рестарт valkey: ключей 28 → 28
рестарт valkey: живой 200, отозванный 401
.FLUSHALL: живой 200, отозванный 401
.postgres остановлен, ready: 503 за 0.003 с
postgres остановлен, live: 200 за 0.001 с
postgres остановлен, me: 503 за 0.002 с
postgres остановлен, stranger: 503 за 0.003 с
postgres остановлен, login: 503 за 0.002 с
postgres остановлен, register: 503 за 0.014 с
postgres запущен: готовность через 0.3 с, прежний токен 200
.рестарт api: готовность через 0.5 с, токен 200
expires_at при входе 2026-10-28T09:49:55.730592Z, в БД после рестарта 2026-10-28T09:49:55.730592Z
.
============================= 10 passed in 11.99s ==============================
+33
View File
@@ -0,0 +1,33 @@
date: 2026-10-28T08:48:13Z commit: 0796e29
$ TARGET_INSTANCE_ID=<hostname реплики> scripts/stop-one.sh; echo exit=$? # seconds — длительность хука
target=302cfee8f673 exit=0 seconds=0.68
302cfee8f673 exited exit_code=0 oom=false
b582bd503bdd running exit_code=0 oom=false
$ scripts/restore.sh
exit=0
302cfee8f673 running
b582bd503bdd running
$ TARGET_INSTANCE_ID=no-such-replica scripts/stop-one.sh; echo exit=$?
no running api replica answers as no-such-replica
exit=3
$ docker compose ps --format '{{.Service}} {{.Name}} {{.Status}}' # ничего не остановлено
api mtusi2026lab3-api-1 Up 2 seconds (healthy)
api mtusi2026lab3-api-2 Up 13 seconds (healthy)
lb mtusi2026lab3-lb-1 Up About a minute (healthy)
postgres mtusi2026lab3-postgres-1 Up About a minute (healthy)
valkey mtusi2026lab3-valkey-1 Up About a minute (healthy)
$ scripts/stop-one.sh # без TARGET_INSTANCE_ID
scripts/stop-one.sh: line 3: TARGET_INSTANCE_ID: test provides target API instance alias
exit=1
$ docker compose stop api # обе реплики, LB остаётся
2
$ curl -i -H 'X-Request-Id: no-replica-1' http://localhost:18083/api/v1/users/me
HTTP/1.1 503 Service Unavailable
x-request-id: no-replica-1
content-length: 93
content-type: application/json
{"error":{"code":"unavailable","message":"No ready API replica","request_id":"no-replica-1"}}
$ make restore
exit=0
after restore: 200
+13
View File
@@ -0,0 +1,13 @@
date: 2026-10-28T08:48:44Z commit: 0796e29
$ psql -c "SELECT substring(password_hash from '^[$]argon2id[$]v=[0-9]+[$]m=[0-9]+,t=[0-9]+,p=[0-9]+[$]') AS kdf_prefix, count(*) AS users, min(length(password_hash)) AS hash_length FROM users GROUP BY 1"
kdf_prefix | users | hash_length
---------------------------------+-------+-------------
$argon2id$v=19$m=19456,t=2,p=1$ | 28 | 97
(1 row)
$ psql -c "SELECT octet_length(token_hash) AS stored_bytes, count(*) AS sessions FROM sessions GROUP BY 1"
stored_bytes | sessions
--------------+----------
32 | 26
(1 row)
+20
View File
@@ -0,0 +1,20 @@
{
"instances_one_token": {
"b582bd503bdd": 20,
"302cfee8f673": 20
},
"same_key": {
"parallel": 8,
"statuses": {
"201": 8
},
"instances": {
"b582bd503bdd": 4,
"302cfee8f673": 4
},
"identical_bodies": true,
"stored_copies": 1,
"other_body_status": 409
},
"pass": true
}
+15
View File
@@ -0,0 +1,15 @@
date: 2026-10-28T08:48:42Z commit: 0796e29
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM idempotency_keys) keys, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | keys | versions
-------+----------+-------+---------+----------+------+----------
28 | 26 | 10 | 20 | 497 | 497 | 2
(1 row)
$ make migrate
{"reason":"up to date","event":"migration.completed","level":"info","ts":"2026-10-28T08:48:43.862949Z"}
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM idempotency_keys) keys, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | keys | versions
-------+----------+-------+---------+----------+------+----------
28 | 26 | 10 | 20 | 497 | 497 | 2
(1 row)
+18
View File
@@ -0,0 +1,18 @@
date: 2026-10-28T08:47:06Z commit: 0796e29
== before: service hostname StartedAt status
api 302cfee8f673 2026-10-28T08:46:57.096571506Z running
api b582bd503bdd 2026-10-28T08:46:57.018519589Z running
lb 10cd61cb6cc5 2026-10-28T08:46:50.904998045Z running
migrate d7aac30f1875 2026-10-28T08:46:55.919807755Z exited
postgres f06fc06e6824 2026-10-28T08:46:50.659210753Z running
valkey 5f8773e8a7ad 2026-10-28T08:46:50.704690336Z running
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:18083"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
== after: service hostname StartedAt status
api 302cfee8f673 2026-10-28T08:47:14.781792917Z running
api b582bd503bdd 2026-10-28T08:47:14.713654417Z running
lb 10cd61cb6cc5 2026-10-28T08:47:08.587781136Z running
migrate d7aac30f1875 2026-10-28T08:47:13.605412347Z exited
postgres f06fc06e6824 2026-10-28T08:47:08.243716595Z running
valkey 5f8773e8a7ad 2026-10-28T08:47:08.381440386Z running
+135
View File
@@ -0,0 +1,135 @@
date: 2026-10-28T08:48:41Z commit: 0796e29
$ psql -c '\d+ users'
Table "public.users"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
---------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
username | text | | not null | | extended | | |
display_name | text | | not null | | extended | | |
password_hash | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"users_pkey" PRIMARY KEY, btree (id)
"users_username_key" UNIQUE CONSTRAINT, btree (username)
Check constraints:
"users_display_name_check" CHECK (char_length(display_name) >= 1 AND char_length(display_name) <= 100)
"users_password_hash_check" CHECK (password_hash ~~ '$argon2id$%'::text)
"users_username_format" CHECK (username ~ '^[a-z0-9_]{3,32}$'::text)
Referenced by:
TABLE "chat_members" CONSTRAINT "chat_members_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
TABLE "sessions" CONSTRAINT "sessions_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ sessions'
Table "public.sessions"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
token_hash | bytea | | not null | | extended | | |
user_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
expires_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"sessions_pkey" PRIMARY KEY, btree (token_hash)
"sessions_user_idx" btree (user_id)
Check constraints:
"sessions_check" CHECK (expires_at > created_at)
"sessions_token_hash_check" CHECK (octet_length(token_hash) = 32)
Foreign-key constraints:
"sessions_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ chats'
Table "public.chats"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
title | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
last_message_at | timestamp with time zone | | | | plain | | |
Indexes:
"chats_pkey" PRIMARY KEY, btree (id)
Check constraints:
"chats_title_check" CHECK (char_length(title) >= 1 AND char_length(title) <= 100)
Referenced by:
TABLE "chat_members" CONSTRAINT "chat_members_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ chat_members'
Table "public.chat_members"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------+--------------------------+-----------+----------+---------+---------+-------------+--------------+-------------
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
position | smallint | | not null | | plain | | |
chat_created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"chat_members_pkey" PRIMARY KEY, btree (chat_id, user_id)
"chat_members_user_idx" btree (user_id, chat_created_at, chat_id)
Check constraints:
"chat_members_position_check" CHECK ("position" >= 1 AND "position" <= 100)
Foreign-key constraints:
"chat_members_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
"chat_members_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
Referenced by:
TABLE "idempotency_keys" CONSTRAINT "idempotency_keys_chat_id_user_id_fkey" FOREIGN KEY (chat_id, user_id) REFERENCES chat_members(chat_id, user_id)
TABLE "messages" CONSTRAINT "messages_chat_id_sender_id_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
Access method: heap
$ psql -c '\d+ messages'
Table "public.messages"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
chat_id | uuid | | not null | | plain | | |
sender_id | uuid | | not null | | plain | | |
text | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"messages_pkey" PRIMARY KEY, btree (id)
"messages_history_idx" btree (chat_id, created_at, id)
Check constraints:
"messages_text_check" CHECK (char_length(text) >= 1 AND char_length(text) <= 4000)
Foreign-key constraints:
"messages_chat_id_sender_id_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
Referenced by:
TABLE "idempotency_keys" CONSTRAINT "idempotency_keys_message_id_fkey" FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ idempotency_keys'
Table "public.idempotency_keys"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
key | text | | not null | | extended | | |
fingerprint | bytea | | not null | | extended | | |
message_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"idempotency_keys_pkey" PRIMARY KEY, btree (chat_id, user_id, key)
Check constraints:
"idempotency_keys_fingerprint_check" CHECK (octet_length(fingerprint) = 32)
"idempotency_keys_key_check" CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'::text)
Foreign-key constraints:
"idempotency_keys_chat_id_user_id_fkey" FOREIGN KEY (chat_id, user_id) REFERENCES chat_members(chat_id, user_id)
"idempotency_keys_message_id_fkey" FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ schema_migrations'
Table "public.schema_migrations"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
version | text | | not null | | extended | | |
checksum | text | | not null | | extended | | |
applied_at | timestamp with time zone | | not null | now() | plain | | |
Indexes:
"schema_migrations_pkey" PRIMARY KEY, btree (version)
Access method: heap
$ psql -c 'SELECT version, left(checksum, 12), applied_at FROM schema_migrations'
version | checksum | applied_at
-----------------------+--------------+-------------------------------
0001_init | 9a13618f078a | 2026-10-28 08:44:57.30678+00
0002_idempotency_keys | d9159a355532 | 2026-10-28 08:44:57.312407+00
(2 rows)
+12
View File
@@ -0,0 +1,12 @@
date: 2026-10-28T08:48:44Z commit: 0796e29
$ git ls-files secrets .env backups volumes
(пусто: секретов, .env, дампов и volumes в Git нет)
$ git check-ignore -v secrets/database_url secrets/postgres_password .env backups/
.gitignore:5:secrets/ secrets/database_url
.gitignore:5:secrets/ secrets/postgres_password
.gitignore:2:.env .env
.gitignore:15:backups/ backups/
$ docker volume ls --filter name=mtusi2026lab3
DRIVER VOLUME NAME
local mtusi2026lab3_pgdata
local mtusi2026lab3_valkeydata
+4
View File
@@ -0,0 +1,4 @@
date: 2026-10-28T08:47:26Z commit: 0796e29
$ make test BASE_URL=http://localhost:18083
python3 tests/smoke.py --base-url "http://localhost:18083"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
+30
View File
@@ -0,0 +1,30 @@
date: 2026-10-28T08:48:39Z commit: 0796e29
$ docker compose --env-file .env config --quiet && echo valid
valid
$ docker compose ps --format '{{.Service}} {{.Name}} {{.Status}} {{.Ports}}'
api mtusi2026lab3-api-1 Up 8 seconds (healthy)
api mtusi2026lab3-api-2 Up 8 seconds (healthy)
lb mtusi2026lab3-lb-1 Up About a minute (healthy) 127.0.0.1:18083->8080/tcp, 127.0.0.1:23083->8404/tcp
postgres mtusi2026lab3-postgres-1 Up About a minute (healthy)
valkey mtusi2026lab3-valkey-1 Up About a minute (healthy)
$ docker compose config | grep -c container_name
0
$ docker compose port api 8080 # реплики не публикуют порт
no port 8080/tcp for container mtusi2026lab3-api-1:
$ docker inspect: hostname = X-Instance-Id, сети, лимиты CPU (nano) и памяти
api 302cfee8f673 /mtusi2026lab3-api-1 nets=mtusi2026lab3_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
api b582bd503bdd /mtusi2026lab3-api-2 nets=mtusi2026lab3_backend, cpus=1000000000 mem=536870912 user=10001:10001 ro=true
lb 10cd61cb6cc5 /mtusi2026lab3-lb-1 nets=mtusi2026lab3_backend,mtusi2026lab3_edge, cpus=1000000000 mem=134217728 user=haproxy ro=true
postgres f06fc06e6824 /mtusi2026lab3-postgres-1 nets=mtusi2026lab3_backend, cpus=2000000000 mem=1073741824 user=70:70 ro=false
valkey 5f8773e8a7ad /mtusi2026lab3-valkey-1 nets=mtusi2026lab3_backend, cpus=500000000 mem=134217728 user=999:1000 ro=false
$ curl LB stats: backend api, server status check
api1 UP L7OK 200
api2 UP L7OK 200
BACKEND UP
$ for i in 1..6: curl -D - http://127.0.0.1:18083/health/live | X-Instance-Id
x-instance-id: 302cfee8f673
x-instance-id: b582bd503bdd
x-instance-id: 302cfee8f673
x-instance-id: b582bd503bdd
x-instance-id: 302cfee8f673
x-instance-id: b582bd503bdd
+29
View File
@@ -0,0 +1,29 @@
date: 2026-10-28T08:49:27Z commit: 0796e29
$ make student-test # pytest без маркера stack, по файлам
============================= test session starts ==============================
testpaths: student-tests
collected 249 items / 10 deselected / 239 selected
student-tests/api/test_access.py ....... [ 2%]
student-tests/api/test_bounded_contexts.py .................. [ 10%]
student-tests/api/test_cache.py ..... [ 12%]
student-tests/api/test_concurrency.py ... [ 13%]
student-tests/api/test_consistency.py ........ [ 17%]
student-tests/api/test_events.py ....... [ 20%]
student-tests/api/test_idempotency.py ............... [ 26%]
student-tests/api/test_instance.py .... [ 28%]
student-tests/api/test_migrations.py ..... [ 30%]
student-tests/api/test_negative.py ..................................... [ 45%]
[ 45%]
student-tests/api/test_operability.py ............. [ 51%]
student-tests/api/test_pagination.py ................. [ 58%]
student-tests/api/test_pool.py .. [ 58%]
student-tests/api/test_sessions.py .................. [ 66%]
student-tests/api/test_timeout.py ...... [ 69%]
student-tests/api/test_wire_format.py .. [ 69%]
student-tests/unit/test_authentication.py ..................... [ 78%]
student-tests/unit/test_cursor.py ........... [ 83%]
student-tests/unit/test_domain.py ...................................... [ 99%]
.. [100%]
===================== 239 passed, 10 deselected in 17.41s ======================