Лабораторная 4 — вложения и приватное S3

This commit is contained in:
2026-11-13 10:39:20 +03:00
parent ec540a1a72
commit 4cd025e477
62 changed files with 3545 additions and 22 deletions
+2
View File
@@ -3,3 +3,5 @@
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
Итоговый прогон от 13 ноября 2026 года описан в [отчёте](../REPORT.md). `upload-load.json` содержит все десять запросов и показания памяти обеих реплик. `attachment-resilience.txt` содержит ID загрузившей и скачавшей реплик, контрольную сумму и время восстановления. `cleanup-live.txt` подтверждает удаление объекта после сбоя между PUT и COMMIT на настоящих PostgreSQL и MinIO. Ранние проверки с подстановками отмечены в соответствующих файлах.
+2
View File
@@ -0,0 +1,2 @@
PASS: PostgreSQL row lock protects active PUT; fresh and ready attachments preserved
PASS: interrupted PUT and failure after PUT cleaned; S3 failure retries safely
+6
View File
@@ -0,0 +1,6 @@
Container mtusi-lab4-s3-1 Stopping
Container mtusi-lab4-s3-1 Stopped
Container mtusi-lab4-s3-1 Starting
Container mtusi-lab4-s3-1 Started
PASS: size, pixel count, corruption, MIME, filename and chat ACL over Nginx
PASS: S3 outage returned 503, text remained available, original recovered in 0.28s
+19
View File
@@ -0,0 +1,19 @@
Stopping API replica: api-a b790e8fa9b8f
Flag --time has been deprecated, use --timeout instead
b790e8fa9b8f2cae0b2d72ab43a49f7edd6942ce8e7c4a61409b980ecf69523f
b790e8fa9b8f2cae0b2d72ab43a49f7edd6942ce8e7c4a61409b980ecf69523f
005b94ff9f8de9ca8ca22ffebb0f768b8dfe15e26673b2ed000bd84deda89943
Container mtusi-lab4-s3-1 Restarting
Container mtusi-lab4-nginx-1 Restarting
Container mtusi-lab4-redis-1 Restarting
Container mtusi-lab4-api-a-1 Restarting
Container mtusi-lab4-api-b-1 Restarting
Container mtusi-lab4-postgres-1 Restarting
Container mtusi-lab4-s3-1 Started
Container mtusi-lab4-postgres-1 Started
Container mtusi-lab4-api-a-1 Started
Container mtusi-lab4-nginx-1 Started
Container mtusi-lab4-redis-1 Started
Container mtusi-lab4-api-b-1 Started
PASS: b790e8fa9b8f -> 005b94ff9f8d, SHA-256 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75, 5.66s
PASS: after full restart via b790e8fa9b8f, SHA-256 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75, 6.93s
+3
View File
@@ -0,0 +1,3 @@
PASS: local HTTP PNG/JPEG round trip, checksum, metadata, ACL and missing variant
PASS: malformed image, mismatched MIME, unsafe filename, byte/pixel limits and S3 error mapping
NOTE: metadata and S3 are test substitutes; real Compose integration not exercised
+2
View File
@@ -0,0 +1,2 @@
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
+1
View File
@@ -0,0 +1 @@
PASS: actual MinIO object existed after failed commit and was removed by cleanup
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:18081"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 0.875}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+9
View File
@@ -0,0 +1,9 @@
api-a running healthy
api-b running healthy
attachment-cleaner running
migrate exited
nginx running healthy
postgres running healthy
redis running healthy
s3 running
s3-bootstrap exited
+1
View File
@@ -0,0 +1 @@
PASS: ordered attachments, replay, invalid input, cross-chat rejection and history
+2
View File
@@ -0,0 +1,2 @@
PASS: production Store SQL on PostgreSQL 15, legacy replay, ordered links and message history
PASS: conflicting order, foreign/missing/pending attachments and duplicate UUID rejected
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:18081"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+2
View File
@@ -0,0 +1,2 @@
b790e8fa9b8f2cae0b2d72ab43a49f7edd6942ce8e7c4a61409b980ecf69523f
005b94ff9f8de9ca8ca22ffebb0f768b8dfe15e26673b2ed000bd84deda89943
+9
View File
@@ -0,0 +1,9 @@
Container mtusi-lab4-s3-1 Running
Container mtusi-lab4-s3-bootstrap-run-6a89f8a75fda Creating
Container mtusi-lab4-s3-bootstrap-run-6a89f8a75fda Created
Bucket created successfully `storage/messenger-attachments`.
Access permission for `storage/messenger-attachments` is set to `private`
Created policy `lab4-attachments` successfully.
Attached Policies: [lab4-attachments]
To User: lab4-api-828a0e3a8a5bff5c
PASS: private S3 bucket and scoped API policy configured
+4
View File
@@ -0,0 +1,4 @@
Container mtusi-lab4-s3-1 Running
Container mtusi-lab4-s3-bootstrap-run-324b1c08be01 Creating
Container mtusi-lab4-s3-bootstrap-run-324b1c08be01 Created
PASS: authenticated round trip; anonymous GET returned 403
+4
View File
@@ -0,0 +1,4 @@
PASS: SQL migrations applied to an existing lab3 schema in PGlite
PASS: old message preserved, valid same-chat link accepted
PASS: cross-chat links, duplicates, and invalid positions rejected
PASS: deleting a chat removes its message links
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://localhost:18081"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
+2
View File
@@ -0,0 +1,2 @@
PASS: text POST, replay with empty attachment_ids, history and shared session
API instance IDs: 005b94ff9f8d, b790e8fa9b8f
+81
View File
@@ -0,0 +1,81 @@
{
"concurrency": 10,
"payload_bytes": 8674572,
"sha256": "203a03973c23714cb0da1dd23d9c434128e147c584b43fcd4e16f3078aefae9f",
"elapsed_seconds": 1.3492113749999999,
"successful_rps": 7.411737097161667,
"latency_seconds": {
"p50": 1.257803875,
"p95": 1.348739208,
"p99": 1.348739208
},
"requests": [
{
"instance": "005b94ff9f8d",
"id": "91c3f144-be2a-4a9a-8701-7fdc3d6c9a2c",
"seconds": 1.345623708
},
{
"instance": "b790e8fa9b8f",
"id": "9b099dcc-30e1-4338-9fb0-3c52e28e7d54",
"seconds": 1.348739208
},
{
"instance": "b790e8fa9b8f",
"id": "23cf471e-f448-4069-8717-28be9a37631b",
"seconds": 1.2876072499999998
},
{
"instance": "005b94ff9f8d",
"id": "d94988d8-c641-4c32-8e5c-d375ddcd3d9e",
"seconds": 1.294252334
},
{
"instance": "005b94ff9f8d",
"id": "6f7c96c1-6016-4448-a8c5-2fb5b70c4fb4",
"seconds": 1.093782875
},
{
"instance": "005b94ff9f8d",
"id": "cd1aca0e-2b24-4c73-b315-900096dd6a78",
"seconds": 1.257803875
},
{
"instance": "b790e8fa9b8f",
"id": "50404cba-be99-42e2-ab82-8d24a698865d",
"seconds": 1.3204030420000001
},
{
"instance": "005b94ff9f8d",
"id": "7730a266-5564-4382-990c-120241f4ce49",
"seconds": 1.058885083
},
{
"instance": "b790e8fa9b8f",
"id": "e105a930-9530-4b0c-bbc7-988d27c45010",
"seconds": 1.132140125
},
{
"instance": "b790e8fa9b8f",
"id": "d1171d2a-39fa-49cc-a8c0-5ac9d0f62bbe",
"seconds": 1.1198395420000002
}
],
"memory_sample_interval_seconds": 0.05,
"resources": {
"api-a": {
"baseline_bytes": 78909440,
"peak_sample_bytes": 154247168,
"limit_bytes": 268435456,
"samples": 24,
"cpu_seconds": 0.564806
},
"api-b": {
"baseline_bytes": 95072256,
"peak_sample_bytes": 151191552,
"limit_bytes": 268435456,
"samples": 25,
"cpu_seconds": 0.563697
}
}
}
+4
View File
@@ -0,0 +1,4 @@
/Users/atmose/Documents/Codex/2026-11-06/new-chat/work/lab3-venv/bin/python scripts/validate_openapi.py
/Users/atmose/Documents/Codex/2026-11-06/new-chat/work/lab3-venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.