Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
docs: add zh-CN support (#137)
Browse files Browse the repository at this point in the history
* docs: add example and architecture imgs

* docs: add zh-CN support
  • Loading branch information
ozline authored Sep 7, 2023
1 parent 185fad0 commit 3df7054
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 6 deletions.
40 changes: 34 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# tiktok

English | [简体中文](./docs/zh-cn.md)

**tiktok** is a distributed **simple-tiktok** backend based on RPC and HTTP protocols using Kitex + Hertz + etcd + MySQL + Jaeger + Docker + Thrift + Prometheus + Grafana + Elasticsearch + Kibana

# Feature
Expand All @@ -10,11 +12,15 @@
- Safety Considerations
- Performance Optimization for Interfaces

# Architecture

![architecture](./docs/img/architecture.png)

# Quick start

We will introduce how to quickly start this project using Docker. If you need to build and run it locally, please refer to: [start-by-local](./docs/start-by-local.md)

Due to the script I have written, the process has been greatly simplified. You just need to use the following command to quickly start the environment and run the program in a containerized manner.
Due to the script we have written, the process has been greatly simplified. You just need to use the following command to quickly start the environment and run the program in a containerized manner.

```bash
make env-up # launch environment, env-down for remove
Expand All @@ -31,10 +37,13 @@ then you can send HTTP request on `localhost:10001` for test or others things

We use a fully automated process to streamline the workload, so you can always use our Docker image packaged with the latest code.

You can directly copy the `deploy` folder of our project to the server you expect to deploy. The folder structure is roughly as follows

```bash
deploy
├── config # same as this projects
│   ├── config.yaml
│   ├── words.txt # sensitive word list
│   ├── prometheus.yml
│   └── sql # for mysql init
│   ├── init.sql
Expand All @@ -47,7 +56,7 @@ The script will automatically pull the latest image from Aliyun ACR, find and de

If you want a specific tutorial on how to use it, please visit: [deploy docs](./deploy/README.md)

# Architecture
# Project structure

## Overall
```bash
Expand Down Expand Up @@ -117,12 +126,31 @@ If you want a specific tutorial on how to use it, please visit: [deploy docs](./
```


# Test interfaces
# Test

you can drop `.postman/tiktok.openapi.json` to **postman** then start this project and test

# Contribute & Question
# Visualization example

## Jaeger

![jaeger](docs/img/jaeger.png)
![jaeger-dag](docs/img/jaeger-dag.png)

## Kibana + Elasticsearch
![kibana](docs/img/kibana.png)

## Grafana + Prometheus
![grafana](docs/img/grafana.png)


# Contributor

you can send Pull Request(PR) for contribute, I will quickly response
Fuzhou University west2-online studio golang team

If you have any questions, you can create an issue.
- [ozline](https://github.com/ozline)
- [XZ0730](https://github.com/XZ0730)
- [wushiling50](https://github.com/wushiling50)
- [jiuxia211](https://github.com/jiuxia211)
- [notacommonperson](https://github.com/notacommonperson)
- [jkskj](https://github.com/jkskj)
Binary file added docs/img/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/grafana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/jaeger-dag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/jaeger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/kibana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions docs/zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# tiktok

[English](../README.md) | 简体中文

tiktok 是一个基于HTTP和RPC协议, 分布式架构的简单抖音后端. 它使用到了 Kitex、Hertz、etcd、MySQL、Jaeger、Docker、Thrift、Prometheus、Grafana、Elasticsearch和Kibana

# 特性

- 极度容易的上手和部署
- 相对完善的持续集成/持续部署工作六
- 相对高的代码质量
- 安全性考量
- 对于接口的性能优化

# 架构

![architecture](../docs/img/architecture.png)

# 快速启动

我们将介绍如何使用Docker快速启动这个项目, 如果你需要本地构建并运行(Standalone), 请访问: [手动构建(英文)](./start-by-local.md)

这个项目已经通过脚本大大的简化了流程, 你只需要使用下面这些命令就可以快速拉起环境并以容器化方式运行程序

```bash
make env-up # 拉起环境, 可以使用env-down关闭环境
make docker # 构建docker镜像
sh docker-run.sh # 启动所有服务

# 如果你只是想启动其中一个服务, 指明即可
sh docker-run.sh api # 或者其他服务
```

之后你可以发送HTTP请求到 `localhost:10001` 来测试接口

# 快速部署

我们使用完全自动化的流程来简化工作负载, 因此您可以使用我们打包有最新代码的Docker镜像

您可以直接复制我们这个项目的`deploy`文件夹到您期望部署的服务器, 这个文件夹结构大致如下

```bash
deploy
├── config
│   ├── config.yaml # 基础配置
│   ├── prometheus.yml # prometheus配置
│ ├── words.txt # 敏感词文件
│   └── sql # mysql初始化
│   ├── init.sql
│   └── user.sql
├── docker-compose.yml # 环境搭建
└── restart-service.sh # 部署脚本
```

这个脚本会自动从阿里云ACR中拉取最新的镜像,查找并删除正在运行的容器,并使用最新的镜像重新运行它们。

如果您需要有关如何使用它的具体教程,请访问: [部署文档(英文)](../deploy/README.md)

# 项目结构

## 整体
```bash
.
├── Dockerfile
├── LICENSE
├── Makefile # 一些有用的命令
├── README.md
├── cmd # 微服务
├── config # 配置
├── deploy # 部署
├── docker-compose.ci.yml # 用于持续集成环境部署
├── docker-compose.yml
├── docker-run.sh # 用于本地启动docker容器
├── docs
├── go.mod
├── go.sum
├── idl # 接口定义
├── kitex_gen
├── pkg
│   ├── constants # 存储一些常量
│   ├── errno # 定制化错误
│   ├── middleware # 常用的中间件
│   ├── tracer # 链路追踪
│   └── utils # 有用的功能
└── test
```

## 网关/API模块

```bash
.
├── Makefile
├── biz
│ ├── handler # 请求处理、包装返回数据
│ ├── middleware
│ ├── model
│ ├── pack # 打包
│ ├── router # 路由
│ └── rpc # 发送RPC请求
├── build.sh
├── main.go
├── output # 二进制文件
├── router.go
├── router_gen.go
└── script
```

## 微服务
```bash
.
├── Makefile # 有用的命令
├── build.sh # 构建脚本
├── dal
│ ├── cache # redis
│ ├── db # MySQL
│ └── mq # RabbitMQ
├── handler.go
├── kitex_info.yaml
├── main.go
├── output # 构建好的二进制文件
├── pack # 打包返回数据
├── rpc # 给其他RPC服务发送请求
├── script
├── coverage # 覆盖率测试结果(部分没有)
└── service
```


# 测试

你可以把 `.postman/tiktok.openapi.json` 丢到Postman中然后开始测试

# 可视化样例

## Jaeger

![jaeger](./img/jaeger.png)
![jaeger-dag](./img/jaeger-dag.png)

## Kibana + Elasticsearch
![kibana](./img/kibana.png)

## Grafana + Prometheus
![grafana](./img/grafana.png)


# 贡献者

福州大学西二在线工作室golang团队

- [ozline](https://github.com/ozline)
- [XZ0730](https://github.com/XZ0730)
- [wushiling50](https://github.com/wushiling50)
- [jiuxia211](https://github.com/jiuxia211)
- [notacommonperson](https://github.com/notacommonperson)
- [jkskj](https://github.com/jkskj)

0 comments on commit 3df7054

Please sign in to comment.