2023-05-21 01:46:52 +08:00
|
|
|
|
# chassis <ˈʃæsi>
|
2023-05-21 01:34:58 +08:00
|
|
|
|
|
2023-05-21 01:46:52 +08:00
|
|
|
|
chassis <ˈʃæsi> n. 底盘,底架
|
|
|
|
|
|
2023-05-23 22:22:04 +08:00
|
|
|
|
仓库名寓意服务的底盘,基础库。搭建微服务底盘是为了简化服务的创建过程,同时确保开发者遵循这套开发标准。
|
|
|
|
|
|
|
|
|
|
## 包含的特性
|
|
|
|
|
|
2023-05-29 18:43:47 +08:00
|
|
|
|
1. 模板代码
|
|
|
|
|
- nameko 微服务
|
|
|
|
|
- apiflask Web 服务
|
|
|
|
|
- rocketry 定时任务服务
|
|
|
|
|
2. 事务
|
|
|
|
|
- 实现 Saga 模式
|
|
|
|
|
3. 查询
|
|
|
|
|
4. 高可用
|
|
|
|
|
1.
|
|
|
|
|
5. 可观测 Observability
|
2023-05-26 13:49:44 +08:00
|
|
|
|
1. Metrics
|
|
|
|
|
- Statsd + Prometheus + Grafana)
|
|
|
|
|
2. Logging
|
|
|
|
|
- ELK
|
|
|
|
|
3. Tracing
|
|
|
|
|
- TODO, Maybe OpenTelemetry
|
|
|
|
|
4. Error Reporting
|
|
|
|
|
- Sentry
|
2023-05-29 18:43:47 +08:00
|
|
|
|
6. 数据存储相关 utils
|
2023-05-23 22:22:04 +08:00
|
|
|
|
1. Sqlalchemy
|
|
|
|
|
- 连接池
|
|
|
|
|
- 读写分离
|
|
|
|
|
2. Redis
|
|
|
|
|
- 连接池
|
|
|
|
|
3. ElasticSearch
|
2023-05-29 18:43:47 +08:00
|
|
|
|
4. 数据库迁移
|
|
|
|
|
- Alembic
|
|
|
|
|
7. 服务注册和发现 (RabbitMQ)
|
|
|
|
|
8. 配置获取 (TODO)
|
2023-05-23 22:22:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 实现的功能
|
|
|
|
|
|
2023-05-29 18:43:47 +08:00
|
|
|
|
- 服务注册和发现(RabbitMQ)
|
|
|
|
|
- 同步/异步传输(RabbitMQ)
|
|
|
|
|
- 负载均衡(RabbitMQ)
|
|
|
|
|
- 限流降级(消息确认+断路器)
|
|
|
|
|
- 健康检查
|
|
|
|
|
- 通过可观测实现(Metrics + Logging + Tracing + Error Reporting)
|
2023-05-22 15:54:01 +08:00
|
|
|
|
|
2023-05-29 18:43:47 +08:00
|
|
|
|
|
2023-05-23 22:22:04 +08:00
|
|
|
|
## 安装方法
|
|
|
|
|
|
|
|
|
|
基础代码库:
|
|
|
|
|
`python3 -m pip install --trusted-host=gitea.bearcatlog.com git+https://gitea.bearcatlog.com/BryantStudio/chassis.git@main`
|
|
|
|
|
|
|
|
|
|
基础代码库依赖的服务:
|
|
|
|
|
`python3 -m pip install --trusted-host=gitea.bearcatlog.com git+https://gitea.bearcatlog.com/BryantStudio/chassis-agent.git@main`
|