- Create a shorter aliases for original URLs.
- POC 練習
- Go
- Docker
make init
建置並啟動 Tiny URL 專案所需的所有服務,包含:
- API Server (主要服務)
- Grafana (效能監控)
- Graylog (日誌系統)
- Jaeger (分散式鏈路追蹤)
- Locust (壓力測試工具)
make demo
短網址製作範例
curl -d '{"url":"http://replace/for/your/url", "alias":""}' -H "Content-Type: application/json" -X POST http://localhost:6600/api/v1/create
執行整合測試
make integration-test
重新載入壓力測試腳本 (適用於修改 test/benchmark/ 底下的 .py 腳本時)
make restart-benchmark
更多指令請查閱:
make help
點擊 http://localhost:3000 即可進入 Grafana 觀察各服務的即時指標
- 預設帳號: admin/admin
deployments/grafana/
內提供 MySQL, Redis, Server 儀表板範本
點擊 http://localhost:16686 即可進入 Jaeger 觀察向 TinyURL 服務的請求處理流程
點擊 http://localhost:9000 即可進入 Graylog 觀察 TinyURL 服務的日誌記錄
- 預設帳號: admin/admin
- 第一次進入時需要至
Sysmtem/Inputs
設定資料來源
點擊 http://localhost:6600/swagger/index.html 訪問 Swagger 文件
TinyURL
├─ .github/
│ └─ workflows/
├─ cmd/ # 本專案的主要應用程式
├─ conf.d/ # 組態設定的檔案範本及預設設定
├─ deployments/ # 系統和容器編配部署的組態設定腳本
│ ├─ data/ # 保存 docker volume
│ ├─ grafana/ # Grafana 預設儀表板
│ ├─ locust/ # Locust 組態設定
│ ├─ mysql/ # MySQL 組態設定與動態連結函式庫 (dll)
│ └─ prometheus/ # prometheus 組態設定
├─ docs/ # 設計和使用者文件 (sequence, db schema, etc.)
├─ internal/ # 私有應用程式和函示庫的程式碼
│ ├─ accessor/ # 基礎建設模組
│ ├─ config/ # 組態設定模組 (viper)
│ ├─ integration/ # 整合測試模組
│ ├─ server/ # TinyURL WebAPI Server
│ ├─ storage/ # 資料庫模組
| | ├─ kvstore/ # key-value store
| | └─ rdb/ # relational database
│ └─ tracer/ # OpenTracing 模組 (jaeger)
├─ test/ # 額外的外部測試應用程式和測試資料
│ └─ benchmark/ # 壓力測試腳本
├─ tools/ # 支援工具
├─ .gitattributes
├─ .gitignore
├─ .golangci.yaml
├─ dockerfile
├─ go.mod
├─ go.sum
├─ LICENSE
├─ main.go # 主程式進入點
├─ makefile
└─ README.md
- [Blog] Designing a URL Shortening service like TinyURL
- [Blog] 短 URL 系统是怎么设计的?
- [Doc] Fiber Web Framework
- [Wiki] MurMurHash
- [Github] Marketplace/Actions/Run golangci-lint
- [Github] github-actions-golang
- [Github] Quickstart for GitHub Actions
- [Blog] docker-compose 搭建 Prometheus+Grafana监控系统
- [Blog] Prometheus+Grafana+Go服务自建监控系统入门
- [Blog] 通过实例理解Go Execution Tracer