Skip to content

Instantly share code, notes, and snippets.

@chrismytton
Created February 11, 2011 21:56
Show Gist options
  • Save chrismytton/823120 to your computer and use it in GitHub Desktop.
Save chrismytton/823120 to your computer and use it in GitHub Desktop.
Capistrano with rvm, bundler and git
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
ssh_options[:forward_agent] = true
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
require "bundler/capistrano"
set :rvm_ruby_string, "ree@myapp"
set :application, "myapp"
set :repository, "git@github.com:username/#{application}.git"
set :scm, :git
set :use_sudo, false
set :user, "deploy"
set :deploy_to, "/data/#{application}"
set :branch, :master
set :deploy_via, :remote_cache
role :web, "myapp.com" # Your HTTP server, Apache/etc
role :app, "myapp.com" # This may be the same as your `Web` server
# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
# namespace :deploy do
# task :start do ; end
# task :stop do ; end
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
require "bundler/capistrano"
set :rvm_ruby_string, "ree@myapp"
set :application, "myapp"
set :repository, "git@github.com:username/myapp.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :use_sudo, false
set :user, "deploy"
set :deploy_to, "/data/myapp"
set :branch, :master
set :deploy_via, :remote_cache
role :web, "myapp.com" # Your HTTP server, Apache/etc
role :app, "myapp.com" # This may be the same as your `Web` server
# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
# namespace :deploy do
# task :start do ; end
# task :stop do ; end
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment