Basic Deployment with Capistrano

Capistrano has been the most popular way to deploy Ruby and Rails applications for a long time. This video provides a quick demonstration of a basic recipe for deploying a Rails 3 application.

I made this video a while ago and I realized that I never posted it. Here is a very basic recipe for deploying with Capistrano.

Download 30.1 MB
Download (iPhone & iPod) 13.3 MB

{ 12 comments… read them below or add one }

Wadziu January 12, 2011 at 10:43 pm

nice, just little bit to short, some more Capistrano configuration possibilities would be amazing, just like 3 min more 😉

Reply

Wadziu January 12, 2011 at 10:43 pm

nice, just little bit to short, some more Capistrano configuration possibilities would be amazing, just like 3 min more 😉

Reply

Charles Max Wood January 12, 2011 at 11:18 pm

I went back and forth between “just enough to get an application deployed” and “show off some of the finer points.” I’ll probably put up a follow up soon.

Reply

Charles Max Wood January 12, 2011 at 11:18 pm

I went back and forth between “just enough to get an application deployed” and “show off some of the finer points.” I’ll probably put up a follow up soon.

Reply

Wadziu January 17, 2011 at 12:51 am

I just wonder if there is easier way to deoploy gems instead calling bundle install vendor/bundle every deploy ?
Maybe via set :shared_path ? Any suggestions …

Reply

Charles Max Wood January 17, 2011 at 2:29 pm

If you include this line in your deploy.rb, it’ll take care of the bundle install for you.

require ‘bundler/capistrano’

This does, however, call bundle install every time. It stores the gems in your shared_path (as you suggested), which can decrease the amount of time it takes to deploy.

Reply

Wadziu January 17, 2011 at 12:51 am

I just wonder if there is easier way to deoploy gems instead calling bundle install vendor/bundle every deploy ?
Maybe via set :shared_path ? Any suggestions …

Reply

Charles Max Wood January 17, 2011 at 2:29 pm

If you include this line in your deploy.rb, it’ll take care of the bundle install for you.

require ‘bundler/capistrano’

This does, however, call bundle install every time. It stores the gems in your shared_path (as you suggested), which can decrease the amount of time it takes to deploy.

Reply

Andreas Wenk August 11, 2011 at 11:17 pm

Thanks for the nice video! One thing I would like to mention … or ask? Instead of writing the path to bundler into the task :restart, you could also add this:

set :default_environment, {  ‘PATH’ => “/home/aw/.rvm/gems/ruby-1.9.2-p180/bin:/home/aw/.rvm/bin:/home/aw/.rvm/environments/ruby-1.9.2-p180/bin:$PATH”,  ‘RUBY_VERSION’ => ‘ruby-1.9.2-p180’,  ‘GEM_HOME’     => ‘/home/aw/.rvm/gems/ruby-1.9.2-p180’,  ‘GEM_PATH’     => ‘/home/aw/.rvm/gems/ruby-1.9.2-p180’,  ‘BUNDLE_PATH’  => ‘/home/aw/.rvm/gems/ruby-1.9.2-p180’  # If you are using bundler.}

correct?

Reply

Charles Max Wood August 12, 2011 at 3:33 pm

Andreas, that’s an excellent idea. Configuring the environment is a much cleaner way of doing that.

Reply

Acgtek October 30, 2011 at 3:24 pm

You meant add set :default_environment, {} to deploy.rb? Also is the path ruby-1.9.2-p180 pointing to the ruby installed on local development machine (not the ruby on remote web server)?

Reply

vinay August 23, 2011 at 10:58 am

Thnx  Charles Max Wood .. nice post..

Reply

Leave a Comment

{ 1 trackback }