Skip to content

Instantly share code, notes, and snippets.

@bazzel
Created May 19, 2012 05:45
Show Gist options
  • Save bazzel/2729441 to your computer and use it in GitHub Desktop.
Save bazzel/2729441 to your computer and use it in GitHub Desktop.
Capistrano's deploy.rb with RVM multi user install
# RVM bootstrap
set :rvm_ruby_string, '1.9.2-p320@[appname]'
require "rvm/capistrano" # Load RVM's capistrano plugin.
# When using whenever gem:
# set :whenever_command, "bundle exec whenever"
# require 'whenever/capistrano'
set :rvm_type, :system
# bundler bootstrap
require 'bundler/capistrano'
# main details
set :application, "[appname]"
role :web, "[domain]"
role :app, "[domain]"
role :db, "[domain]", :primary => true
# server details
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :deploy_to, "/var/www/[appname]"
set :deploy_via, :remote_cache
set :user, "passenger"
set :use_sudo, false
# repo details
set :scm, :git
set :scm_username, "passenger"
set :repository, "git@github.com:[github_account]/[appname].git"
set :branch, "master"
set :git_enable_submodules, 1
# tasks
namespace :deploy do
task :start, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
task :stop, :roles => :app do
# Do nothing.
end
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
desc "Symlink shared resources on each release - not used"
task :symlink_shared, :roles => :app do
#run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
end
after 'deploy:update_code', 'deploy:symlink_shared'
load 'deploy/assets'
gem 'capistrano'
gem 'rvm-capistrano'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment