Using Capistrano and git to deploy from a local location

Here’s the inspirational link. Basically, you use capistrano to deploy_via, :copy rather than :remote_cache. And you don’t have to worry about setting up gitosis or paying for github. However, I would not recommend this if you are working with another team member on the code. This is good for things you simply keep and work on locally. For example, I am keeping a client cms this way.

This is best used with passenger (mod_rails).

Here’s the capistrano deploy file:

set :runner, "scottmotte"
set :use_sudo, false

# =============================================================================
# CUSTOM OPTIONS
# =============================================================================
set :user, "scottmotte"
set :application, "motte_cms"
set :domain, "209.20.84.209"
set :site_url, "uniteddev.com"

role :web, domain
role :app, domain
role :db,  domain, :primary => true

# =============================================================================
# DATABASE OPTIONS
# =============================================================================
 set :rails_env,       "production"

# =============================================================================
# DEPLOY TO
# =============================================================================
set :deploy_to, "/home/#{user}/public_html/#{site_url}"

# =============================================================================
# REPOSITORY
# =============================================================================
set :scm, "git"
set :repository,  %w(/Users/scottmotte/Documents/code/rails/motte_cms)
set :branch, "uniteddev"
set :deploy_via, :copy
set :copy_exclude, [".svn", ".git"]

# =============================================================================
# SSH OPTIONS
# =============================================================================

default_run_options[:pty] = true
ssh_options[:paranoid] = false
ssh_options[:keys] = %w(/Users/scottmotte/.ssh/id_rsa)
ssh_options[:port] = 2008

Comments

  1. Scott | September 14, 2008

    Add in set :copy_cache, true to make things faster by using a cached copy.