Code Monkey home page Code Monkey logo

mini-tiktok's Introduction

Mini-tiktok

Hi there, this is a project for practice during the Byte Dance Youth Camp for backend.

This repository is the result of Team BDXA0429.

For Monolith, we choose gin+gorm+mysql+redis+mvc framework to complete the work.

Microservices

in future planning

Monolith

DOC

https://v9drif9kn4.feishu.cn/docx/doxcnnC7wuakE7YrDcYuNGrF7LZ

Project structure

Monolith
├── app                   
│   ├── controller        
│   ├── service           
│   └── entity             
|   └── dao
├── common
│   ├── auth              // generate token           
│   ├── db                // mysql & redis init
│   ├── xerr              // customed errors
│   ├── logger            
│   └── utils             // snow flake algorithm to generate unique id
├── router                
│   ├── middleware        // auth and log midderware 
│   └── router.go
├── config.yaml           // app config
├── go.mod                
├── go.sum
├── main.go               
├── run.sh

How to run

1. Install mysql

The mysql installation tutorial is omitted here.

Notice: you need replace the mysql_password with your own password.

image-20220527204317266

2. Install redis

wget https://download.redis.io/redis-stable.tar.gz
tar -zvxf redis-stable.tar.gz
mv redis-stable /usr/local/redis
cd /usr/local/redis
make
make test
make PREFIX=/usr/local/redis install
./bin/redis-server&

3. Install ffmpeg

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
sudo make install


wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz
tar -zxvf ffmpeg-3.1.tar.gz
cd ffmpeg-3.1
./configure --prefix=/usr/local/ffmpeg
make && sudo make install
vim /etc/profile
export PATH=$PATH:/usr/local/ffmpeg/bin
source /etc/profile

4. Build an run

git clone https://github.com/zchaoyu1126/mini-tiktok.git
cd Monolith
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go mod init mini-tiktok
go mod tidy
go build .
sh run.sh

Register a service

vim /lib/systemd/system/mini-tiktok.service
[Unit]
Description=mini-tiktok

[Service]
Type=simple
Restart=always
RestartSec=3s
ExecStart=sh root/mini-tiktok/Monolith/run.sh

[Install]
WantedBy=multi-user.target

After completing the registration, you can use the following command to start or restart or stop the service rather than sh run.sh.

service mini-tiktok start
service mini-tiktok restart
service mini-tiktok stop
service mini-tiktok status

mini-tiktok's People

Contributors

zchaoyu1126 avatar zephyrzenn avatar dasgu avatar

Stargazers

Sunshipeng avatar  avatar

Watchers

 avatar

Forkers

dasgu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.