feat: implement S3 attachments and presigned uploads

This commit is contained in:
sinveria
2026-11-10 12:08:50 +03:00
parent aaa834e412
commit d96d4a2836
50 changed files with 3138 additions and 72 deletions
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
ATTACHMENT FAILOVER TEST
Mode: failover
Observed API instances before failure: 2
Successful writes: 87
Failed attempts: 4
First recovery: 4.597 seconds
The API replica that handled the attachment upload was stopped.
The attachment remained accessible through the other API replica.
Downloaded content matched the original bytes.
Existing session and confirmed messages were preserved.
RESULT: PASS
+3
View File
@@ -0,0 +1,3 @@
method,concurrency,file_size_bytes,successful_uploads,failed_uploads,wall_time_s,throughput_uploads_per_s,peak_api_total_mib,baseline_api_total_mib,peak_delta_api_total_mib,api1_peak_mib,api2_peak_mib,memory_samples,memory_sampling_errors,avg_upload_time_s,max_upload_time_s,api_body_bytes_per_upload,s3_body_bytes_per_upload
proxy,10,5769330,10,0,3.9963,2.502,220.2,204.1,16.1,110.2,110.0,4,0,2.3315,2.6514,5769330,0
presigned,10,5769330,10,0,4.941,2.024,304.4,220.2,84.2,156.8,147.6,5,0,3.6495,3.9018,160,5769330
1 method concurrency file_size_bytes successful_uploads failed_uploads wall_time_s throughput_uploads_per_s peak_api_total_mib baseline_api_total_mib peak_delta_api_total_mib api1_peak_mib api2_peak_mib memory_samples memory_sampling_errors avg_upload_time_s max_upload_time_s api_body_bytes_per_upload s3_body_bytes_per_upload
2 proxy 10 5769330 10 0 3.9963 2.502 220.2 204.1 16.1 110.2 110.0 4 0 2.3315 2.6514 5769330 0
3 presigned 10 5769330 10 0 4.941 2.024 304.4 220.2 84.2 156.8 147.6 5 0 3.6495 3.9018 160 5769330
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
S3 SECURITY TEST
1. Admin console port:
Command: docker compose port minio 9001
Result: no port 9001/tcp published.
2. Anonymous bucket access:
Command: curl.exe -i http://localhost:9000/messenger-attachments/
Result: HTTP 403 Forbidden
S3 error: AccessDenied
3. Bucket:
messenger-attachments
RESULT: PASS
+25
View File
@@ -0,0 +1,25 @@
S3 UNAVAILABLE TEST
1. Stopped S3:
docker compose stop minio
2. Readiness response while S3 was unavailable:
HTTP 503
{
"error": {
"code": "unavailable",
"message": "Required storage unavailable"
}
}
3. Restarted S3:
docker compose start minio
4. Container status:
Both API replicas healthy.
S3 container running.
5. Readiness response after recovery:
status: ok
RESULT: PASS
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
method,file,file_size_bytes,repeat,elapsed_total_s,elapsed_api_s,client_to_api_body_bytes,client_to_s3_upload_bytes,api_peak_rss_mib,api_peak_delta_mib
proxy,sample.png,111817,1,0.0838,0.0837,111817,0,103.4,0.0
proxy,sample.png,111817,2,0.0773,0.0772,111817,0,103.4,0.0
proxy,sample.png,111817,3,0.0746,0.0746,111817,0,103.4,0.0
presigned,sample.png,111817,1,0.1103,0.084,158,111817,103.8,1.5
presigned,sample.png,111817,2,0.1003,0.0556,158,111817,103.8,0.0
presigned,sample.png,111817,3,0.1782,0.1082,158,111817,112.7,8.9
proxy,sample_large.png,5769330,1,0.2416,0.2415,5769330,0,103.8,1.5
proxy,sample_large.png,5769330,2,0.2777,0.2776,5769330,0,105.3,1.5
proxy,sample_large.png,5769330,3,0.2806,0.2805,5769330,0,109.2,5.2
presigned,sample_large.png,5769330,1,0.3062,0.1403,159,5769330,128.9,19.7
presigned,sample_large.png,5769330,2,0.2171,0.1092,159,5769330,116.3,0.0
presigned,sample_large.png,5769330,3,0.2459,0.1329,159,5769330,116.3,0.0
1 method file file_size_bytes repeat elapsed_total_s elapsed_api_s client_to_api_body_bytes client_to_s3_upload_bytes api_peak_rss_mib api_peak_delta_mib
2 proxy sample.png 111817 1 0.0838 0.0837 111817 0 103.4 0.0
3 proxy sample.png 111817 2 0.0773 0.0772 111817 0 103.4 0.0
4 proxy sample.png 111817 3 0.0746 0.0746 111817 0 103.4 0.0
5 presigned sample.png 111817 1 0.1103 0.084 158 111817 103.8 1.5
6 presigned sample.png 111817 2 0.1003 0.0556 158 111817 103.8 0.0
7 presigned sample.png 111817 3 0.1782 0.1082 158 111817 112.7 8.9
8 proxy sample_large.png 5769330 1 0.2416 0.2415 5769330 0 103.8 1.5
9 proxy sample_large.png 5769330 2 0.2777 0.2776 5769330 0 105.3 1.5
10 proxy sample_large.png 5769330 3 0.2806 0.2805 5769330 0 109.2 5.2
11 presigned sample_large.png 5769330 1 0.3062 0.1403 159 5769330 128.9 19.7
12 presigned sample_large.png 5769330 2 0.2171 0.1092 159 5769330 116.3 0.0
13 presigned sample_large.png 5769330 3 0.2459 0.1329 159 5769330 116.3 0.0