- JWT claims extended with tenantId; login enforces strict tenant verification - AuthorityMiddleware: tenant scope check + Casbin path permission + anti-spoofing - CRM relation API (upstream/downstream one-hop, create/update/history, full graph) - CrmRepo backed by PostgreSQL with $N placeholders - gRPC tenant propagation via UnaryClientInterceptor (x-tenant-id metadata) - All legacy tables (12) gain tenant_id column with indexes - All model queries inject WHERE tenant_id filter - Casbin gorm-adapter downgraded to v3.28.0 for v2 compatibility - GraphSyncWorker (Kafka -> Neo4j) with idempotent MERGE - Full graph API restricted to admin role only - Database migrations for MySQL (CRM tables + tenant columns) and PostgreSQL (CRM init) - Docker Compose: added postgres service to main stack, graph stack with Kafka/Debezium/Neo4j Made-with: Cursor
806 B
806 B
Graph Stack Deploy Guide
This stack is the long-term CRM data architecture baseline:
- PostgreSQL as source of truth
- Kafka + Debezium for CDC
- Neo4j as graph analytics store
Start
cd muyu-apiserver/deploy
docker compose -f docker-compose.graph.yaml up -d
Endpoints
- PostgreSQL:
localhost:5432 - Kafka broker:
localhost:9092 - Debezium Connect:
http://localhost:8083 - Neo4j Browser:
http://localhost:7474 - Kafka UI:
http://localhost:8086
Stop
cd muyu-apiserver/deploy
docker compose -f docker-compose.graph.yaml down
Notes
- This stack does not yet migrate existing MySQL business tables.
- Existing API services still run with current MySQL model code.
- Next phase is to add GraphSyncWorker and migrate APIs to PostgreSQL-backed CRM tables.