Sunday, December 25, 2011

How to deploy with Mercurial aka HG on rails3.1

1. Install Phusion Passenger module (www.modrails.com/) on top of Apache2 or Nginx
2. Edit .hg/hgrc on the destination (production server).

[hooks]
incoming = hg update -C && RAILS_ENV=production rake db:migrate && bundle exec rake assets:precompile && touch tmp/restart.txt

(http://pastie.org/3073448)

Let's explain briefly rails aspects of [hooks].

RAILS_ENV=production rake db:migrate -- sets environment to production mode and migrates the database.

bundle exec rake assets:precompile -- precompiles scss (sass), coffescript (js) and image files from app/assets to the public/assets directory.

touch tmp/restart.txt -- sends Passenger command to restart the server.



Enjoy!

0 comments:

Post a Comment