feat: harden attachment storage for level 4

This commit is contained in:
EgorAnti
2026-11-11 21:20:45 +03:00
parent e06678b6a9
commit 90a689661b
27 changed files with 650 additions and 14 deletions
+16
View File
@@ -6,6 +6,8 @@ events {
}
http {
client_max_body_size 11m;
client_body_timeout 10s;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
resolver 127.0.0.11 valid=2s ipv6=off;
@@ -53,6 +55,20 @@ http {
proxy_next_upstream_tries 2;
}
location ~ ^/api/v1/chats/[0-9a-fA-F-]+/attachments$ {
proxy_pass http://api_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_request_buffering on;
proxy_connect_timeout 500ms;
proxy_send_timeout 20s;
proxy_read_timeout 20s;
proxy_next_upstream off;
}
location / {
proxy_pass http://api_backend;
proxy_http_version 1.1;
+6
View File
@@ -27,6 +27,12 @@ services:
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:?S3_SECRET_ACCESS_KEY is required}
MAX_UPLOAD_BYTES: 10485760
MAX_IMAGE_PIXELS: 40000000
MAX_CONCURRENT_UPLOADS: 3
UPLOAD_PERMIT_WAIT_MILLIS: 10000
ATTACHMENT_CLEANUP_GRACE_SECONDS: 3600
ATTACHMENT_CLEANUP_DRY_RUN: "false"
ATTACHMENT_RECONCILE_INTERVAL_MILLIS: 600000
ATTACHMENT_RECONCILE_INITIAL_DELAY_MILLIS: 60000
FLYWAY_ENABLED: "false"
healthcheck:
test: ["CMD", "curl", "--fail", "--silent", "http://localhost:8080/health/ready"]