How weops-lab/bk-lite works
Project Type and Purpose
• BlueKing Lite is a full-stack, microservices-based operations product. It includes:
• A React/Next.js “web” frontend
• A Django-based “server” API layer (multiple Django apps: cmdb, monitor, node_mgmt, opspilot, system_mgmt, console_mgmt)
• Standalone microservices (in “agents”, “metis”, “pilot” folders) for data collection, AI inference, conversational assistant
• Deployment manifests (Docker Compose, Kubernetes) for infra services
• Edge-deployed agents (fusion-collector, nats-executor, telegraf)
Break Down the Major Components
a. Frontend Layer (“web” directory)
• Next.js application
• Served via Traefik (or similar API gateway)
b. API Gateway & Authentication
• Traefik (ingress) routes UI requests to backends
• Keycloak deployed (infra/keycloak) for SSO/OAuth
c. Backend Services (Django “server” directory)
• Multiple Django apps, each exposing REST endpoints and NATS RPC
• Celery workers (for async jobs) using broker (Redis/RabbitMQ)
d. Messaging & RPC
• NATS for internal RPC between services and to agents
• RabbitMQ for pilot event bus (optional)
e. Edge Agents (“agents” directory)
• fusion-collector: SNMP/Telegraf based data collector pushing metrics to central Telegraf/VictoriaMetrics
• nats-executor: executes remote commands via NATS RPC on hosts
• stargazer: cloud-resource comparator and monitor agent
f. AI & Inference Microservices (“metis”, “pilot”)
• Metis: LLM-based anomaly detection, chunking, RAG, embedding, summarize APIs
• Pilot: Rasa-style conversational assistant bridging messaging channels (WeChat, DingTalk) with LLMs
g. Data Stores
• PostgreSQL clusters (per Django app)
• Neo4j for CMDB graph (optional)
• VictoriaMetrics (timeseries)
• Elasticsearch (search for RAG)
• Redis for caching, Celery broker
• MinIO or S3 for document storage
h. Infrastructure & Orchestration
• Docker Compose (dev) & Kubernetes (prod) manifests under “deploy”
• Longhorn for persistent volumes
• Monitoring: Prometheus, Grafana
Relationships and Data Flows
• User Browser → Traefik → Next.js UI
• UI → REST/GraphQL → Django API
• Django Apps ↔ NATS RPC → edge agents (for remote deploy/collect)
• Django Apps → Celery → async tasks → broker (Redis/RabbitMQ)
• fusion-collector/Telegraf agents → push metrics → central Telegraf → VictoriaMetrics
• Metis & Pilot expose their own HTTP/gRPC endpoints consumed by UI or other services
• Django apps read/write to PostgreSQL, Redis, Elasticsearch, Neo4j, MinIO
Architectural Patterns & Technologies
• Microservices pattern (small, focused services)
• Event-driven / message-based communication via NATS and RabbitMQ
• CQRS for metric collection vs. configuration management
• Externalize configuration via Helm/Kustomize (deploy/kubernetes)
• AI-first modules: embed-service, anomaly-detector, RAG service, orchestration agent (plan-execute, reactive agents)