feat: PostgreSQL, Bearer-сессии (Valkey/PostgreSQL), Argon2id, миграции, compose

- схема и миграции (migrations/0001_init.sql, python -m messenger.migrate);
- регистрация с паролем (Argon2id), вход по Basic, opaque Bearer, logout, expiry;
- сессии: SESSION_STORE=valkey (AOF, appendfsync always) или postgres;
- пул соединений, statement/lock timeout и клиентский дедлайн: отказ БД = 503;
- keyset-пагинация по индексу (chat_id, created_at, id), два запроса без OR;
- compose.yaml с закреплёнными образами, secrets, restart.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alexey Bodanyuk
2026-10-12 19:24:11 +03:00
co-authored by Claude Opus 5.5
parent 893beaa79a
commit 01524165dd
28 changed files with 1710 additions and 249 deletions
+12 -4
View File
@@ -1,8 +1,16 @@
# Direct runtime dependencies. The pinned lock with hashes is requirements.txt:
# docker run --rm -v "$PWD:/w" -w /w python:3.13.15-slim-bookworm \
# sh -c "pip install -q pip-tools==7.6.1 && pip-compile --generate-hashes --strip-extras -o requirements.txt requirements.in"
# docker run --rm -v "$PWD:/w" -w /w python:3.13.16-slim-bookworm \
# sh -c "pip install -q pip-tools==7.6.1 && pip-compile --generate-hashes --strip-extras --no-emit-index-url -o requirements.txt requirements.in"
starlette==1.7.0
uvicorn==0.54.0
# Fast C parser/event loop used by uvicorn in the container (Linux only).
httptools==0.8.0
uvloop==0.22.1 ; sys_platform != "win32"
httptools==0.9.0
uvloop==0.23.0 ; sys_platform != "win32"
# PostgreSQL driver (libpq bundled in the binary wheel) and its async connection pool.
psycopg==3.3.6
psycopg-binary==3.3.6
psycopg-pool==3.3.3
# Valkey client (Valkey speaks the Redis protocol).
redis==8.1.0
# Argon2id password KDF.
argon2-cffi==25.1.0