preface

The previous period of time is to add functions on the original project, just need to compile the file to the bin directory of the server.

This time, I started to write a new project. After compiling the code, I suddenly found a serious problem: I could not deploy the new project.

In the beginning, I put the compiled binaries into the bin directory of the old project, which kept having problems for more than two hours. It was only when I called for help that I found out I had to deploy the new project.

There’s an old project framework here, so I can just do it.

Deployment project

Start by creating the following files and folders in the project name directory

The bin # directory is used to store the binary files generated by the build. The log # directory is used to store the binary startup logs. The conf # directory is used to store the configuration files of the project	*Config. json admin # directory for deployment-related scripts	*Start. sh, starts the latest version and backs up the previous version    *Stop sh, stop    *Rollback. Sh to rollback to the previous version    *Restart. Sh, restart itCopy the code

Scripts and directories can be adjusted based on actual conditions

Sudo./bin/main.go, project started, and now we’re done. Ctrl+C and Ctrl+V really work

Reference: Geek Geek’s Golang project deployment, for details on how to write scripts, see this link.