chore(migrate) moved codebase from lab4

This commit is contained in:
Mikhail Verkovykh
2026-11-14 23:17:36 +03:00
parent 276dbdad8a
commit 28d68dc30b
123 changed files with 11677 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# Доказательства
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
+4
View File
@@ -0,0 +1,4 @@
{"uploaded_by": "ad8141b5e17c", "attachment_id": "4395a996-db6d-4568-8bfe-805a926b54c8", "size_bytes": 111817}
stopping API replica ad8141b5e17c
{"downloaded_by": "2229551f45ac", "stopped_replica": "ad8141b5e17c", "attempts": 1, "transient_errors": 0, "size_bytes": 111817, "sha256": "99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75"}
PASS: attachment survived the stop of the replica that accepted it
+2
View File
@@ -0,0 +1,2 @@
python3 tests/custom/attachments.py --base-url "http://haproxy:8080"
PASS: graded negative cases (413/415/404/400), no 5xx, cross-member download checksum matches
+4
View File
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://haproxy:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 118, "failed_attempts": 1, "first_recovery_seconds": 2.557}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+2
View File
@@ -0,0 +1,2 @@
python3 tests/custom/idempotency.py --base-url "http://haproxy:8080"
PASS: 12 concurrent requests used 2 replicas and stored one message
+4
View File
@@ -0,0 +1,4 @@
attachments rows: 61 -> 61
stored objects: 61 -> 61
temp files left: 0
PASS: interrupted upload left no row, object or temp file
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 4,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 15.0,
"elapsed_seconds": 15.216,
"concurrency": 8,
"successful_requests": 6249,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 410.689,
"successful_latency_ms": {
"p50": 18.104,
"p95": 31.058,
"p99": 46.769
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 4,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 15.0,
"elapsed_seconds": 15.216,
"concurrency": 8,
"successful_requests": 6249,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 410.689,
"successful_latency_ms": {
"p50": 18.104,
"p95": 31.058,
"p99": 46.769
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+17
View File
@@ -0,0 +1,17 @@
before:
/mtusi2026lab-api-1 started=2026-10-31T17:51:06.750192429Z
/mtusi2026lab-api-2 started=2026-10-31T17:51:49.665340634Z
/mtusi2026lab-haproxy-1 started=2026-10-31T17:48:59.281606934Z
/mtusi2026lab-postgres-1 started=2026-10-31T17:48:59.351033349Z
/mtusi2026lab-redis-1 started=2026-10-31T17:48:59.306542581Z
/mtusi2026lab-rustfs-1 started=2026-10-31T17:48:59.424216765Z
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://haproxy:8080"
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:
/mtusi2026lab-api-1 started=2026-10-31T17:52:30.339455795Z
/mtusi2026lab-api-2 started=2026-10-31T17:52:30.289832188Z
/mtusi2026lab-haproxy-1 started=2026-10-31T17:52:30.089676215Z
/mtusi2026lab-postgres-1 started=2026-10-31T17:52:30.233422161Z
/mtusi2026lab-redis-1 started=2026-10-31T17:52:30.195015955Z
/mtusi2026lab-rustfs-1 started=2026-10-31T17:52:29.875749955Z
+3
View File
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://haproxy:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
+9
View File
@@ -0,0 +1,9 @@
1/4 create a probe object with the root credential
2/4 anonymous object GET must be denied
anonymous GET -> 403
3/4 scoped credential works inside attachments/ and is denied elsewhere
scoped PUT/HEAD inside attachments/ -> allowed
scoped PUT outside attachments/ -> denied
scoped CreateBucket -> denied
4/4 cleanup the probe object on exit
PASS: bucket is private and the API credential is limited to attachments/*
+18
View File
@@ -0,0 +1,18 @@
== before ==
X-Instance-Id: 2229551f45ac
Connection: close
== stopping postgres ==
Container mtusi2026lab-postgres-1 Stopping
Container mtusi2026lab-postgres-1 Stopped
HTTP/1.1 503 Service Unavailable
wget: server returned error: HTTP/1.1 503 Service Unavailable
== starting postgres ==
Container mtusi2026lab-postgres-1 Starting
Container mtusi2026lab-postgres-1 Started
== after ==
X-Request-Id: SixnEMLrvZMdpzQ7KEnqWSq0qLmSnx02kMfwNT39fiA
X-Instance-Id: 2229551f45ac
Connection: close
{"status":"ok"}
+15
View File
@@ -0,0 +1,15 @@
== before ==
Connection: close
{"status":"ok"}== stopping redis ==
Container mtusi2026lab-redis-1 Stopping
Container mtusi2026lab-redis-1 Stopped
HTTP/1.1 503 Service Unavailable
wget: server returned error: HTTP/1.1 503 Service Unavailable
== starting redis ==
Container mtusi2026lab-redis-1 Starting
Container mtusi2026lab-redis-1 Started
== after ==
X-Instance-Id: 2229551f45ac
Connection: close
+21
View File
@@ -0,0 +1,21 @@
== before stopping rustfs ==
X-Request-Id: JlYsHSjQDyVkf9Sfo3ifA3L0_2k4DXB4ONl34YgKC40
X-Instance-Id: 2229551f45ac
Connection: close
{"status":"ok"}exit=0
== stopping rustfs ==
Container mtusi2026lab-rustfs-1 Stopping
Container mtusi2026lab-rustfs-1 Stopped
HTTP/1.1 503 Service Unavailable
wget: server returned error: HTTP/1.1 503 Service Unavailable
exit=0
== starting rustfs ==
Container mtusi2026lab-rustfs-1 Starting
Container mtusi2026lab-rustfs-1 Started
== after rustfs recovery ==
X-Request-Id: KeusU6cz8m0fpFPz5NpDzvQU3XD0E6N-bLLo410ePG8
X-Instance-Id: 2229551f45ac
Connection: close
{"status":"ok"}exit=0
+24
View File
@@ -0,0 +1,24 @@
Container mtusi2026lab-reconciler-1 Stopping
Container mtusi2026lab-reconciler-1 Stopped
1/4 old pending row is visible to dry-run but unchanged
dry-run reported it and changed neither store
2/4 old pending row and object are removed by a real pass
Container mtusi2026lab-reconciler-run-d207ba83e1d7 Creating
Container mtusi2026lab-reconciler-run-d207ba83e1d7 Created
2026/11/06 15:57:35 INFO reconcile pass complete dry_run=false stale_pending=1 orphan_objects=0 deleted_rows=1 deleted_objects=1 skipped=0
row and object removed
3/4 fresh pending row survives the grace period
Container mtusi2026lab-reconciler-run-c71fa380c411 Creating
Container mtusi2026lab-reconciler-run-c71fa380c411 Created
2026/11/06 15:57:39 INFO reconcile pass complete dry_run=false stale_pending=0 orphan_objects=0 deleted_rows=0 deleted_objects=0 skipped=0
fresh row and object kept
Container mtusi2026lab-reconciler-run-2666c645577b Creating
Container mtusi2026lab-reconciler-run-2666c645577b Created
2026/11/06 15:57:41 INFO reconcile pass complete dry_run=false stale_pending=0 orphan_objects=1 deleted_rows=0 deleted_objects=1 skipped=0
row removed, orphan object cleaned up
4/4 ready attachment is not touched
Container mtusi2026lab-reconciler-run-5f830168e512 Creating
Container mtusi2026lab-reconciler-run-5f830168e512 Created
2026/11/06 15:57:47 INFO reconcile pass complete dry_run=false stale_pending=0 orphan_objects=0 deleted_rows=0 deleted_objects=0 skipped=0
ready metadata and bytes kept
PASS: reconciler removed only abandoned data and respected the grace period
+8
View File
@@ -0,0 +1,8 @@
run 1:
Container mtusi2026lab-s3-init-run-6ff27dc7d5c8 Creating
Container mtusi2026lab-s3-init-run-6ff27dc7d5c8 Created
S3 bootstrap complete: bucket=messenger-attachments user=messenger-api policy=messenger-attachments-rw
run 2:
Container mtusi2026lab-s3-init-run-83790bb5cf48 Creating
Container mtusi2026lab-s3-init-run-83790bb5cf48 Created
S3 bootstrap complete: bucket=messenger-attachments user=messenger-api policy=messenger-attachments-rw
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://haproxy:8080"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
+25
View File
@@ -0,0 +1,25 @@
{
"workload": {
"uploads": 10,
"width": 1800,
"height": 1400,
"image_bytes": 7563763,
"sha256": "e42f6283ac02b27d81700f861fc943a1bcb2b17a638edde130d37625315907f5",
"elapsed_seconds": 2.6,
"instances": [
"2229551f45ac",
"ad8141b5e17c"
],
"download_verified": true
},
"sampling_interval_seconds": 0.05,
"samples": 121,
"wall_seconds": 6.884,
"baseline_total_mib": 14.7,
"peak_total_mib": 354.1,
"peak_per_container_mib": {
"mtusi2026lab-api-1": 174.1,
"mtusi2026lab-api-2": 180.1
},
"api_memory_limit_mib": 512.0
}
+24
View File
@@ -0,0 +1,24 @@
{
"workload": {
"uploads": 1,
"width": 1800,
"height": 1400,
"image_bytes": 7563763,
"sha256": "be9606c01fdb972e9d60ffdacc03d0208cdca825a0797e727647639b14c0e35c",
"elapsed_seconds": 0.435,
"instances": [
"2229551f45ac"
],
"download_verified": true
},
"sampling_interval_seconds": 0.05,
"samples": 82,
"wall_seconds": 4.616,
"baseline_total_mib": 16.7,
"peak_total_mib": 280.4,
"peak_per_container_mib": {
"mtusi2026lab-api-1": 142.9,
"mtusi2026lab-api-2": 137.5
},
"api_memory_limit_mib": 512.0
}
+24
View File
@@ -0,0 +1,24 @@
{
"workload": {
"uploads": 1,
"width": 1800,
"height": 1400,
"image_bytes": 7563763,
"sha256": "be9606c01fdb972e9d60ffdacc03d0208cdca825a0797e727647639b14c0e35c",
"elapsed_seconds": 0.435,
"instances": [
"2229551f45ac"
],
"download_verified": true
},
"sampling_interval_seconds": 0.05,
"samples": 82,
"wall_seconds": 4.616,
"baseline_total_mib": 16.7,
"peak_total_mib": 280.4,
"peak_per_container_mib": {
"mtusi2026lab-api-1": 142.9,
"mtusi2026lab-api-2": 137.5
},
"api_memory_limit_mib": 512.0
}
+25
View File
@@ -0,0 +1,25 @@
{
"workload": {
"uploads": 10,
"width": 1800,
"height": 1400,
"image_bytes": 7563763,
"sha256": "e42f6283ac02b27d81700f861fc943a1bcb2b17a638edde130d37625315907f5",
"elapsed_seconds": 2.6,
"instances": [
"2229551f45ac",
"ad8141b5e17c"
],
"download_verified": true
},
"sampling_interval_seconds": 0.05,
"samples": 121,
"wall_seconds": 6.884,
"baseline_total_mib": 14.7,
"peak_total_mib": 354.1,
"peak_per_container_mib": {
"mtusi2026lab-api-1": 174.1,
"mtusi2026lab-api-2": 180.1
},
"api_memory_limit_mib": 512.0
}