forked from mtusi2026/mtusi2026lab3
FastAPI + PostgreSQL как единый источник истины: пользователи, Basic/Bearer-сессии, чаты, сообщения. Сессии и идемпотентные ключи хранятся в БД, поэтому реплики взаимозаменяемы. Общая идемпотентность POST сообщения по Idempotency-Key, включая конкурентный повтор через разные реплики. compose.yaml: postgres, one-shot migrate, api1, api2 и nginx как единственная публичная точка входа. Добавлены scripts/stop-one.sh и scripts/restart.sh, student-tests, evidence и заполненный REPORT.md.
26 lines
963 B
Bash
26 lines
963 B
Bash
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
|
|
# Values below are local-only placeholders, not production secrets.
|
|
APP_HOST=0.0.0.0
|
|
APP_PORT=8080
|
|
APP_ENV=lab
|
|
|
|
# Session lifetime in seconds. Public smoke needs >= 300, default is 3600.
|
|
SESSION_TTL_SECONDS=3600
|
|
|
|
# Idempotency result retention (contract: at least 24 hours).
|
|
IDEMPOTENCY_TTL_SECONDS=86400
|
|
|
|
# PostgreSQL is the single source of truth: users, chats, messages,
|
|
# sessions and idempotency keys all live here.
|
|
POSTGRES_DB=messenger
|
|
POSTGRES_USER=messenger
|
|
POSTGRES_PASSWORD=local_lab3_synthetic_password
|
|
|
|
# The API accepts either DATABASE_URL or DATABASE_URL_FILE (path to a file
|
|
# containing the URL). compose.yaml builds DATABASE_URL from POSTGRES_*.
|
|
# DATABASE_URL=postgresql://messenger:local_lab3_synthetic_password@localhost:5432/messenger
|
|
# DATABASE_URL_FILE=/run/secrets/database_url
|
|
|
|
# Informational: number of API replicas described in compose.yaml.
|
|
API_REPLICAS=2
|