Runbooks
Operational procedures for common tasks.
Restart services
Local
# Backend: Ctrl+C, then
uv run uvicorn app.main:app --reload --port 8001
# Frontend: Ctrl+C, then
pnpm dev
Docker
docker compose restart backend
docker compose restart frontend
# Or restart all:
docker compose restart
Run database migrations
cd backend
uv run alembic upgrade head
For a new migration:
uv run alembic revision --autogenerate -m "description"
# Edit the generated file if needed, then:
uv run alembic upgrade head
Rollback one migration:
uv run alembic downgrade -1
Clear Redis (if used)
redis-cli FLUSHALL
Or connect to the Redis used by the app and clear specific keys. Restart the backend after clearing if needed.
Rotate JWT secret key
- Generate new key:
openssl rand -hex 32 - Set
JWT_SECRET_KEYto the new value. - Set
JWT_SECRET_KEY_OLDto the current key (for validation during transition). - Deploy backend with both keys.
- After old tokens expire, remove
JWT_SECRET_KEY_OLD.
Enable maintenance mode
Set MAINTENANCE_MODE=true in the frontend environment. The app will show the maintenance page instead of the chat UI.
Invalidate all sessions (deploy-time)
Set SESSION_VERSION to a new value (e.g. build ID or timestamp) in the backend environment. The frontend checks X-Session-Version from /api/auth/me and can force logout when it changes.