forked from mtusi2026/mtusi2026lab4
S3-вложения и сверка Postgresql с MinIO
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
2026/11/13 15:21:03 INFO bootstrap-s3 complete
|
||||
bootstrap_exit:0
|
||||
@@ -0,0 +1,6 @@
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 120, "failed_attempts": 1, "first_recovery_seconds": 2.317}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
failover_exit:0
|
||||
ready_after_restore 200
|
||||
@@ -0,0 +1,24 @@
|
||||
slash filename: HTTP 400 expected 400 PASS body=b'{"error":{"code":"invalid_request","message":"\xd0\x9d\xd0\xb5\xd0\xba\xd0\xbe\xd1\x80\xd1\x80\xd0\xb5\xd0\xba\xd1\x82\xd0\xbd\xd0\xbe\xd0\xb5 \xd0\xb8\xd0\xbc\xd1\x8f \xd1\x84\xd0\xb0\xd0\xb9\xd0\xbb\xd0\xb0","request_id":"f87e88bb3a77dfcd1954869b6bd7cd1f"}}\n'
|
||||
backslash filename: HTTP 400 expected 400 PASS body=b'{"error":{"code":"invalid_request","message":"\xd0\x9d\xd0\xb5\xd0\xba\xd0\xbe\xd1\x80\xd1\x80\xd0\xb5\xd0\xba\xd1\x82\xd0\xbd\xd0\xbe\xd0\xb5 \xd0\xb8\xd0\xbc\xd1\x8f \xd1\x84\xd0\xb0\xd0\xb9\xd0\xbb\xd0\xb0","request_id":"7331f9440909ae6caf0fb44ee96e9f32"}}\n'
|
||||
text as png: HTTP 415 expected 415 PASS body=b'{"error":{"code":"unsupported_media_type","message":"\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb \xd0\xbd\xd0\xb5 \xd1\x8f\xd0\xb2\xd0\xbb\xd1\x8f\xd0\xb5\xd1\x82\xd1\x81\xd1\x8f PNG \xd0\xb8\xd0\xbb\xd0\xb8 JPEG","request_id":"0dce761035b9400dd19b242221eb8481"}}\n'
|
||||
mime swap: HTTP 415 expected 415 PASS body=b'{"error":{"code":"unsupported_media_type","message":"\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb \xd0\xbd\xd0\xb5 \xd1\x8f\xd0\xb2\xd0\xbb\xd1\x8f\xd0\xb5\xd1\x82\xd1\x81\xd1\x8f PNG \xd0\xb8\xd0\xbb\xd0\xb8 JPEG","request_id":"89eae50ae499ffa84222ea1b9fd09a18"}}\n'
|
||||
truncated png: HTTP 415 expected 415 PASS body=b'{"error":{"code":"unsupported_media_type","message":"\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb \xd0\xbd\xd0\xb5 \xd1\x8f\xd0\xb2\xd0\xbb\xd1\x8f\xd0\xb5\xd1\x82\xd1\x81\xd1\x8f PNG \xd0\xb8\xd0\xbb\xd0\xb8 JPEG","request_id":"2cb180557a19a4a557ed8df5b1da7308"}}\n'
|
||||
over 10MiB: HTTP 413 expected 413 PASS body=b'{"error":{"code":"payload_too_large","message":"\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb \xd0\xb1\xd0\xbe\xd0\xbb\xd1\x8c\xd1\x88\xd0\xb5 10 \xd0\x9c\xd0\xb8\xd0\x91","request_id":"c157c5c1d8ec893fbb5d1f173765ec58"}}\n'
|
||||
pixel bomb: HTTP 413 expected 413 PASS body=b'{"error":{"code":"payload_too_large","message":"\xd0\xa1\xd0\xbb\xd0\xb8\xd1\x88\xd0\xba\xd0\xbe\xd0\xbc \xd0\xbc\xd0\xbd\xd0\xbe\xd0\xb3\xd0\xbe \xd0\xbf\xd0\xb8\xd0\xba\xd1\x81\xd0\xb5\xd0\xbb\xd0\xb5\xd0\xb9","request_id":"83373190a90631c1480641d4a50fce7c"}}\n'
|
||||
rejected uploads left attachment rows 5->5 PASS
|
||||
good upload: HTTP 201 expected 201 PASS body=b'{"id":"3c272598-75cc-417b-9277-3049201482be","chat_id":"429de0c2-a4a9-4187-a741-967924abe036","owner_id":"7fc52156-5f47-4166-8326-20e277d73026","filename":"ok.png","content_type":"'
|
||||
unknown attachment: HTTP 404 expected 404 PASS body=b'{"error":{"code":"not_found","message":"\xd0\x9e\xd0\xb1\xd1\x8a\xd0\xb5\xd0\xba\xd1\x82 \xd0\xbd\xd0\xb5 \xd0\xbd\xd0\xb0\xd0\xb9\xd0\xb4\xd0\xb5\xd0\xbd","request_id":"f77f64b8660f9bb0a953e7e11edfc927"}}\n'
|
||||
other chat upload: HTTP 201 expected 201 PASS body=b'{"id":"f1cb80e3-3359-43e9-8f9a-b94aeef3aa62","chat_id":"f5e6ff73-8216-4083-b669-c70d9114b9ec","owner_id":"7fc52156-5f47-4166-8326-20e277d73026","filename":"foreign.png","content_ty'
|
||||
attachment from other chat: HTTP 404 expected 404 PASS body=b'{"error":{"code":"not_found","message":"\xd0\x9e\xd0\xb1\xd1\x8a\xd0\xb5\xd0\xba\xd1\x82 \xd0\xbd\xd0\xb5 \xd0\xbd\xd0\xb0\xd0\xb9\xd0\xb4\xd0\xb5\xd0\xbd","request_id":"e0c7125bce6ab391a87be26308fbe587"}}\n'
|
||||
outsider download: HTTP 404 expected 404 PASS body=b'{"error":{"code":"not_found","message":"\xd0\x9e\xd0\xb1\xd1\x8a\xd0\xb5\xd0\xba\xd1\x82 \xd0\xbd\xd0\xb5 \xd0\xbd\xd0\xb0\xd0\xb9\xd0\xb4\xd0\xb5\xd0\xbd","request_id":"f5d96f39fe154172be91ef72756666ec"}}\n'
|
||||
anonymous S3 GET 403 PASS
|
||||
console on host http_code=000 err=7
|
||||
10 parallel 1MiB uploads statuses=[415, 415, 415, 415, 415, 415, 415, 415, 415, 415] seconds=8.43 peak_api_MiB=71.4
|
||||
dry-run-1 {"mode": "dry-run", "grace_seconds": 5, "cutoff": "2026-11-13T13:56:30Z", "db_rows": 10, "s3_objects": 9, "list_pages": 1, "pairs": 7, "orphan_fresh": 1, "orphan_stale": 1, "missing_fresh": 0, "missing_referenced": 2, "missing_stale_unreferenced": 1, "deleted_objects": 0, "deleted_rows": 0, "duration_ms": 2}
|
||||
dry-run-2 same=True
|
||||
apply {"mode": "apply", "grace_seconds": 5, "cutoff": "2026-11-13T13:56:31Z", "db_rows": 10, "s3_objects": 9, "list_pages": 1, "pairs": 7, "orphan_fresh": 1, "orphan_stale": 1, "missing_fresh": 0, "missing_referenced": 2, "missing_stale_unreferenced": 1, "deleted_objects": 1, "deleted_rows": 1, "duration_ms": 4}
|
||||
apply-again {"deleted_objects": 0, "deleted_rows": 0, "orphan_stale": 0, "missing_stale_unreferenced": 0}
|
||||
referenced metadata after apply HTTP 200
|
||||
referenced bytes missing HTTP 404
|
||||
stale unreferenced metadata HTTP 404
|
||||
fresh download HTTP 200 same_bytes=True
|
||||
@@ -0,0 +1,2 @@
|
||||
ok messenger/internal/imagecheck 0.008s
|
||||
imagecheck_exit:0
|
||||
@@ -0,0 +1,2 @@
|
||||
upload HTTP 201 status=ready content_type=image/jpeg size=613 sha256=c4667e8441372971150fbd56d2eed48347fa033801754f1f6c563bf4f45b99da
|
||||
download HTTP 200 content_type=image/jpeg same_bytes=True len=613
|
||||
@@ -0,0 +1,48 @@
|
||||
api env names:
|
||||
|
||||
APP_ENV
|
||||
APP_HOST
|
||||
APP_PORT
|
||||
ARGON2_MEMORY_KIB
|
||||
ARGON2_THREADS
|
||||
ARGON2_TIME
|
||||
DATABASE_URL
|
||||
DB_MAX_CONNS
|
||||
IDEMPOTENCY_TTL_SECONDS
|
||||
MAX_IMAGE_PIXELS
|
||||
MAX_UPLOAD_BYTES
|
||||
PATH
|
||||
RECONCILE_GRACE_SECONDS
|
||||
REDIS_URL
|
||||
S3_ACCESS_KEY
|
||||
S3_BUCKET
|
||||
S3_ENDPOINT
|
||||
S3_REGION
|
||||
S3_SECRET_KEY
|
||||
SESSION_TTL_SECONDS
|
||||
SHUTDOWN_TIMEOUT_SECONDS
|
||||
SSL_CERT_FILE
|
||||
api mounts:
|
||||
[]
|
||||
minio-init env names:
|
||||
|
||||
APP_ENV
|
||||
APP_HOST
|
||||
APP_PORT
|
||||
MINIO_ROOT_PASSWORD
|
||||
MINIO_ROOT_USER
|
||||
PATH
|
||||
S3_ACCESS_KEY
|
||||
S3_BUCKET
|
||||
S3_ENDPOINT
|
||||
S3_REGION
|
||||
S3_SECRET_KEY
|
||||
SHUTDOWN_TIMEOUT_SECONDS
|
||||
SSL_CERT_FILE
|
||||
published ports:
|
||||
api 8080/tcp
|
||||
api 8080/tcp
|
||||
haproxy 127.0.0.1:8080->8080/tcp
|
||||
minio 127.0.0.1:9000->9000/tcp, 9001/tcp
|
||||
postgres 127.0.0.1:5432->5432/tcp
|
||||
redis 127.0.0.1:6379->6379/tcp
|
||||
@@ -0,0 +1,4 @@
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost: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.
|
||||
persistence_exit:0
|
||||
@@ -0,0 +1,4 @@
|
||||
console host:
|
||||
http_code=000 exit=7
|
||||
anonymous object:
|
||||
http_code=403
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"dry": {
|
||||
"mode": "dry-run",
|
||||
"grace_seconds": 5,
|
||||
"cutoff": "2026-11-13T13:56:30Z",
|
||||
"db_rows": 10,
|
||||
"s3_objects": 9,
|
||||
"list_pages": 1,
|
||||
"pairs": 7,
|
||||
"orphan_fresh": 1,
|
||||
"orphan_stale": 1,
|
||||
"missing_fresh": 0,
|
||||
"missing_referenced": 2,
|
||||
"missing_stale_unreferenced": 1,
|
||||
"deleted_objects": 0,
|
||||
"deleted_rows": 0,
|
||||
"duration_ms": 2
|
||||
},
|
||||
"apply": {
|
||||
"mode": "apply",
|
||||
"grace_seconds": 5,
|
||||
"cutoff": "2026-11-13T13:56:31Z",
|
||||
"db_rows": 10,
|
||||
"s3_objects": 9,
|
||||
"list_pages": 1,
|
||||
"pairs": 7,
|
||||
"orphan_fresh": 1,
|
||||
"orphan_stale": 1,
|
||||
"missing_fresh": 0,
|
||||
"missing_referenced": 2,
|
||||
"missing_stale_unreferenced": 1,
|
||||
"deleted_objects": 1,
|
||||
"deleted_rows": 1,
|
||||
"duration_ms": 4
|
||||
},
|
||||
"again": {
|
||||
"mode": "apply",
|
||||
"grace_seconds": 5,
|
||||
"cutoff": "2026-11-13T13:56:31Z",
|
||||
"db_rows": 9,
|
||||
"s3_objects": 8,
|
||||
"list_pages": 1,
|
||||
"pairs": 7,
|
||||
"orphan_fresh": 1,
|
||||
"orphan_stale": 0,
|
||||
"missing_fresh": 0,
|
||||
"missing_referenced": 2,
|
||||
"missing_stale_unreferenced": 0,
|
||||
"deleted_objects": 0,
|
||||
"deleted_rows": 0,
|
||||
"duration_ms": 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/messenger-lab4-api-1 2026-11-13T15:21:24.371344153Z changed=True
|
||||
/messenger-lab4-api-2 2026-11-13T15:21:24.097492187Z changed=True
|
||||
/messenger-lab4-haproxy-1 2026-11-13T15:21:23.853867151Z changed=True
|
||||
/messenger-lab4-minio-1 2026-11-13T15:21:23.912731663Z changed=True
|
||||
/messenger-lab4-postgres-1 2026-11-13T15:21:23.929193078Z changed=True
|
||||
/messenger-lab4-redis-1 2026-11-13T15:21:23.798144563Z changed=True
|
||||
@@ -0,0 +1,6 @@
|
||||
/messenger-lab4-api-1 2026-11-13T13:57:38.601482122Z
|
||||
/messenger-lab4-api-2 2026-11-13T13:57:12.678628253Z
|
||||
/messenger-lab4-haproxy-1 2026-11-13T13:57:12.296072145Z
|
||||
/messenger-lab4-minio-1 2026-11-13T13:57:12.399188879Z
|
||||
/messenger-lab4-postgres-1 2026-11-13T13:57:12.441137115Z
|
||||
/messenger-lab4-redis-1 2026-11-13T13:57:12.342361107Z
|
||||
@@ -0,0 +1,8 @@
|
||||
Container messenger-lab4-minio-1 Stopping
|
||||
Container messenger-lab4-minio-1 Stopped
|
||||
ready_while_stopped {"error":{"code":"unavailable","message":"Сервис временно недоступен","request_id":"ee574af75872b15d575a895357e5bd95"}}
|
||||
http=503
|
||||
Container messenger-lab4-minio-1 Starting
|
||||
Container messenger-lab4-minio-1 Started
|
||||
ready_after_start 503
|
||||
ready_after_start 200
|
||||
@@ -0,0 +1,3 @@
|
||||
BucketExists messenger-attachments: ok=true no_error=true
|
||||
MakeBucket messenger-other-bucket: AccessDenied
|
||||
rights_exit:0
|
||||
@@ -0,0 +1,3 @@
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
|
||||
smoke_exit:0
|
||||
Reference in New Issue
Block a user