Skip to content

Operations

@nx/search has no independent deployment. It runs inside the host (commerce) container and shares its lifecycle, replicas, and resources. Operating it means operating Typesense, the Debezium connector, and the CDC consumer running in commerce.

1. Deployment

PropertyValue
ImageN/A - packaged into the commerce image
ReplicasN/A - equals commerce replicas
ResourcesAdds Kafka consumer + Typesense client memory to the host
ProbesHost probes; TypesenseHelper.getHealth() gates collection sync + circuit breaker
Migration modeOn-boot schema-drift check (no auto-apply); manual backfill scripts for changes
Snowflake ID rangeN/A

Dependencies that must be reachable

DependencyRequired forIf down
Typesensesearch + indexingBootstrap skips collection sync (logs warn); circuit breaker pauses CDC
Kafka + DebeziumCDC syncIndex stops updating; consumer reconnects; offsets uncommitted

No Traefik labels - the routes mount under the host service's base path (/v1/api/commerce/...).

2. Observability

SignalSourceWhere to look
LogsHost stdout (structured key-value)commerce pod logs - filter component scopes (ApplicationCdcComponent, TypesenseSearchEngineComponent)
CDC startuplog line Starting CDC consumer | Brokers… | DLQ… | CircuitBreaker…confirms topics + breaker state
Schema synclog Schema divergence detected | Collection: …indicates manual migration needed
Indexing throughputSearchIndexingService batch metricslog fields per batch
HealthTypesenseHelper.getHealth()breaker probe + bootstrap gate

Sync diagnostic

OperationCommand
Check Typesense ↔ source row countsCompare Postgres row counts against the Typesense collection's num_documents
Dry-run add-only schema migrationbun run migrate
Dry-run blue-green collection rebuildbun run migrate:rebuild

3. Security

ConcernMitigation
AuthNSearch routes inherit host JWT/Basic (AuthenticateStrategy.JWT, .BASIC)
AuthZsearch:search / search:search-count; mixin requires consumer authorize config
Tenant isolationresolveSearchScope() and-merges a where scope into every query
Typesense API keyAPP_ENV_TYPESENSE_API_KEY from host secrets; never in code
Kafka SASLAPP_ENV_KAFKA_SASL_* when broker requires auth
No client writesDocuments mutated only via CDC - no public write API

4. Runbook

4.1 Alert classes

AlertTriggerCheckFixEscalate
searchSchemaDivergencelog Schema divergence detected on bootCompare config vs live Typesense schemaRun backfill script for additive change; recreate collection only if data-loss-safebackend on-call
searchCdcLagCDC consumer falling behind / circuit OPENTypesense health, Kafka consumer-group lagRecover Typesense; breaker closes after quiet windowSRE on-call
searchDlqGrowthmessages accumulating in nx.seller.cdc.dlqInspect DLQ payloads + failure metadataFix mapper/data, replay from DLQbackend on-call
searchStaleresults missing recently-changed rowsCompare Postgres row counts vs Typesense num_documentsBackfill or replay affected topicsbackend on-call

4.2 Common operations

OperationCommand / Action
Tail CDC logskubectl logs -f deploy/commerce | grep -E 'Cdc|Typesense'
Verify sync countsCompare Postgres row counts vs the Typesense collection's num_documents
Apply add-only schema changesbun run migrate:apply (diff + PATCH onto live collections)
Rebuild a collection (breaking change)bun run migrate:rebuild:apply (blue-green copy + atomic alias swap)
Backfill existing DB rows into CDCbun run backfill:apply (Debezium incremental-snapshot signal)
Reindex after schema changeRecreate the diverged collection (data-loss-safe window) then backfill
Replay a CDC topicReset the Debezium connector / consumer-group offsets (infra-owned)

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.