forked from mtusi2026/mtusi2026lab5
- RabbitMQ quorum queue, persistent messages and publisher confirms - S3 staging plus PostgreSQL attachments/jobs outbox transaction - worker variants (thumbnail, crop, optimized WebP), DB lease and lease sweeper - jittered retry, permanent failures, explicit replay and admission cap - deterministic crash hooks, resilience script and evidence for grade 4 - async-aware custom tests, oversized pixel case, docs and changelog
80 lines
2.2 KiB
Bash
80 lines
2.2 KiB
Bash
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
|
|
# Fill every empty value. The compose file uses ${VAR:?} so a missing secret
|
|
# fails fast instead of silently starting with a guessable password.
|
|
APP_HOST=0.0.0.0
|
|
APP_PORT=8080
|
|
APP_ENV=lab
|
|
SESSION_TTL_SECONDS=3600
|
|
IDEMPOTENCY_TTL_SECONDS=86400
|
|
SESSION_STORE=redis
|
|
API_REPLICAS=2
|
|
|
|
POSTGRES_USER=messenger
|
|
POSTGRES_DB=messenger
|
|
POSTGRES_PASSWORD=
|
|
DB_POOL_MAX_CONNS=10
|
|
|
|
# Redis/Valkey session store.
|
|
CACHE_URL=redis://redis:6379/0
|
|
|
|
# Private S3-compatible bucket (RustFS in compose.yaml).
|
|
# RustFS identifies an IAM user by its access key, so S3_APP_USER must equal
|
|
# S3_ACCESS_KEY_ID. The bootstrap refuses to start when they diverge instead of
|
|
# leaving the API healthy-looking but unable to authenticate.
|
|
S3_ENDPOINT=http://rustfs:9000
|
|
S3_REGION=us-east-1
|
|
S3_BUCKET=messenger-attachments
|
|
S3_ROOT_ACCESS_KEY=
|
|
S3_ROOT_SECRET_KEY=
|
|
S3_ACCESS_KEY_ID=messenger-api
|
|
S3_SECRET_ACCESS_KEY=
|
|
S3_APP_USER=messenger-api
|
|
S3_APP_POLICY=messenger-attachments-rw
|
|
|
|
MAX_UPLOAD_BYTES=10485760
|
|
MAX_IMAGE_PIXELS=40000000
|
|
# Shared decode memory budget per API process and per worker process.
|
|
IMAGE_DECODE_MEMORY_MB=256
|
|
|
|
# RabbitMQ broker (lab5). The management UI is bound to 127.0.0.1 only.
|
|
RABBITMQ_USER=messenger
|
|
RABBITMQ_PASSWORD=
|
|
RABBITMQ_MGMT_PORT=15672
|
|
JOB_QUEUE=attachment.process.v1
|
|
|
|
# Async worker and retry policy. MAX_PENDING_JOBS is an approximate admission
|
|
# cap across API replicas; 0 disables it.
|
|
WORKER_ONLY=false
|
|
WORKER_CONCURRENCY=2
|
|
WORKER_PREFETCH=2
|
|
WORKER_REPLICAS=1
|
|
MAX_PENDING_JOBS=1000
|
|
JOB_MAX_ATTEMPTS=5
|
|
JOB_TIMEOUT_SECONDS=60
|
|
JOB_LEASE_SECONDS=90
|
|
JOB_RETRY_BASE_SECONDS=2
|
|
JOB_RETRY_MAX_SECONDS=30
|
|
LEASE_SWEEP_SECONDS=15
|
|
STAGING_RETENTION_SECONDS=86400
|
|
|
|
# Deterministic grade-4 fault hooks. Keep them off outside evidence runs.
|
|
WORKER_FAULT_MODE=none
|
|
WORKER_CRASH_AFTER_EFFECT=false
|
|
WORKER_CRASH_AFTER_CLAIM=false
|
|
|
|
# Container limits (used by the lab5 experiment).
|
|
API_CPU_LIMIT=0.50
|
|
API_MEM_LIMIT=512M
|
|
WORKER_CPU_LIMIT=1.0
|
|
WORKER_MEM_LIMIT=1G
|
|
POSTGRES_CPU_LIMIT=1.0
|
|
POSTGRES_MEM_LIMIT=512M
|
|
REDIS_CPU_LIMIT=0.50
|
|
REDIS_MEM_LIMIT=256M
|
|
RUSTFS_CPU_LIMIT=1.0
|
|
RUSTFS_MEM_LIMIT=512M
|
|
RABBITMQ_CPU_LIMIT=1.0
|
|
RABBITMQ_MEM_LIMIT=512M
|
|
RECONCILER_CPU_LIMIT=0.25
|
|
RECONCILER_MEM_LIMIT=128M
|