diff --git a/README.md b/README.md index 3e84287..94a9355 100644 --- a/README.md +++ b/README.md @@ -20,28 +20,38 @@ FreeCar is a cloud-native time-sharing car rental system suite based on Hertz an ## Technology Stack -| Function | Implementation | -|--------------------------------------------|-----------------------| -| HTTP Framework | Hertz | -| RPC Framework | Kitex | -| Database | MongoDB, MySQL, Redis | -| Authentication | Paseto | -| Service Discovery and Configuration Center | Consul | -| Message Queue | RabbitMQ | -| Service Governance | OpenTelemetry | -| Current Limiting Fuse | Sentinel | -| Object Storage | Minio | -| Image Recognition | Baidu OCR | -| CI | GitHub Actions | +| Function | Implementation | +|----------------------------------|-----------------------| +| HTTP Framework | Hertz | +| RPC Framework | Kitex | +| Database | MongoDB, MySQL, Redis | +| Authentication | Paseto | +| Service and Configuration Center | Consul | +| Metrics Monitoring | Prometheus | +| Tracing | Jaeger | +| Message Queue | RabbitMQ | +| Service Governance | OpenTelemetry | +| Current Limiting Fuse | Sentinel | +| Object Storage | MinIO | +| Image Recognition | Baidu OCR | +| CI | GitHub Actions | ## Display -Small program terminal address [FreeCar-MP](https://github.com/CyanAsterisk/FreeCar-MP) +### Mini Program -Background management terminal address TODO +Mini program project address [FreeCar-MP](https://github.com/CyanAsterisk/FreeCar-MP) ![display.png](img/display.png) +### Admin + +Admin project address [FreeCar-Admin](https://github.com/CyanAsterisk/FreeCar-Admin) + +![data-analize.png](img/data-analize.png) + +![back.png](img/back.png) + ## Catalog Introduce | Catalog | Introduction | @@ -56,7 +66,7 @@ Background management terminal address TODO |---------|----------------------------------------------------| | API | Hertz-based gateway service | | User | User Authentication Service | -| Blob | Services related to image and Minio object storage | +| Blob | Services related to image and MinIO object storage | | Car | Car Service | | Profile | Home Page and Image Recognition Service | | Trip | Itinerary Services | @@ -101,15 +111,43 @@ make trip ![jaeger.jpg](img/jaeger.png) +![jaeger2.png](img/jaeger2.png) + ### Prometheus > Visit `http://127.0.0.1:3000/` on your browser ![prometheus.jpg](img/prometheus.png) +### MinIO + +> Visit `http://127.0.0.1:9000/` on your browser + +![minio.jpg](img/minio.png) + +## Deploy the Basic Environment Through K8s + +```shell +cd deployment/freecar-k8s +make all +``` + +### Pod + +![pod.png](img/pod.png) + +### PVC + +![pvc.png](img/pvc.png) + +### Service + +![service.png](img/service.png) + ## Development Guide -It is very difficult to understand this project by directly reading the source code. Here is a development guide for developers to quickly understand and get started with this project, including frameworks such as Kitex and Hertz. +It is very difficult to understand this project by directly reading the source code. Here is a development guide for +developers to quickly understand and get started with this project, including frameworks such as Kitex and Hertz. ### Preparation @@ -143,7 +181,8 @@ service UserService { #### Kitex -First generate `kitex_gen` in the `shared` folder, and then rely on `kitex_gen` in the corresponding service folder to generate. Execute under the new service directory, only need to change the service name and IDL path each time. +First generate `kitex_gen` in the `shared` folder, and then rely on `kitex_gen` in the corresponding service folder to +generate. Execute under the new service directory, only need to change the service name and IDL path each time. ```shell kitex -module github.com/CyanAsterisk/FreeCar ./../idl/rpc/user.thrift @@ -152,7 +191,8 @@ kitex -service user -module github.com/CyanAsterisk/FreeCar -use github.com/Cyan Note: -- Use `-module github.com/CyanAsterisk/FreeCar` This parameter is used to specify the Go module to which the generated code belongs to avoid path problems. +- Use `-module github.com/CyanAsterisk/FreeCar` This parameter is used to specify the Go module to which the generated + code belongs to avoid path problems. - When the current service needs to call other services, it needs to rely on `kitex_gen`. #### Hertz @@ -170,7 +210,8 @@ Note: ### Business Development -After the code is generated, some necessary components need to be added to the project. Since the api layer does not need to be added again, the following mainly explains about Kitex-Server +After the code is generated, some necessary components need to be added to the project. Since the api layer does not +need to be added again, the following mainly explains about Kitex-Server section, the code is located under `server/cmd`. #### Config @@ -179,17 +220,22 @@ Refer to `server/cmd/user/config` for the configuration structure of microservic #### Initialize -Refer to `server/cmd/user/initialize` to provide the initialization function of the necessary components, among which `config.go` `registry.go` `flag.go` `logger.go` are required. +Refer to `server/cmd/user/initialize` to provide the initialization function of the necessary components, among +which `config.go` `registry.go` `flag.go` `logger.go` are required. #### Pkg -Refer to `server/cmd/user/pkg` to provide calling functions of microservices, which are mainly used to implement the interfaces defined in `handler.go`. +Refer to `server/cmd/user/pkg` to provide calling functions of microservices, which are mainly used to implement the +interfaces defined in `handler.go`. #### API -When writing the business logic of the gateway layer, you only need to update the IDL and the new microservice client code each time. If you need to add new components, you can add them directly. The project is highly pluggable, and the architecture is similar to the microservice layer. +When writing the business logic of the gateway layer, you only need to update the IDL and the new microservice client +code each time. If you need to add new components, you can add them directly. The project is highly pluggable, and the +architecture is similar to the microservice layer. -The business logic of the gateway layer is under `server/cmd/api/biz`, and most of the code will be automatically generated. If you need to add a new route separately, you need to go to `server/cmd/api/router.go`. +The business logic of the gateway layer is under `server/cmd/api/biz`, and most of the code will be automatically +generated. If you need to add a new route separately, you need to go to `server/cmd/api/router.go`. Regarding the use of middleware, you only need to add middleware logic in `server/cmd/api/biz/router/api/middleware.go`. diff --git a/README_zh.md b/README_zh.md index 43ca2f2..4975216 100644 --- a/README_zh.md +++ b/README_zh.md @@ -20,28 +20,39 @@ FreeCar 是一个基于 Hertz 与 Kitex 的云原生分时汽车租赁系统套 ## 技术栈 -| 功能 | 实现 | -|-----------|---------------------| -| HTTP 框架 | Hertz | -| RPC 框架 | Kitex | -| 数据库 | MongoDB、MySQL、Redis | -| 身份鉴权 | Paseto | -| 服务发现与配置中心 | Consul | -| 消息队列 | RabbitMQ | -| 服务治理 | OpenTelemetry | -| 限流熔断 | Sentinel | -| 对象存储 | Minio | -| 图像识别 | 百度 OCR | -| CI | GitHub Actions | +| 功能 | 实现 | +|---------|---------------------| +| HTTP 框架 | Hertz | +| RPC 框架 | Kitex | +| 数据库 | MongoDB、MySQL、Redis | +| 身份鉴权 | Paseto | +| 服务与配置中心 | Consul | +| 消息队列 | RabbitMQ | +| 服务治理 | OpenTelemetry | +| 指标监控 | Prometheus | +| 链路追踪 | Jaeger | +| 限流熔断 | Sentinel | +| 对象存储 | MinIO | +| 图像识别 | 百度 OCR | +| CI | GitHub Actions | ## 页面展示 -小程序端地址 [FreeCar-MP](https://github.com/CyanAsterisk/FreeCar-MP) +### 小程序端 -后台管理端地址 TODO +小程序端地址 [FreeCar-MP](https://github.com/CyanAsterisk/FreeCar-MP) ![display.png](img/display.png) +### 后台管理系统 + +后台管理系统地址 [FreeCar-Admin](https://github.com/CyanAsterisk/FreeCar-Admin) + +![data-analize.png](img/data-analize.png) + +![back.png](img/back.png) + + ## 目录介绍 | 目录 | 介绍 | @@ -56,7 +67,7 @@ FreeCar 是一个基于 Hertz 与 Kitex 的云原生分时汽车租赁系统套 |---------|----------------------| | API | 基于 Hertz 的网关服务 | | User | 用户认证服务 | -| Blob | 与图片和 Minio 对象存储相关的服务 | +| Blob | 与图片和 MinIO 对象存储相关的服务 | | Car | 汽车服务 | | Profile | 主页与图片识别服务 | | Trip | 行程服务 | @@ -101,12 +112,40 @@ make trip ![jaeger.jpg](img/jaeger.png) +![jaeger2.png](img/jaeger2.png) + ### Prometheus > 在浏览器上访问 `http://127.0.0.1:3000/` ![prometheus.jpg](img/prometheus.png) +### MinIO + +> 在浏览器上访问 `http://127.0.0.1:9000/` + +![minio.jpg](img/minio.png) + +## 通过 K8s 部署基础环境 + +```shell +cd deployment/freecar-k8s +make all +``` + +### Pod + +![pod.png](img/pod.png) + +### PVC + +![pvc.png](img/pvc.png) + +### Service + +![service.png](img/service.png) + + ## 开发指南 通过直接阅读源码来了解此项目是非常困难的,在此提供开发指南方便开发者快速了解并上手此项目包括 Kitex、Hertz 等框架。 @@ -142,7 +181,8 @@ service UserService { #### Kitex -首先在 `shared` 文件夹下生成 `kitex_gen`,再在相对应服务文件夹下依赖 `kitex_gen` 进行生成。在新增服务目录下执行,每次仅需更改服务名与 IDL 路径。 +首先在 `shared` 文件夹下生成 `kitex_gen`,再在相对应服务文件夹下依赖 `kitex_gen` 进行生成。在新增服务目录下执行,每次仅需更改服务名与 +IDL 路径。 ```shell kitex -module github.com/CyanAsterisk/FreeCar ./../idl/rpc/user.thrift diff --git a/img/back.png b/img/back.png new file mode 100644 index 0000000..a63f1b8 Binary files /dev/null and b/img/back.png differ diff --git a/img/data-analize.png b/img/data-analize.png new file mode 100644 index 0000000..60b1a27 Binary files /dev/null and b/img/data-analize.png differ diff --git a/img/jaeger2.png b/img/jaeger2.png new file mode 100644 index 0000000..5af0b5e Binary files /dev/null and b/img/jaeger2.png differ diff --git a/img/minio.png b/img/minio.png new file mode 100644 index 0000000..4569cf4 Binary files /dev/null and b/img/minio.png differ diff --git a/img/pod.png b/img/pod.png new file mode 100644 index 0000000..b46908a Binary files /dev/null and b/img/pod.png differ diff --git a/img/pvc.png b/img/pvc.png new file mode 100644 index 0000000..36003c6 Binary files /dev/null and b/img/pvc.png differ diff --git a/img/service.png b/img/service.png new file mode 100644 index 0000000..86fb71e Binary files /dev/null and b/img/service.png differ