Deploying Rails apps with Capitstrano, Git and god

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

Khash Sajadi

Khash is the founder and CEO of Cloud 66, a full stack container management as a service. Follow him on @khash

London, UK and San Francisco, US
Subscribe and get updates

Have feedback? Please get in touch @cloud66 on Twitter.

Everything you need to build, manage and maintain containers in production on your own servers and any cloud

Try Cloud 66 — 14 Days Free Trial, No credit card required