ЛР4 БВТ2304 Запорожец на 3

Вложения: приватный S3-bucket (RustFS 1.0.4) + метаданные в PostgreSQL, upload PNG/JPEG
с лимитами до декодирования, авторизованный download, attachment_ids в сообщениях,
идемпотентный bootstrap bucket, failover/persistence/S3-down тесты и REPORT.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 18:49:12 +03:00
co-authored by Claude Opus 5.5
parent ec540a1a72
commit 2dca5c114b
44 changed files with 3698 additions and 16 deletions
+27 -1
View File
@@ -7,7 +7,9 @@ SESSION_TTL_SECONDS=3600
# Choose credentials locally. File paths contain no secret values.
DATABASE_URL_FILE=/run/secrets/database_url
# Optional on 3, required use on 4 in lab2; Redis OR Valkey:
SESSION_STORE=postgres
# postgres - sessions only in PostgreSQL
# postgres+valkey - PostgreSQL is the source of truth, Valkey is a shared read-through session cache with TTL
SESSION_STORE=postgres+valkey
CACHE_URL_FILE=/run/secrets/cache_url
API_REPLICAS=2
IDEMPOTENCY_TTL_SECONDS=86400
@@ -18,3 +20,27 @@ S3_ACCESS_KEY_ID_FILE=/run/secrets/s3_access_key_id
S3_SECRET_ACCESS_KEY_FILE=/run/secrets/s3_secret_access_key
MAX_UPLOAD_BYTES=10485760
MAX_IMAGE_PIXELS=40000000
# --- solution-specific (lab3) ---
# Max lifetime of a cached session copy (also the cache-distrust window after a Valkey error)
SESSION_CACHE_TTL_SECONDS=60
# On SIGTERM a replica keeps serving but reports not-ready this long, so the LB drains it
SHUTDOWN_DRAIN_MS=3000
# Bounded pool and timeouts, per replica
DB_POOL_MAX=10
DB_STATEMENT_TIMEOUT_MS=5000
DB_ACQUIRE_TIMEOUT_MS=2000
CACHE_TIMEOUT_MS=300
# Parallel Argon2id computations per replica (each uses 64 MiB)
PASSWORD_HASH_WORKERS=2
# --- solution-specific (lab4) ---
# Deadline of one S3 operation (connect 2 s, no retries); after it the API answers 503
S3_TIMEOUT_MS=5000
# Parallel image validations per replica (CPU/RAM bound)
IMAGE_CHECK_WORKERS=2
# Per-replica limits
API_CPUS=1.0
API_MEMORY=384M
PG_CPUS=2.0
# Host ports bound to 127.0.0.1: LB entrypoint and LB stats page
LB_PUBLISHED_PORT=8080
LB_STATS_PORT=8404