Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #229

Merged
merged 2 commits into from
Sep 2, 2023
Merged

Dev #229

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 75 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,77 @@
# GuGoTik
GuGoTik Repo, more information will be provided after the end of the campus practice.
GuGoTik is sixth practice project of ByteDance campus, themed of a micro TikTok backend.

If you want to learn more information, please wait util the competition finished. GuGoTik will provide the whole develop document, please give us a star~

English | [简体中文](docs/README-CN.md)
# File Structure
- src: the code source of the project.
- build: provide build description file.
- docs: provide project build information.
- test: code verify test.
# Contributor
Project Developer: This is a group of Contributors from all over the world, from WHU, HNU, NJUPT.
- [EpicMo](https://github.com/liaosunny123)
- [Maples](https://github.com/Maple-pro)
- [Attacks](https://github.com/Attack825)
- [amazing-compass](https://github.com/amazing-compass)
- [XFFFCCCC](https://github.com/XFFFCCCC)

特别感谢:
- [Eric](https://github.com/ExerciseBook)
- [Huang Yongliang](https://github.com/956237586)
- [nicognaW](https://github.com/nicognaW)

以及有事而无法参与项目的小伙伴:
- [Chuanwise](https://github.com/Chuanwise)

# 项目结构
- docker: Built as basic image for project's dockerfile or kubernetes's basic infrastructure.
- scripts: Build scripts
- src: The source of the project
- constant: The project constant
- extra: The service being relied upon
- idl: idl
- models: Data model
- rpc: Rpc code
- services: Micro services instance
- storage: About storage
- utils: Utils code
- web: Gateway code
- test: Test of the project
- Others:Docker Compose file and demo env

# Extern service
- Redis (Cluster)
- PostgreSQL
- Consul
- OpenTelemetry Collector
- FFMpeg
- Go

Recommend:
- Jaeger
- Victoria Metrics
- Grafana

Profile Analysis:
- Pyroscope

# Build process
RyzeBot of 梦想珈 will build image and push to kubernetes
The PR to Dev branch can be merged into the Master branch after the Action based UnitTest + Code Analysis + Lint + BuildCheck.
The Master branch will automatically trigger the CD, build the image and push it, and RyzeBot will complete the push to K8S for automatic deployment.

# Config
GuGoTik can automatically capture environement variables or provide them manually as .env files in the order of coverage:
.Env > environement variable > DefaultEnv > EmptyEnv (that is, null value is provided by default, and runtime special judgment is provided by GuGoTik)

# Build
## Standalone
Run the build-all script in the scripts folder, and then run the run-all script. Please select the script supported by your platform.
## Docker
```bash
docker pull epicmo/gugotik:latest
```
After entering the container through the interactive end point, run the programs under the GateWay folder and the Services folder by yourself
## Docker-Compose
Run in the project root directory:
Note: The relevant account password settings are viewed in the .env.docker.compose file
```bash
docker compose up -d
```
24 changes: 21 additions & 3 deletions docs/README-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GuGoTik
GuGoTik是 第六届字节跳动青训营后端进阶 实战项目,题目为编写一个小型的抖音后端。
GuGoTik是 第六届字节跳动青训营后端进阶 实战项目,题目为编写一个小型的抖音后端。

如果你想了解更多信息,请等待 青训营结束后 ,GuGoTik 会提供完整的项目开发文档,请给本项目一个 Star ~
# 贡献者
项目开发者:这是一群来自五湖四海的 Contributors,来自于 WHU,HNU,NJUPT。
- [EpicMo](https://github.com/liaosunny123)
Expand All @@ -16,6 +18,22 @@ GuGoTik是 第六届字节跳动青训营后端进阶 实战项目,题目为
以及有事而无法参与项目的小伙伴:
- [Chuanwise](https://github.com/Chuanwise)

# 项目结构
- docker: 基础镜像,为项目的Dockerfile提供基础镜像,或者是为 K8S 技术设施提供基础镜像
- scripts: 构建脚本
- src: 项目源代码
- constant: 项目常量
- extra: 外部服务依赖
- idl: idl文件
- models: 数据模型
- rpc: Rpc 代码
- services: 微服务实例
- storage: 存储相关
- utils: 辅助代码
- web: 网关代码
- test: 项目测试
- 其他单文件:Docker Compose 文件和使用的demo环境变量

# 外部服务依赖
- Redis (Cluster)
- PostgreSQL
Expand All @@ -34,8 +52,8 @@ Profile 性能分析:

# 自部署流程
由 梦想珈 RyzeBot 提供自动推送至K8S集群构建流程。
PR 至 Dev 分支,经过基于 Action 的 UnitTest + Code Analysis + Lint + BuildCheck 后,可合并至 Master 分支。
Master 分支会自动触发 CD,构建镜像并推送,由 RyzeBot 完成向 K8S 的推送,自动部署。
PR 至 Dev 分支,经过基于 Action 的 UnitTest + Code Analysis + Lint + BuildCheck 后,可合并至 endymx 分支。
endymx 分支会自动触发 CD,构建镜像并推送,由 RyzeBot 完成向 K8S 的推送,自动部署。

# 配置
GuGoTik可以自动捕获环境变量,也可以以 .env 文件的方式手动提供,覆盖顺序为:
Expand Down
3 changes: 2 additions & 1 deletion src/web/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/sirupsen/logrus"
ginprometheus "github.com/zsais/go-gin-prometheus"
"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
"time"
)

func main() {
Expand Down Expand Up @@ -49,7 +50,7 @@ func main() {
// Configure Tracing
g.Use(otelgin.Middleware(config.WebServiceName))
g.Use(middleware.TokenAuthMiddleware())
//g.Use(middleware.RateLimiterMiddleWare(time.Second, 10000, 10000))
g.Use(middleware.RateLimiterMiddleWare(time.Second, 1000, 1000))

// Configure Pyroscope
profiling.InitPyroscope("GuGoTik.GateWay")
Expand Down
Loading