- bin
- After compile the project, the executable bin file will in this document.
- cmd
- The main file of the project.
- conf
- Configuration file.
- controller
- The controller of the API.
- deploy
- The deployment file including dockerfile, docker-compose file and mysql.
- go.mod
- go.sum
- log
- Makefile
- Store all the compile command.
- pkg
- The public tools package
- proto
- pb file
- README
- scripts
- shell or something script
- service
- The RPC handler same like controller
Please make sure you already install all the tools, when running local debug mode.
- Go 1.16.3
- Consul 1.10.1
- MySQL 5.7
- Redis 6.2.3
- About the details of framework pleas look at the go.mod file
Firstly, installing the consul
service and run it...
brew install consul
brew services start consul
Then use make run api
run the web service in the docker。
Notes: About how to install Consul in docker, please view https://hub.docker.com/_/consul
Please run the shell in deploy/mysql.sh, it will download the MySQL image from official docker hub and install it.
sh deploy/mysql.sh
Using the following commend at root path of the project to generate the swagger API for Front-end
make swag
# Notes:All the service need to specify the config file.
# Notes: If you use local database to run the service, don't forget to modify the config info like MySQL link and Redis link in the config file.
go run cmd/api/main.go -f conf/api.yaml
go run cmd/configuration/main.go -f conf/configuration.yaml
go run cmd/jobModule/main.go -f conf/job_module.yaml
go run cmd/login/main.go -f conf/login.yaml
go run cmd/order/main.go -f conf/order.yaml
- Docker 4.0.1
- Portainer.io 2.1.1
- Consul 1.10.1
- Nginx 1.20.1
- MySQL 5.7
- About the details of framework pleas look at the go.mod file
make api
./bin/api -f conf/api.yaml # notes:all of the service need to specify the config file
It will create the bin file into cmd document
make build
make docker_build
This command will compile all service,and copy the bin file and config file into the image. More detail please look the deploy/Dockerfile
.