Files
mtusi2026lab4/.env.example
T
RainakandClaude Opus 5.5 2dca5c114b ЛР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>
2026-11-12 18:49:12 +03:00

47 lines
1.8 KiB
Bash

# Copy to .env for your LOCAL synthetic test environment; never commit .env.
# These are logical interface suggestions; map actual framework names in REPORT.md.
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:
# 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
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
# --- 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