This commit is contained in:
Vladislav Kunetskiy
2026-10-21 21:22:42 +03:00
parent f4bd361f12
commit 464db7fdd6
238 changed files with 13332 additions and 704 deletions
+43
View File
@@ -1,13 +1,29 @@
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
# Values below are the variables this implementation actually reads
# (viper: section.name -> SECTION_NAME, see internal/config/config.go).
#
# Mapping to the logical names suggested by the skeleton:
# APP_HOST / APP_PORT -> SERVER_HOST / SERVER_PORT
# SESSION_STORE=postgres -> server-side sessions live in PostgreSQL (SESSION_TTL_SECONDS)
# DATABASE_URL_FILE -> unused: POSTGRES_* below pass no secret files
# CACHE_URL_FILE -> unused: REDIS_* below pass no secret files
# API_REPLICAS -> number of API replicas of the stand (compose.yaml)
#
# APP_ENV selects config/<env>/config.yaml; the implementation supports only `dev`.
APP_ENV=dev
SERVER_HOST=0.0.0.0
SERVER_PORT=8080
SERVER_READ_HEADER_TIMEOUT=10s
SERVER_SHUTDOWN_TIMEOUT=10s
# Предел размера тела запроса (байт): защищает реплику от чтения огромного тела
# до валидации. Для вложений LAB4 (до 10 MiB) значение нужно поднять.
SERVER_MAX_BODY_BYTES=262144
LOG_LEVEL=info
LOG_FORMAT=json
# Synthetic credentials for the local stand only; override in .env for anything else.
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DATABASE=messenger
@@ -39,3 +55,30 @@ CACHE_LOCK_TTL=10s
CACHE_LOCK_WAIT_TIMEOUT=2s
SESSION_TTL_SECONDS=3600
# Retention of a message Idempotency-Key in the shared store; contract 1.3.0
# requires at least 24 h.
IDEMPOTENCY_TTL_SECONDS=86400
# Lab3 stand (compose.yaml): number of API replicas behind the LB and per-replica
# CPU/RAM limits. Track 1 varies them to compare 1/2/4 replicas at a fixed total
# budget, e.g. API_REPLICAS=4 API_CPU_LIMIT=0.25 API_MEM_LIMIT=192M.
API_REPLICAS=2
API_CPU_LIMIT=0.50
API_MEM_LIMIT=256M
# Connections of ONE API replica to PostgreSQL; the total is replicas × value.
# Track 1 checks whether the shared connection budget becomes the saturation
# point: at 4 replicas the default 10 means 40 connections against one database.
POSTGRES_MAX_CONNS=10
# CPU quota of the shared database. Track 1 shows it is the stand's saturation
# point: the API uses a fraction of its budget while PostgreSQL sits at its own.
POSTGRES_CPU_LIMIT=0.50
# Memory quota of the shared database. The track 1 series r/g/pool were measured
# with 512M, the db1cpu control — with 384M (see evidence/track1/profile-*.json).
POSTGRES_MEM_LIMIT=384M
# Loopback port of the HAProxy operator page (UP/DOWN of every replica).
LB_STATS_PORT=8404