1
-
2
1
# {{cookiecutter.repo_name}}:
3
2
4
3
> {{cookiecutter.project_short_description}}
5
4
6
- ## cookiecutter-go :
5
+ ## Cookiecutter-Go :
7
6
8
7
- https://github.com/better-go/cookiecutter-go
9
8
- 项目目录生成脚手架, 详细使用参考文档
10
9
11
- ## 服务列表:
12
-
13
- - [x] [ 队列 MQ Proxy] ( app/basic/queue/readme.md ) : ` app/basic/queue `
14
- - HTTP POST 方式: 异步发送消息到 rabbitmq
15
-
16
-
17
- ## 准备工作:
18
-
19
- ### 启动 RabbitMQ 容器:
20
-
21
- - ` deploy/local/Makefile `
22
- - 启动 docker 容器
23
-
24
- ``` bash
25
-
26
- cd deploy/local
27
-
28
- # 启动 docker 容器:
29
- make run.mq.rabbitmq
30
-
31
-
32
- ```
33
-
34
- - 本地 web UI 查看: http://localhost:15672/#/queues
35
- - 队列情况
36
-
37
- ### 启动 queue 服务:
38
-
39
- - ` app/basic/queue `
10
+ ## Go-Kratos 定制功能:
40
11
12
+ - [ go kratos 中间件] ( https://go-kratos.dev/docs/category/%E4%B8%AD%E9%97%B4%E4%BB%B6 )
41
13
42
- ``` bash
14
+ > 集成功能:
43
15
44
- # 安装项目依赖包:
45
- make go.mod.tidy
16
+ - [ ] 参数校验
17
+ - [ ] 日志集成
18
+ - [ ] tracing 集成: OpenTelemetry, jaeger
19
+ - [x] 服务发现/注册: consul
20
+ - [ ] grpc
21
+ - [ ] server: 限流器
22
+ - [ ] client: 熔断器
23
+ - [ ] 监控: prometheus
46
24
47
- # 切换到服务目录下:
48
- cd app/basic/queue
49
25
50
- # 启动服务
51
- make run.auto.reload
52
-
53
-
54
- ```
26
+ ## Requirements:
55
27
28
+ > 语言 & 框架:
56
29
30
+ - go 1.15+
31
+ - Web Framework: go-kratos
32
+ - RPC: gRPC
57
33
58
- ## Requirements :
34
+ > 依赖中间件 :
59
35
60
- - go 1.15+
61
- - go-zero
62
- - gRPC
63
- - mysql
64
- - redis
65
- - kafka
66
- - docker + docker-compose
36
+ - 数据库: mysql
37
+ - 缓存: redis
38
+ - 消息队列: kafka
39
+ - 服务注册/发现: consul
40
+ - Tracing: jaeger
41
+ - 日志平台: ELK (Elasticsearch, Logstash, Kibana)
42
+ - 部署: docker + docker-compose
67
43
68
44
## QuickStart:
69
45
70
- - https://www.yuque.com/tal-tech/go-zero/yaoehb
71
-
46
+ - https://go-kratos.dev/docs/component/middleware/overview
72
47
73
48
### Development Environment:
74
49
75
50
- install:
76
51
77
52
```
78
53
79
- # clone repo:
80
- git clone
81
-
82
- # enter project root:
83
- cd .
84
-
85
- # install require pkg:
86
- make go.mod.tidy
87
54
88
55
```
89
56
90
-
91
57
- run 示例服务: ` app/basic/demo `
92
58
93
59
```
94
- cd ./app/basic/demo
95
-
96
- # 启动 API 服务:
97
- make run.demo
98
-
99
- # 或者使用: 基于 air, watch 该服务目录, 修改后, 自动 hot reload, 无需重新编译
100
- make run.auto.reload
101
-
102
-
103
- # http echo test:
104
- make curl.api
105
-
106
-
107
- #
108
- # will print:
109
- #
110
- -> % make curl.api
111
- curl -i http://localhost:8888/from/you
112
- HTTP/1.1 200 OK
113
- Content-Type: application/json
114
- Date: Thu, 18 Feb 2021 10:48:23 GMT
115
- Content-Length: 25
116
-
117
- {"message":"hello world"}%
118
60
119
61
120
62
```
121
63
122
-
123
64
## Structure:
124
65
125
66
- 目录结构简略说明: 对整体目录的 quick look.
126
67
127
-
128
68
``` html
129
69
130
70
@@ -152,7 +92,6 @@ Content-Length: 25
152
92
153
93
```
154
94
155
-
156
95
- 代码调用链路说明: 以 ` app/basic/demo ` 服务为例(自顶向下调用)
157
96
- Cmd 启动入口: ` app/basic/demo/cmd/main.go `
158
97
- Service 入口: ` app/basic/demo/internal/service/service.go `
@@ -175,8 +114,6 @@ Content-Length: 25
175
114
176
115
- 目录结构详细说明:
177
116
178
-
179
-
180
117
``` html
181
118
182
119
@@ -262,10 +199,8 @@ Content-Length: 25
262
199
263
200
```
264
201
265
-
266
202
## Reference:
267
203
268
-
269
204
- https://github.com/macrozheng/mall
270
205
- https://zeromicro.github.io/go-zero/rpc-dir.html
271
206
- rest: https://www.yuque.com/tal-tech/go-zero/bqdcb3
0 commit comments