# RDMC 系统架构设计图
## 1. RDMC 整体系统架构图
```mermaid
graph TB
subgraph "RDMC 平台核心 (内网环境)"
Portal["前端门户
Vue3+Vuetify3+TypeScript"]
subgraph "核心业务模块"
JenkinsDAC["jenkins-branch-dac
Jenkins分支管理"]
LogCenter["log-center
日志中心"]
MonitorCenter["monitor-center
监控中心"]
DeliveryUpdate["delivery-update
业务更新"]
Notice["notice-center
消息通知中心"]
Operator["octopus-operator
执行中心"]
ProjectMgmt["project-management
项目管理"]
Audit["audit-log
审计模块"]
end
subgraph "基础设施层"
WatchdogCenter["watchdog-center
一级授权中心"]
ExchangeHub["exchange-hub
消息网关"]
UserAuth["user-auth
用户认证"]
Core["rmdc-core
API Gateway
Go+Gin+GORM"]
DB[(PostgreSQL
业务数据库)]
end
MQTT[(MQTT Broker
EMQX/Mosquitto)]
end
subgraph "外部系统"
Jenkins[Jenkins CI/CD]
DingTalk[钉钉告警]
MinIO[MinIO 对象存储]
end
subgraph "项目环境 A (外网/隔离网络)"
K8sA[Kubernetes Cluster A]
subgraph "Namespace: project-a"
WatchdogA["rmdc-watchdog
二级授权中心
K8s Operator"]
subgraph "微服务Pod"
ServiceA1["业务A1
watchdog-agent"]
ServiceA2["业务A2
watchdog-agent"]
end
end
subgraph "主机层"
HostA1["主机A1
watchdog-node
DaemonSet"]
HostA2["主机A2
watchdog-node
DaemonSet"]
end
end
subgraph "项目环境 B (外网/隔离网络)"
K8sB[Kubernetes Cluster B]
subgraph "Namespace: project-b"
WatchdogB["rmdc-watchdog
二级授权中心"]
ServiceB1["业务B1
watchdog-agent"]
end
HostB1["主机B1
watchdog-node"]
end
%% 前端到后端连接
Portal --> Core
%% 核心模块连接
Core --> JenkinsDAC
Core --> LogCenter
Core --> MonitorCenter
Core --> DeliveryUpdate
Core --> Notice
Core --> Operator
Core --> ProjectMgmt
Core --> Audit
Core --> UserAuth
%% 项目管理与授权中心
ProjectMgmt -.项目创建/授权.-> WatchdogCenter
WatchdogCenter -.授权信息.-> ExchangeHub
%% Exchange-Hub与MQTT
ExchangeHub <==订阅/发布==> MQTT
%% 业务模块到Exchange-Hub
LogCenter -.指令下发.-> ExchangeHub
MonitorCenter -.指令下发.-> ExchangeHub
DeliveryUpdate -.指令下发.-> ExchangeHub
Operator -.指令下发.-> ExchangeHub
%% MQTT到外部项目 (跨公网)
MQTT <=="Command/Message
公网"==> WatchdogA
MQTT <=="Command/Message
公网"==> WatchdogB
%% 项目内部通信
WatchdogA <--"授权心跳
TOTP验证"--> ServiceA1
WatchdogA <--"授权心跳
TOTP验证"--> ServiceA2
WatchdogA <--"主机信息
指令执行"--> HostA1
WatchdogA <--"主机信息
指令执行"--> HostA2
WatchdogB <--授权心跳--> ServiceB1
WatchdogB <--主机信息--> HostB1
%% 数据持久化
Core --> DB
ExchangeHub --> DB
%% 外部系统集成
JenkinsDAC --> Jenkins
Notice --> DingTalk
DeliveryUpdate --> MinIO
style ExchangeHub fill:#ff6b6b,stroke:#c92a2a,stroke-width:3px
style MQTT fill:#ffd43b,stroke:#f08c00,stroke-width:2px
style WatchdogA fill:#4ecdc4,stroke:#087f5b,stroke-width:2px
style WatchdogB fill:#4ecdc4,stroke:#087f5b,stroke-width:2px
style WatchdogCenter fill:#ff8787,stroke:#c92a2a,stroke-width:2px
style Portal fill:#845ef7,stroke:#5f3dc4
style ProjectMgmt fill:#a9e34b,stroke:#5c940d,stroke-width:2px
```
---
## 2. 模块层级架构图
```mermaid
graph TB
subgraph "用户层"
User["用户/管理员"]
end
subgraph "表现层 (Presentation)"
Frontend["Vue3 + Vuetify3
SPA应用"]
end
subgraph "网关层 (Gateway)"
APIGateway["rmdc-core
API Gateway
路由 | 鉴权 | 限流"]
end
subgraph "业务层 (Business)"
subgraph "业务模块"
M1["jenkins-branch-dac"]
M2["log-center"]
M3["monitor-center"]
M4["delivery-update"]
M5["notice-center"]
M6["octopus-operator"]
M7["project-management"]
end
subgraph "基础模块"
Auth["user-auth
用户认证授权"]
AuditLog["audit-log
审计日志"]
end
end
subgraph "通信层 (Communication)"
ExHub["exchange-hub
消息网关"]
end
subgraph "消息中间件层"
MQTT["MQTT Broker"]
end
subgraph "边缘层 (Edge)"
direction LR
WD["rmdc-watchdog
二级授权中心"]
WDNode["watchdog-node
主机守护"]
WDAgent["watchdog-agent
业务代理"]
end
subgraph "数据层 (Data)"
PG[(PostgreSQL)]
end
User --> Frontend
Frontend --> APIGateway
APIGateway --> M1
APIGateway --> M2
APIGateway --> M3
APIGateway --> M4
APIGateway --> M5
APIGateway --> M6
APIGateway --> M7
APIGateway --> Auth
APIGateway --> AuditLog
M2 --> ExHub
M3 --> ExHub
M4 --> ExHub
M6 --> ExHub
M7 --> ExHub
ExHub <--> MQTT
MQTT <--> WD
WD --> WDNode
WD --> WDAgent
M1 --> PG
Auth --> PG
AuditLog --> PG
ExHub --> PG
M3 --> PG
M7 --> PG
style ExHub fill:#ff6b6b,stroke:#c92a2a
style MQTT fill:#ffd43b,stroke:#f08c00
style WD fill:#4ecdc4,stroke:#087f5b
```
---
## 3. 通信架构图
```mermaid
graph LR
subgraph "RMDC平台"
Portal["前端门户"]
API["API Gateway"]
ExHub["Exchange-Hub"]
Modules["业务模块"]
end
subgraph "消息通道"
MQTT["MQTT Broker"]
end
subgraph "外部项目"
WD["Watchdog"]
Node["Node"]
Agent["Agent"]
end
Portal ==HTTP/REST==> API
API ==内部调用==> Modules
Modules ==指令请求==> ExHub
ExHub ==MQTT Publish==> MQTT
MQTT ==MQTT Subscribe==> WD
WD ==执行结果==> MQTT
MQTT ==结果推送==> ExHub
ExHub ==结果返回==> Modules
WD <==内网通信==> Node
WD <==内网通信==> Agent
style MQTT fill:#ffd43b,stroke:#f08c00,stroke-width:2px
style ExHub fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px
```
---
## 4. 数据流向图
```mermaid
flowchart TD
subgraph "指令下行流程"
direction TB
U1[用户操作] --> F1[前端请求]
F1 --> A1[API Gateway]
A1 --> M1[业务模块]
M1 --> E1[Exchange-Hub]
E1 --> Q1[MQTT Broker]
Q1 --> W1[Watchdog]
W1 --> T1{目标类型}
T1 -->|K8S| K1[K8S API]
T1 -->|主机| N1[watchdog-node]
T1 -->|业务| G1[watchdog-agent]
end
subgraph "数据上行流程"
direction BT
K2[K8S执行结果] --> W2[Watchdog]
N2[主机执行结果] --> W2
G2[业务状态] --> W2
W2 --> Q2[MQTT Broker]
Q2 --> E2[Exchange-Hub]
E2 --> D1{数据类型}
D1 -->|执行结果| M2[Operator]
D1 -->|监控数据| M3[Monitor]
D1 -->|日志数据| M4[LogCenter]
D1 -->|告警数据| M5[Notice]
end
style E1 fill:#ff6b6b,stroke:#c92a2a
style E2 fill:#ff6b6b,stroke:#c92a2a
style Q1 fill:#ffd43b,stroke:#f08c00
style Q2 fill:#ffd43b,stroke:#f08c00
```