← All Articles

Deploying Rails apps with Capitstrano, Git and god

Khash SajadiKhash Sajadi
Oct 13th 11Updated Jul 27th 17

There are many articles on the net about how to deploy Rails apps using git and Capistrano from Github. Github has a great guide for that.

However, we wanted to have CloudBlocks deployed to our servers from our own Git host (Assembla for that matter) using Capistrano and use God to manage our rake processes automatically.

To do this, we used san_juan, a Capistrano recipe that wraps calls to god in a nice way.

There are a couple of important lines in this otherwise normal
Capistrano deployment script:

Line 12:

ssl_options[:forward_agent] = true

tells git to use your keys for git rather than the ones on the server. This make deployment much simpler.

Line 13:

default_run_options[:pty] = true

is for god. san_juan adds a sudo to the beginning of god calls (as it should) with a -p to get the password. Without this line sudo wouldn’t work.

One note about san_juan roles, one note is to make sure they are the same as capistrano roles and defined after those.

Also, based on default san_juan configuration, you’d need to have a {role_name}.god file under your config/god folder in the app. So for the example above, you’d need to have an config/god/app.god


Try Cloud 66 for Free, No credit card required