Skip to content

Commit

Permalink
docs(config): 添加系统配置文档
Browse files Browse the repository at this point in the history
- 新增公共配置、广寒宫配置、后裔配置和月兔配置的详细说明
- 添加了各种配置项的示例和解释
- 优化了文档结构,增加了标题和小节
  • Loading branch information
aide-cloud committed Nov 15, 2024
1 parent e0f2f11 commit d22acb5
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 1 deletion.
190 changes: 190 additions & 0 deletions docs/3-config/1-public-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,193 @@ sidebar_position: 1

# 公共配置

## 服务配置

```protobuf
// 服务配置
message Server {
// 服务名称
string name = 1;
// 服务元数据
map<string, string> metadata = 2;
// 服务http地址
string httpEndpoint = 3;
// grpc地址
string grpcEndpoint = 4;
// 网络类型
string network = 5;
optional string secret = 6;
//上线时间
string startTime = 7;
//在线时长
string upTime = 8;
}
```

## HTTP服务配置

```protobuf
// http服务配置
message HTTPServer {
// 网络类型
string network = 1;
// 服务地址
string addr = 2;
// 读写超时时间
google.protobuf.Duration timeout = 3;
}
```

## GRPC服务配置

```protobuf
// grpc服务配置
message GRPCServer {
// 网络类型
string network = 1;
// 服务地址
string addr = 2;
// 读写超时时间
google.protobuf.Duration timeout = 3;
}
```

## 服务发现配置

```protobuf
// 服务注册发现配置
message Discovery {
// 类型, 名称和数据源保持一致,例如etcd
string driver = 1;
// 数据源
ETCD etcd = 2;
}
```

## etcd配置

```protobuf
// ETCD数据源配置
message ETCD {
// 端点
repeated string endpoints = 1;
// 连接超时
optional google.protobuf.Duration timeout = 2;
// 用户名
optional string username = 3;
// 密码
optional string password = 4;
}
```

## 日志配置

```protobuf
message Log {
// default, slog, aliyun, zap
string type = 1;
// 日志级别
string level = 2;
// 阿里云日志
optional AliYunLogConfig aliyun = 4;
// zap日志
optional ZapLogConfig zap = 5;
// slog日志
optional SLogConfig slog = 6;
// loki日志
optional LokiLogConfig loki = 7;
}
```

## 数据库配置

```protobuf
// 数据库配置
message Database {
// 驱动, 支持gorm即可
string driver = 1;
// 数据库连接串
string dsn = 2;
// 是否开启调试
bool debug = 3;
}
```

## 缓存配置

```protobuf
// 缓存配置
message Cache {
//redis nuts-db free
string driver = 1;
// redis配置
Redis redis = 2;
// nuts db配置
NutsDB nutsDB = 3;
// 内存缓存配置
Free free = 4;
}
```

## 邮件发送配置

```protobuf
// 邮件发送配置
message EmailConfig {
// 用户
string user = 1;
// 发送的邮箱密码
string pass = 2;
// 发送的邮箱服务器
string host = 3;
// 发送的邮箱端口
uint32 port = 4;
}
```

## 链路追踪配置

```protobuf
// 链路追踪配置
message Tracer {
// 驱动, 支持jaeger
string driver = 1;
// jaeger配置
Jaeger jaeger = 2;
}
```

## 通知接收对象配置

```protobuf
message Receiver {
repeated ReceiverHook hooks = 1;
repeated ReceiverPhone phones = 2;
repeated ReceiverEmail emails = 3;
EmailConfig emailConfig = 4;
}
```

## 微服务配置

```protobuf
// 微服务配置
message MicroServer {
// 服务地址
string endpoint = 1;
// 密钥
optional string secret = 2;
// 超时时间
optional google.protobuf.Duration timeout = 3;
// 网络类型, http, https, grpc
string network = 4;
// node版本
string nodeVersion = 5;
// name 服务名
string name = 6;
}
```
72 changes: 71 additions & 1 deletion docs/3-config/2-palace-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,75 @@
sidebar_position: 2
---

# 服务端(Palace)配置
# 广寒宫(Palace)配置

