Editor's note
Due to the company's internal development system: Intranet development – Extranet pre-release – outside the production environment, programmers frequently update the code to cause operations personnel to occupy a large amount of time, so there is the use of the open Source Tool deployment Test link. Thanks to the author of the Open Source tool here, I also hope that the documentation on my side will help a technician who needs a similar development environment.
1. Deployment:
Open Source project Address: Https://github.com/kelvv/my-deploy
How-To video tutorial: http://v.youku.com/v_show/id_XMTYxMjc0ODg3Mg==.html
Base environment: Node 4.x.x or later
Git version 2.7.4 and above sudo apt install git
Installed: $ NPM install-g My-deploy
2. Configuration:
Creating a configuration file
1 cd/data/test #进入到管理项目目录
2 mydeploy init #创建配置文件. Mydeploy.json
Clone code to Local:
1 cd/data/test
2 git clone git@gitlab.apicloud.com:swht/test.git.
Configuration file:
{
"mode": "Pullwatch",
"url": "Git@gitlab.apicloud.com:swht/test.git",
"Localdir": "/data/test",
"Interval": "Branch":
"Dev",
"hook": {
"postchanged": "PM2 Reload Test"
},
"rules": [
{
"type": "Commit",
"value": "^reload"
}
]
}
Description: mode– mode, divided into Pullwatch, webhook two modes
URLs Management Project Warehouse address: Generally stored in GitHub, Gitlab or self-built gitlab warehouses
localdir– local management project path;
interval– time interval, refers to Mydeploy interval how much time to detect whether the Git warehouse is updated, the default 3000ms, it is recommended to use the Pullwatch mode on the internal development server, active interval time to git pull the latest code;
branch– Branch, which refers to the development of a code base branch, is suggested to be divided into several branches: Dev–pre–master. If you have more internal developers, you can create your own branch, which is branched by a dedicated code reviewer;
hook– code after the completion of the system command to execute, borrowing PM2 for project restart operation;
rules– detect updated rules, that is, according to the type of git commit (commit, tags), comments information to update;
Note: Mydeploy start-c/data/test/.mydeploy.json-p 3110 custom boot mode,-c specifies the path of the configuration file,-p specifies the port to listen on
Mydeploy Start #启动默认的监听端口为3100
@ South Africa Bobo GITHUB:HTTPS://GITHUB.COM/SWHT