A very simple node application that responds to a POST request to a given URL and then runs a git pull
at a configurable directory.
This should be a cross platform tool and has been tested to work in both OS X and Linux (Ubuntu and CentOS).
- NodeJS
- Git
- forever (if you want to deamonize the process)
- Copy the config.json.sample to config.json and edit the config file
{
"path": "/var/www",
"secure_code": "ajsodiasdasjdiaosdja9349023jdsdjsddsd",
"listen_port": 3080
}
path
This is the path of your local git repository.
secure_code
This is the secure code that us going to be sent by your github webjook post request.
listen_port
This is the port that node will be listening to for your ghub post request.
-
Run
npm install
-
Deploy and run the application on your server by running either:
node index.js
or
node forever.js
(to deamonize the process with forever)Make sure that the user that runs the node script has permissions to read/write in the deployment directory
-
Set up your webhook to POST to:
http:// your domain : listen_port / secure_code
- Use nodegit library instead of shell commands
- Add TravisCI
- Add testing