docs: update readme

This commit is contained in:
Simon Hung 2024-10-29 13:58:47 +08:00
parent 8e71eba6c4
commit 0abd901db1
1 changed files with 45 additions and 35 deletions

View File

@ -2,41 +2,6 @@
通知服務 通知服務
# 啟動說明
## Quick Start
```bash
cd app-cloudep-notification-service
go mod tidy
make gen-rpc
# 設定 etc/notification.yml 各依賴的 config
go run notification.go
```
## 依賴套件或工具
以下已 macOS 為例,若已安裝或有其他可用服務則可跳過
- go-zero goctl (https://go-zero.dev/docs/tasks/installation/goctl)
```bash
$ go install github.com/zeromicro/go-zero/tools/goctl@latest
```
- protobuf (https://protobuf.dev/)
```bash
brew install protobuf
```
- etcd (https://etcd.io/)
```bash
brew install etcd
brew services start etcd
```
- SMTP 服務(以 mailhog 為例) (https://github.com/mailhog/MailHog)
```bash
brew install mailhog
brew services start mailhog
```
# 專案架構 # 專案架構
``` ```
@ -78,3 +43,48 @@ $tree -L 3 --gitignore
│ └── smtp.go │ └── smtp.go
└── notification.go # 服務主入口 └── notification.go # 服務主入口
``` ```
# 啟動說明
此文件會介紹以下兩種啟動方式:
1. Docker 啟動 (Production 時使用)
2. 本地端 go compiler 啟動 (開發、測試時使用)
## Docker 啟動 (Production)
```bash
make build-docker
make run-docker
```
## 本地端啟動(測試用)
```bash
go mod tidy
# 進入 etc/notification.yml 設定各依賴的 config
go run notification.go
```
### 本地啟動需要依賴套件或工具
以下已 macOS 為例,若已安裝或有其他可用服務則可跳過
- go-zero goctl (https://go-zero.dev/docs/tasks/installation/goctl)
```bash
$ go install github.com/zeromicro/go-zero/tools/goctl@latest
```
- protobuf (https://protobuf.dev/)
```bash
brew install protobuf
```
- etcd (https://etcd.io/)
```bash
brew install etcd
brew services start etcd
```
- SMTP 服務(以 mailhog 為例) (https://github.com/mailhog/MailHog)
```bash
brew install mailhog
brew services start mailhog
```