Собрать стенд lab4: вложения в MinIO и сверка хранилищ

This commit is contained in:
Wladislava1
2026-11-12 10:57:42 +03:00
parent ec540a1a72
commit 3715c6a395
33 changed files with 3111 additions and 45 deletions
+8
View File
@@ -0,0 +1,8 @@
Official tests/resilience.py --mode failover, hook scripts/stop-one.sh.
Before each run both API replicas answered. The hook stopped the replica that served the first message and left it stopped. Exit code of that container was 143 (SIGTERM). The public test then read the same PNG bytes through the replica that stayed up.
Run 1: {"observed_instances_before": 2, "successful_writes": 136, "failed_attempts": 1, "first_recovery_seconds": 0.669}
Run 2: {"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 1, "first_recovery_seconds": 1.276}
Run 3: {"observed_instances_before": 2, "successful_writes": 136, "failed_attempts": 1, "first_recovery_seconds": 0.745}
In all three runs the stopped container was mtusi-lab4-api-2, because that replica served the first message. mtusi-lab4-api-1 stayed up and served the later requests, including the file download. PASS each time.
+22
View File
@@ -0,0 +1,22 @@
{
"concurrent_uploads": 10,
"upload_bytes": 922428,
"image": "640x480 PNG",
"peak_mib": {"mtusi-lab4-api-2": 103.9, "mtusi-lab4-api-1": 105.7},
"limit_mib": 256,
"result": "PASS files",
"also_checked": [
"file bigger than 10485760 bytes -> 413",
"PNG header 8000x8000 -> 413 before decode",
"broken PNG -> 415",
"PNG bytes with Content-Type image/jpeg -> 415",
"filename with slash, backslash or newline -> 400",
"attachment of another chat -> 404",
"unknown attachment id -> 404",
"outsider metadata and bytes -> 404",
"missing thumbnail variant -> 404",
"no token -> 401",
"same Idempotency-Key and same attachment -> same message",
"same key and different text -> 409"
]
}
+13
View File
@@ -0,0 +1,13 @@
Official tests/resilience.py --mode persistence, hook scripts/restart.sh.
The hook restarts postgres, redis, minio and both API replicas. It does not delete volumes and does not load the database again. The balancer is left running.
StartedAt before -> after:
api-1 2026-11-12T07:31:38Z -> 2026-11-12T07:34:43Z
api-2 2026-11-12T07:31:37Z -> 2026-11-12T07:34:43Z
minio 2026-11-12T07:24:33Z -> 2026-11-12T07:34:39Z
postgres 2026-11-12T07:24:33Z -> 2026-11-12T07:34:39Z
redis 2026-11-12T07:24:33Z -> 2026-11-12T07:34:38Z
lb 2026-11-12T07:29:57Z -> unchanged
PASS: persistence preserved confirmed data and existing session.
The same token worked, and the PNG bytes matched the original.
+11
View File
@@ -0,0 +1,11 @@
Published ports: only 127.0.0.1:8080 on the balancer. MinIO 9000 and the console 9001 are not published to the host.
From another container on the network mtusi-lab4-net, without credentials:
GET http://minio:9000/messenger-attachments/ -> 403
GET http://minio:9001/ -> no connection (HTTP code 000). The console listens on 127.0.0.1:9001 inside the MinIO container.
find /app /tmp on an API container found no PNG and no original file. The API service has no volume for files.
The API container receives s3_access_key and s3_secret_key. The MinIO root password is mounted only into minio and minio-init.
minio-init was started again after the bucket already existed and exited 0. Files uploaded earlier were still readable.
+15
View File
@@ -0,0 +1,15 @@
{
"applied_objects": 1,
"applied_rows": 1,
"dry_run_actions": ["delete_orphan_object", "delete_orphan_row"],
"fresh_file_same": true,
"fresh_orphan_kept": true,
"in_use_missing_preserved": true,
"list_seconds": 0.091144,
"objects_seen": 33,
"old_orphan_removed": true,
"preserved_reasons": ["fresh_object", "missing_but_in_use"],
"rows_seen": 33,
"second_run_actions": [],
"used_file_same": true
}