Basic Deployment with Capistrano

by Charles Max Wood on November 27, 2010

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

  • Wadziu

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

  • Wadziu

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

  • http://teachmetocode.com Charles Max Wood

    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.

  • http://teachmetocode.com Charles Max Wood

    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.

  • Wadziu

    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 …

    • http://teachmetocode.com Charles Max Wood

      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.

  • Wadziu

    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 …

    • http://teachmetocode.com Charles Max Wood

      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.

  • Pingback: Capistrano: Deploying Ruby on Rails Applications to Multiple Servers — Teach Me To Code

  • http://twitter.com/awenkhh Andreas Wenk

    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?

    • http://teachmetocode.com Charles Max Wood

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

      • Acgtek

        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)?

  • http://vinay.shriyan.in vinay

    Thnx  Charles Max Wood .. nice post..

Previous post:

Next post: