Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automating git pull process on dev/QA server on commit

I have my rails application hosted on github. Whenever a commit happens on 'dev' branch I would like to do git pull on the dev box and also invoke '/etc/init.d/apache2 restart' command. Is this something I can do with Capistrano deployment or I can write some kind of custom shell script and somehow hook in my rails app to call that shell script?

like image 671
ed1t Avatar asked Sep 10 '26 07:09

ed1t


1 Answers

You will need a post-receive hook on the git server that causes a git pull on the dev box. A quick DAFS for "git deploy with post-receive" found quite a few resources, like http://ryanflorence.com/deploying-websites-with-a-tiny-git-hook

I would personally prefer using a build system like Jenkins for this as it gives you more control and visibility. We have set up a continuous deployment system using Jenkins and github post-receive hooks with relatively little fuss. Another advantage is that you can run your tests before automatically deploying (if they pass) by chaining jobs.

like image 184
Rein Henrichs Avatar answered Sep 12 '26 05:09

Rein Henrichs