English | ็ฎไฝไธญๆ
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
This project is a part of a competition. We have attached our final materials here.
Quietly say: We have achieved a good ranking.
Documentation Replay of the defense
- Extremely easy to use and deploy.
- Relatively mature CI/CD.
- Relatively high code quality
- Safety Considerations
- Performance Optimization for Interfaces
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
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.
make env-up # launch environment, env-down for remove
make docker # build docker-image
sh docker-run.sh # launch all services
# if you just want to launch specific service, use
sh docker-run.sh api # or others
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
deploy
โโโ config # same as this projects
โย ย โโโ config.yaml
โย ย โโโ words.txt # sensitive word list
โย ย โโโ prometheus.yml
โย ย โโโ sql # for mysql init
โย ย โโโ init.sql
โย ย โโโ user.sql
โโโ docker-compose.yml # for environment, same
โโโ restart-service.sh # deploy scripts
The script will automatically pull the latest image from Aliyun ACR, find and delete the running containers, and re-run them with the latest image.
If you want a specific tutorial on how to use it, please visit: deploy docs
.
โโโ Dockerfile
โโโ LICENSE
โโโ Makefile # some useful commands
โโโ README.md
โโโ cmd # microservices
โโโ config # for run-directly config and config-example
โโโ deploy # for deploy
โโโ docker-compose.ci.yml # for ci env
โโโ docker-compose.yml
โโโ docker-run.sh # for local docker-run
โโโ docs
โโโ go.mod
โโโ go.sum
โโโ idl # interface definition
โโโ kitex_gen
โโโ pkg
โย ย โโโ constants # store any consts
โย ย โโโ errno # custom error
โย ย โโโ middleware # common middleware
โย ย โโโ tracer # for jaeger
โย ย โโโ utils # useful funcs
โโโ test
.
โโโ Makefile
โโโ biz
โ โโโ handler # solve request/send response
โ โโโ middleware
โ โโโ model
โ โโโ pack # pack response
โ โโโ router # for route
โ โโโ rpc # send rpc request to microservices
โโโ build.sh
โโโ main.go
โโโ output # build binary
โโโ router.go
โโโ router_gen.go
โโโ script
.
โโโ Makefile # useful commands
โโโ build.sh # build binary
โโโ dal
โ โโโ cache # redis
โ โโโ db # MySQL
โ โโโ mq # RabbitMQ
โโโ handler.go
โโโ kitex_info.yaml
โโโ main.go
โโโ output # build binary
โโโ pack # pack response
โโโ rpc # send request to other services
โโโ script
โโโ coverage # coverage test(some service not exist)
โโโ service
you can drop .postman/tiktok.openapi.json
to postman then start this project and test
Fuzhou University west2-online studio golang team