Replicator Operations
Security, monitoring, and recovery guidance for the bridge runtime.
Replicator Operations
Security checklist
- Scope
CONVEX_REPLICATOR_TOKENto the workspace and rotate regularly. - Protect
replicator.config.jsonand state files; they contain secrets. - Route inbound mutations through the provided helpers to reuse canonical validation.
- Enforce rate limits on
applyExternalMutation(baseline 100 writes/minute with burst allowance). - Keep transport encrypted end-to-end (Convex HTTPS/WSS).
Monitoring hooks
- Subscribe to
onHeartbeatfor lag and status metrics. - Stream structured logs via
logPathinto your logging stack. - Watch
.entitycli/bridge/state/<node>.jsonfor heartbeat timestamps and PID updates. - Alert on heartbeat staleness (>60 seconds) or growing lag between processed and latest versions.
Failure recovery
- Restart crashes using the persisted state; offsets resume automatically.
- Implement retry/backoff within adapters; halt on irrecoverable errors to avoid data divergence.
- On Convex action rejection, revert local state to the last confirmed version and surface the error.
- For large backlogs, reduce
eventsPerBatchor run parallel replicas; events support replay from any version.
Maintenance
- Snapshot local databases periodically; the event log can rebuild from version 0.
- Purge
.entitycli/bridge/stateentries when decommissioning workspaces. - Stay current with
@entityauth/replicatorreleases to pick up adapter fixes. - Run
pnpm build:packsbefore publishing CLI shims to bundle the latest templates.
Troubleshooting
bridge statusreveals entry path, env, heartbeat, and logs path.- Use the memory demo template to validate connectivity without touching production.
- Set
LOG_LEVEL=debug(template support) for verbose processing traces. - If cursors stall, inspect the offset store and file permissions.