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-06-05 18:36:19 +08:00
|
|
|
|
### 已包含
|
|
|
|
|
|
|
|
|
|
- 模板代码
|
2023-05-29 18:43:47 +08:00
|
|
|
|
- nameko 微服务
|
|
|
|
|
- apiflask Web 服务
|
2023-06-05 18:36:19 +08:00
|
|
|
|
- rocketry 定时任务服务
|
|
|
|
|
- 服务注册和发现 (RabbitMQ)
|
|
|
|
|
- 可观测 Observability
|
|
|
|
|
- Metrics
|
|
|
|
|
- Statsd + Prometheus + Grafana
|
|
|
|
|
- Logging
|
|
|
|
|
- fluentd + ELK
|
|
|
|
|
- Error Reporting
|
|
|
|
|
- Sentry
|
|
|
|
|
- 数据存储相关 utils
|
|
|
|
|
- Sqlalchemy
|
|
|
|
|
- 连接池
|
|
|
|
|
- 读写分离
|
2023-06-17 02:36:37 +08:00
|
|
|
|
- 数据库迁移
|
|
|
|
|
- Alembic
|
2023-06-05 18:36:19 +08:00
|
|
|
|
|
|
|
|
|
### TODO
|
|
|
|
|
|
2023-06-17 02:36:37 +08:00
|
|
|
|
- environs 替代 python-dotenv
|
2023-06-05 18:36:19 +08:00
|
|
|
|
- 可观测 Observability
|
2023-06-17 02:36:37 +08:00
|
|
|
|
- Tracing
|
|
|
|
|
- OpenTelemetry
|
2023-07-13 12:39:56 +08:00
|
|
|
|
- Skywalking
|
2023-06-05 18:36:19 +08:00
|
|
|
|
- 事务
|
|
|
|
|
- 基于开源库 DTM 实现 Saga 模式
|
|
|
|
|
- 高可用
|
|
|
|
|
- 重试
|
|
|
|
|
- 断路器
|
2023-06-05 19:45:55 +08:00
|
|
|
|
- 限流
|
|
|
|
|
- 缓存
|
|
|
|
|
- 健康检查
|
2023-06-05 18:36:19 +08:00
|
|
|
|
- 数据存储相关 utils
|
2023-06-17 02:36:37 +08:00
|
|
|
|
- Redis 连接池
|
2023-06-05 18:36:19 +08:00
|
|
|
|
- ElasticSearch
|
2023-07-13 12:39:56 +08:00
|
|
|
|
- mongodb 相关库
|
2023-06-05 18:36:19 +08:00
|
|
|
|
- 全局配置服务
|
2023-06-05 19:45:55 +08:00
|
|
|
|
- 配置工具
|
|
|
|
|
- 代码生成工具
|
|
|
|
|
- 容器打包工具
|
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-06-05 19:45:55 +08:00
|
|
|
|
## 部署
|
|
|
|
|
|
|
|
|
|
目前使用 docker compose 编排管理容器
|
|
|
|
|
|
|
|
|
|
后续期望迁移到 k8s or k3s 编排管理容器
|
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`
|
2023-06-21 18:26:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 备忘
|
|
|
|
|
|
|
|
|
|
metrics 方面
|
|
|
|
|
- 关注 nameko-prometheus 的进展
|
2023-07-13 12:39:56 +08:00
|
|
|
|
- https://github.com/Emplocity/nameko-prometheus
|
|
|
|
|
|
|
|
|
|
tracing 方面
|
|
|
|
|
- 尝试研究给 nameko 适配 skywalking agent
|