blog microservices deployed in an Istio-enabled kubernetes cluster.
主要遵循 Standard Go Project Layout 推荐的目录分层。
- gRPC 通信协议
- GORM 数据库 ORM
- DTM 分布式事务管理器
- Jaeger 分布式追踪
- Prometheus 监控系统
- Grafana 数据可视化
- Kiali 可观察性工具
- Kubernetes 容器编排
- Istio 服务网格
命令 | 说明 |
---|---|
make init |
安装各类 protoc-gen-* 、 wire 以及 migrate |
make protoc |
基于 *.proto 文件,生成各类 *_pb.go |
make wire |
基于 wire.go 文件,生成 wire_gen.go |
make test |
测试 |
make migrate-up |
迁移数据库 |
make migrate-down |
回滚数据库 |
make blog-server |
启动 blog 服务(本地开发环境) |
make user-server |
启动 user 服务(本地开发环境) |
make post-server |
启动 post 服务(本地开发环境) |
make comment-server |
启动 comment 服务(本地开发环境) |
make auth-server |
启动 auth 服务(本地开发环境) |
make dtm-server |
DTM 为外部依赖,启动本地服务,请浏览 官方文档 |
make docker-build |
构建 Docker 镜像 |
make kube-deploy |
在集群中部署 blog、user、post、comment、auth 以及 dtm 服务 |
make kube-delete |
在集群中删除上述服务 |
make kube-redeploy |
在集群中重新部署服务(数据库服务不删除) |
- docker-desktop >= 4.3.2
- kubernetes >= 1.22.4
- go >= 1.17
- istioctl >= 1.12.1
- protobuf >= 3.19.1
下载安装 Docker Desktop ,并启动内置的 Kubernetes 集群。
# 安装 Go
brew install go
# 安装 Protobuf
brew install protobuf
# 安装 Istio
brew install istioctl
kubectl config use-context docker-desktop
istioctl install -y
kubectl label namespace default istio-injection=enabled