A 0 dependency, simple, deployment server that works with github webhooks
- Copy
config.json.exampletoconfig.json:cp config.json.example config.json - Change the permissions of this config file so other users can't see it:
chmod 600 config.json - Open an editor to edit this file, like
nano config.jsonorvi config.json
SECURE_SERVER: Set it totrueif do you wish to listen for webhook over HTTPS (not necessary if deployer is already behind a reverse proxy with HTTPS)PRIVATE_KEY: Required ifSECURE_SERVERistrue, the path to the private keyCERT: Required ifSECURE_SERVERistrue, the path to the certPORT: The desired port that will be used to listen for webhooksprojects: An array of project objects
{
"repository": "user-or-org/repo-name",
"branchToDeploy": "master",
"secret": "superscretsecret",
"tasks": [
"/path/to/script.sh"
]
}repository: For this project, the value would beeduardozgz/deployerbranchToDeploy: The desired branch to be deployed, this is usuallymasterormainsecret: This is like a password, choose something strong and never share ittasks: An array of strings, as value, the path to the installation scripts for your project, a script would look like this:
#!/bin/bash
cd /path/to/your/project
npm install && systemctl restart your-app.serviceGo to your repository settings on github, go to webhooks and add one
As payload URL, add the host where deployer is running (remember to open the firewall if it's necessary)
Change the content type to application/json
Enter the secret that you used in the config.json
And add the webhook
Run node .
Or pm2 start deployer and save the process list pm2 save