Add PostgreSQL storage and Valkey sessions for lab2.

Messages survive restart in Postgres, and bearer sessions persist in Valkey with AOF.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
samsik
2026-10-09 01:21:39 +03:00
co-authored by Cursor
parent 65003b6119
commit ae4d626ce6
15 changed files with 1578 additions and 26 deletions
+7 -3
View File
@@ -4,8 +4,12 @@ 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.
# Sessions of this stand live in Valkey, not in PostgreSQL.
SESSION_STORE=valkey
POSTGRES_USER=messenger
POSTGRES_PASSWORD=local-only-change-me
POSTGRES_DB=messenger
# Optional file paths. The API reads a file when it exists, otherwise DATABASE_URL / REDIS_URL.
# Compose injects those URLs itself; do not put the database password into Git beyond this placeholder.
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