forked from mtusi2026/mtusi2026lab5
Скопировано из mtusi2026lab4 (ветка solution/bvt2302-bodanyuk, commit 17c33cd) через git archive: исходники, миграции, собственные тесты, Dockerfile, compose, конфигурации infra/, скрипты и bench/. README, COURSE, contracts/, tests/ и отчёт lab4 не копировались. Makefile и .env.example — версии lab4 (skeleton-часть совпадает с lab5, строки broker добавляются в следующих коммитах). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.7 KiB
Bash
67 lines
2.7 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.
|
|
# The files are created by `python scripts/init_secrets.py` and mounted by compose as secrets.
|
|
DATABASE_URL_FILE=/run/secrets/database_url
|
|
# Optional on 3, required use on 4 in lab2; Redis OR Valkey:
|
|
# valkey = sessions live only in Valkey (AOF, appendfsync always); postgres = table `sessions`.
|
|
SESSION_STORE=valkey
|
|
CACHE_URL_FILE=/run/secrets/cache_url
|
|
# Number of interchangeable API replicas behind HAProxy (compose deploy.replicas).
|
|
API_REPLICAS=2
|
|
# Idempotency-Key results are kept at least this long (contract: >= 24 h).
|
|
IDEMPOTENCY_TTL_SECONDS=86400
|
|
# Write path of POST message: function = one SQL call (migration 0003), multi = lab3 baseline path.
|
|
MESSAGE_WRITE_PATH=function
|
|
# Lab 4: private S3 bucket (SeaweedFS service `s3`). The API gets ITS OWN key pair (Read+Write on
|
|
# this bucket only) as Docker secrets; admin/reconciler pairs go only to s3-init/reconciler.
|
|
S3_ENDPOINT=http://s3:8333
|
|
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
|
|
# Contract limits (may be lowered, never raised above 10485760 / 40000000).
|
|
MAX_UPLOAD_BYTES=10485760
|
|
MAX_IMAGE_PIXELS=40000000
|
|
# Per replica: bodies buffered at once (RAM bound), wait for a slot, body deadline, image checks at once.
|
|
UPLOAD_CONCURRENCY=4
|
|
UPLOAD_QUEUE_TIMEOUT_SECONDS=5
|
|
UPLOAD_READ_TIMEOUT_SECONDS=30
|
|
IMAGE_VERIFY_TIMEOUT_SECONDS=10
|
|
IMAGE_VERIFY_CONCURRENCY=1
|
|
JPEG_MAX_MEMORY_MB=256
|
|
S3_TIMEOUT_SECONDS=3
|
|
# Janitor: 'pending' intents older than this are failed uploads (object + row removed).
|
|
PENDING_GRACE_SECONDS=900
|
|
JANITOR_INTERVAL_SECONDS=60
|
|
# Level 4 failure experiments only (after_s3_put, after_ready_commit); keep empty.
|
|
FAULT_POINTS=
|
|
# Additional settings of this implementation (defaults shown; all optional):
|
|
LOG_LEVEL=info
|
|
DB_POOL_MIN=1
|
|
DB_POOL_MAX=10
|
|
DB_TIMEOUT_SECONDS=3
|
|
CACHE_TIMEOUT_SECONDS=0.5
|
|
PASSWORD_HASH_CONCURRENCY=2
|
|
DOCS_ENABLED=true
|
|
# Graceful stop of a replica: readiness 503 + drain, then up to SHUTDOWN for in-flight requests.
|
|
DRAIN_SECONDS=3
|
|
SHUTDOWN_TIMEOUT_SECONDS=8
|
|
# CPU/RAM limits (docker compose deploy.resources.limits); API_* are per replica.
|
|
API_CPUS=1.0
|
|
API_MEMORY=512m
|
|
S3_CPUS=1.0
|
|
S3_MEMORY=1g
|
|
PG_CPUS=2.0
|
|
PG_MEMORY=1g
|
|
VALKEY_CPUS=0.5
|
|
LB_CPUS=1.0
|
|
PG_MAX_CONNECTIONS=100
|
|
# Host ports of the load balancer (published on 127.0.0.1 only; API replicas publish nothing)
|
|
APP_PUBLISH_PORT=8080
|
|
LB_STATS_PORT=8404
|