forked from mtusi2026/mtusi2026lab4
Реализовать lab4 на оценку 4: SeaweedFS, вложения и согласованность БД/S3.
Перенесён стенд lab3 (API, Redis-сессии, идемпотентность, HAProxy, реплики API). Добавлены приватный bucket SeaweedFS с отдельным ключом API, загрузка PNG/JPEG с лимитами и полной проверкой, компенсация и reconciler, плавная остановка API, тесты и evidence.
This commit is contained in:
+18
-4
@@ -1,16 +1,17 @@
|
||||
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
|
||||
# These are logical interface suggestions; map actual framework names in REPORT.md.
|
||||
# Secret VALUES are not here: run `python scripts/init_secrets.py` to create ./secrets/*.
|
||||
APP_HOST=0.0.0.0
|
||||
APP_PORT=8080
|
||||
APP_ENV=lab
|
||||
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
|
||||
# Sessions live in Redis (AOF) since lab2 grade 4.
|
||||
SESSION_STORE=redis
|
||||
CACHE_URL_FILE=/run/secrets/cache_url
|
||||
# Number of interchangeable API replicas behind HAProxy (grade 3 requires ≥2).
|
||||
API_REPLICAS=2
|
||||
IDEMPOTENCY_TTL_SECONDS=86400
|
||||
# Lab4: private S3 bucket (SeaweedFS; s3:9000 is the s3-gw sidecar on the internal storage network).
|
||||
S3_ENDPOINT=http://s3:9000
|
||||
S3_REGION=us-east-1
|
||||
S3_BUCKET=messenger-attachments
|
||||
@@ -18,3 +19,16 @@ 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
|
||||
# Upload slots per API replica; excess waits up to 5 s, then 503 + Retry-After.
|
||||
MAX_CONCURRENT_UPLOADS=8
|
||||
# Abort an upload whose body stalls this long / takes longer than the deadline.
|
||||
UPLOAD_IDLE_TIMEOUT_SECONDS=10
|
||||
UPLOAD_DEADLINE_SECONDS=120
|
||||
# Reconciler: objects of unfinished uploads are removed only after this age (>= 2 * deadline).
|
||||
UPLOAD_GRACE_SECONDS=900
|
||||
RECONCILE_INTERVAL_SECONDS=300
|
||||
# Graceful stop: after SIGTERM /health/ready is 503 but requests are still served for the
|
||||
# drain window (≥ HAProxy inter 1s × fall 2), then in-flight requests get up to the timeout.
|
||||
# Keep drain + timeout + 2 s below stop_grace_period of the api service (15 s).
|
||||
SHUTDOWN_DRAIN_SECONDS=3
|
||||
SHUTDOWN_TIMEOUT_SECONDS=8
|
||||
|
||||
Reference in New Issue
Block a user