- схема и миграции (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>
16 lines
760 B
Bash
Executable File
16 lines
760 B
Bash
Executable File
#!/bin/sh
|
|
# Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`.
|
|
# Restarts the API and ALL state stores (PostgreSQL, Valkey) of compose.yaml.
|
|
# Volumes, schema and data are preserved: no `down -v`, no FLUSH, no re-seed.
|
|
# Output is suppressed by the test; run it by hand to see the steps.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# 1. API first: no request is served while the stores restart underneath it.
|
|
docker compose stop api
|
|
# 2. Stores: clean shutdown (PostgreSQL checkpoint, Valkey AOF fsync), then start again.
|
|
docker compose restart postgres valkey
|
|
# 3. API again; it waits for healthy stores via depends_on and reconnects its pool.
|
|
docker compose start api
|
|
echo "restart.sh: api, postgres and valkey restarted with volumes preserved"
|