This runbook covers operational handling for TinyDocy demo abuse guardrails:
- HTTP delete throttling
- WebSocket connection/document guardrails
- Retention purge safety
- Hocuspocus always runs via
bun run hocus(custom bootstrap + SQLite + extensions).
NEXT_PUBLIC_MAX_TABS_PER_CLIENT=50HTTP_MUTATION_RATE_LIMIT=30WS_CONNECTION_LIMIT=10DOC_CREATION_RATE_LIMIT=10MAX_TOTAL_DOCUMENTS=2000MAX_DOC_SIZE_BYTES=1048576RETENTION_DAYS=30TRUSTED_PROXY=0(1behind trusted reverse proxy)HOCUS_LOGGER=0to disable Hocuspocus Logger extensionHOCUS_THROTTLE=0to disable Hocuspocus Throttle extensionHOCUS_THROTTLE_MAX_ATTEMPTS,HOCUS_THROTTLE_WINDOW_SECONDS,HOCUS_THROTTLE_BAN_MINUTESHOCUS_REDIS=1to enable Hocuspocus Redis pub/sub extension (opt-in)HOCUS_REDIS_HOST(default:127.0.0.1)HOCUS_REDIS_PORT(default:6380, non-default to avoid host Redis conflicts)
Redis deployment notes:
ecosystem.config.cjsstarts Redis viaeditor-redis, which requires a host-installedredis-serverbinary.- Redis extension supports cross-instance signaling, but SQLite remains the persistence layer.
- Keep Hocuspocus to one instance per SQLite file unless persistence is moved to shared storage.
- P1: total document cap reached, users cannot create new docs
- P2: sustained throttle spike (
429or WS guardrail rejects) for 5+ minutes - P3: retention purge failure
Search logs for these JSON event names:
documents_delete_throttleddocuments_delete_invalid_iddocuments_delete_failedretention_purge_completedretention_purge_completed_retry
Expected healthy signals:
- Occasional throttles, low invalid-id noise
- Retention purge succeeds with bounded deletions
Failure signals:
- Sharp sustained increase in
documents_delete_throttled - Frequent
documents_delete_failed - Repeated missing/failed retention events
- Reduce blast radius by tightening/de-tuning env thresholds as needed.
- If WS runtime instability appears, restart the Hocus process; tune or disable
HOCUS_THROTTLE/ guardrail envs if false positives dominate. - If retention fails repeatedly, run purge manually after service stabilization.
- Use
X-Forwarded-For/X-Real-IPonly whenTRUSTED_PROXY=1. - In non-dev environments, private/reserved addresses are treated as unknown client identity.