forked from mtusi2026/mtusi2026lab3
HAProxy + 2 API-реплики, общие PostgreSQL/Valkey, обязательный Idempotency-Key, graceful drain по SIGTERM, stop-one/restart/rolling-update, серии отказов и REPORT.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.3 KiB
Bash
35 lines
1.3 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
|
|
# --- 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
|
|
# 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
|