Basically I followed this approach:
But there is one problem with the above approach, and that is that I want to be able to push other branches than master to the server. Thats how I push to QA and staging.
A gooogle search found this for me:
Now all I needed was to add a restart
In the post-receive hook, for each repo, I have added the following code
#!/bin/bash while read oldrev newrev ref do branch=`echo $ref | cut -d/ -f3` GIT_WORK_TREE=/var/www/pathToAPI git checkout -f $branch done touch /var/www/pathToAPI/tmp/restart.txt
With this deployment is as easy as
git push api master
And of course, since I have a git repo behind me, I can rollback pretty easily as well.
Btw if you are instested in helping testing bemyeyes, and you have an iPhone, please do install the beta at http://beta.bemyeyes.org
- Image courtesey of https://www.flickr.com/photos/the_pageman/ *