```protocol
message Bootstrap {
pkg.conf.Server server = 1;
pkg.conf.HTTPServer http = 2;
pkg.conf.GRPCServer grpc = 3;
pkg.conf.JWT jwt = 4;
pkg.conf.Cache cache = 6;
pkg.conf.Tracer tracer = 7;
pkg.conf.Discovery discovery = 8;
pkg.conf.Oss oss = 9;
Watch watch = 10;
OAuth2 oauth2 = 11;
pkg.conf.EmailConfig email_config = 12;
// 主库, 用于维护系统配置、用户等
pkg.conf.Database database = 13;
// 业务数据库,多租户场景下的业务数据, 业务数据采用分表存储
pkg.conf.Database bizDatabase = 14;
// 告警历史存储位置
pkg.conf.Database alarmDatabase = 15;
// 环境标识
string env = 16;
// 是否依赖HouYi服务
bool dependHouYi = 17;
// 是否依赖Rabbit服务
bool dependRabbit = 18;
// metrics配置
string metricsToken = 19;
// log配置
pkg.conf.Log log = 20;
}
// 微服务配置
message MicroServer {
// 月兔消息服务
pkg.conf.MicroServer rabbit_server = 1;
// 后羿代理服务
pkg.conf.MicroServer hou_yi_server = 2;
// 后羿服务多实例配置(此配置优先级高于单实例配置)
repeated pkg.conf.MicroServer hou_yi_servers = 3;
}
message Watch {
message Strategy {
// 超时时间
google.protobuf.Duration timeout = 1;
// 执行频率 cron 表达式
string interval = 2;
}
message AlertEvent {
// 超时时间
google.protobuf.Duration timeout = 1;
// 执行频率
google.protobuf.Duration interval = 2;
}
Strategy strategy = 1;
AlertEvent alertEvent = 2;
}
message OAuth2 {
message Config {
string client_id = 1;
string client_secret = 2;
string callback_uri = 3;
repeated string scopes = 5;
}
string redirect_uri = 1;
Config github = 2;
Config gitee = 3;
}
```
45 changes: 45 additions & 0 deletions docs/3-config/3-houyi-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
sidebar_position: 3
---

# 后裔(HouYi)配置

```protocol
message Bootstrap {
pkg.conf.Server server = 1;
string env = 2;
Watch watch = 3;
// 月宫代理服务
pkg.conf.MicroServer palace_server = 5;
// 服务发现配置, 如果配置了服务发现,endpoint则会被当作服务发现地址, 没有配置直接当作服务地址
pkg.conf.Discovery discovery = 6;
pkg.conf.HTTPServer http = 7;
pkg.conf.GRPCServer grpc = 8;
pkg.conf.Cache cache = 9;
// 是否依赖Palace服务
bool dependPalace = 10;
// 选择团队, 为空则默认为所有团队
repeated uint32 teams = 11;
// metrics配置
string metricsToken = 19;
// log配置
pkg.conf.Log log = 20;
}
message Watch {
message Strategy {
// 超时时间
google.protobuf.Duration timeout = 1;
// 执行频率 cron 表达式
string interval = 2;
}
message AlertEvent {
// 超时时间
google.protobuf.Duration timeout = 1;
// 执行频率
google.protobuf.Duration interval = 2;
}
Strategy strategy = 1;
AlertEvent alertEvent = 2;
}
```
30 changes: 30 additions & 0 deletions docs/3-config/4-rabbit-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
sidebar_position: 4
---

# 月兔(Rabbit)配置

```protocol
message Bootstrap {
pkg.conf.Server server = 1;
string env = 3;
// 根据路由匹配具体的发送对象
map<string, pkg.conf.Receiver> receivers = 4;
map<string, string> templates = 5;
// 全局邮件配置
pkg.conf.EmailConfig global_email_config = 6;
// 服务发现配置, 如果配置了服务发现,endpoint则会被当作服务发现地址, 没有配置直接当作服务地址
pkg.conf.Discovery discovery = 7;
pkg.conf.HTTPServer http = 8;
pkg.conf.GRPCServer grpc = 9;
pkg.conf.Cache cache = 10;
repeated uint32 teams = 11;
bool dependPalace = 12;
// 月宫代理服务
pkg.conf.MicroServer palace_server = 13;
// metrics配置
string metricsToken = 19;
// log配置
pkg.conf.Log log = 20;
}
```

0 comments on commit d22acb5

Please sign in to comment.