Push-to-Deploy
Why?
This project offers the simplicity of the "push-to-deploy" model Heroku pioneered. It implements the server that receives webhook events that, in turn, triggers shell actions to perform the deployment.
Install
By downloading a ZIP or a TAR.GZ...
Click the github releases tab and download the latest available push-to-deploy package.
By using npm package manager...
$ npm install push-to-deploy
By using source files...
-
git clone https://github.com/rxaviers/push-to-deploy.git
. - Checkout a published/tagged version
git checkout <tag>
.
Usage
On your deployment server
Start the server by executing ./bin/push-to-deploy
, optionally set the
listening port (default is 8000), and pass the configuration files.
$ ./bin/push-to-deploy -p 8000 /etc/deploy.d/*.yml
A configuration file keeps the list of push events and their respective
deployment shell actions. YAML and JSON formats are supported. For example,
/etc/deploy.d/app.yml
.
# On a new master commit, run STAGE deployment.
rxaviers/app/push/heads/master:
- echo "Running STAGE deployment (checkout out {{commit}})" &&
cd /srv/stage-app &&
git fetch origin &&
git checkout --force {{commit}}
- echo "Restarting STAGE app" &&
service stage-app restart
# On a new tag, run LIVE deployment.
rxaviers/app/push/tags/*:
- echo "Running LIVE deployment (checking out {{tag}})" &&
cd /srv/app &&
git fetch origin &&
git checkout --force {{tag}}
- echo "Restarting LIVE app" &&
service app restart
The {{event_data}}
are automatically replaced. For a list of them, see
scottgonzalez/node-git-notifier.
On your upstream git repository
github
If you're using github to host your origin/upstream repository, simply setup a
webhook service to send push
events to your deployment server.
git --bare
If you're hosting the bare repository yourself, simply create a post-receive
hook there for sending webhook push
events to your deployment server. For
example, by using metajack/notify-webhook.
License
MIT © Rafael Xavier de Souza