Files
mtusi2026lab4/.env.example
T
Mikhail Verkovykh 728e53cc55 Реализовать lab4 на оценку 4: SeaweedFS, вложения и согласованность БД/S3.
Перенесён стенд lab3 (API, Redis-сессии, идемпотентность, HAProxy, реплики API). Добавлены приватный bucket SeaweedFS с отдельным ключом API, загрузка PNG/JPEG с лимитами и полной проверкой, компенсация и reconciler, плавная остановка API, тесты и evidence.
2026-11-06 19:48:37 +03:00

35 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
# 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
DATABASE_URL_FILE=/run/secrets/database_url
# 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
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