Реализовать лабораторную 2: PostgreSQL, Bearer-сессии и Valkey

Переносит минимум lab1 на PostgreSQL, добавляет Argon2id, Basic-вход,
opaque Bearer-сессии в Valkey с TTL и AOF, строгую валидацию JSON,
keyset-пагинацию по индексу, миграции, compose-стенд и собственные
проверки уровня 3/4. Трек 5 — план запроса и восстановление.
This commit is contained in:
IvanMeln1k
2026-11-30 23:51:33 +03:00
parent 65003b6119
commit 6ea767732e
469 changed files with 204712 additions and 10 deletions
+36 -9
View File
@@ -1,11 +1,38 @@
# 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
# Local synthetic teaching stand. Copy to .env (or run `make env`, which
# generates strong random passwords and never prints them) and never commit
# the result. There are no real/production credentials in this project.
#
# Compose reads this file for interpolation; the application receives only the
# resolved values. File-based variants are supported by the binary as
# DATABASE_URL_FILE and CACHE_URL_FILE for operators that prefer mounted
# secrets; the local stand uses the ignored .env file.
# Host port published on 127.0.0.1 only. The process always listens on 8080
# inside the container/network.
HOST_PORT=8080
APP_ENV=lab
LOG_LEVEL=info
APP_VERSION=1.0.0
# PostgreSQL (named volume mtusi-lab2-melnikov-pgdata).
POSTGRES_USER=messenger
POSTGRES_DB=messenger
POSTGRES_PASSWORD=
# Valkey (named volume mtusi-lab2-melnikov-valkeydata, AOF everysec).
VALKEY_PASSWORD=
# Server-side session lifetime. The contract default is 3600; the expiry test
# temporarily starts the API with a short value.
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:
SESSION_STORE=postgres
CACHE_URL_FILE=/run/secrets/cache_url
# Bounded pool and timeouts (level 4).
DB_MAX_CONNS=8
DB_MIN_CONNS=1
DB_CONNECT_TIMEOUT_SECONDS=3
DB_STATEMENT_TIMEOUT_SECONDS=3
DB_QUERY_TIMEOUT_SECONDS=3
CACHE_POOL_SIZE=8
CACHE_TIMEOUT_SECONDS=2
SHUTDOWN_TIMEOUT_SECONDS=8
STARTUP_TIMEOUT_SECONDS=30