Skip to content

Instantly share code, notes, and snippets.

@mateusg
Created December 19, 2012 14:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mateusg/4336967 to your computer and use it in GitHub Desktop.
Save mateusg/4336967 to your computer and use it in GitHub Desktop.
Clean Capistrano deploy file with bundler + rvm + permissions restore
# *** RVM CONFIGURATION ***
set :rvm_ruby_string, "ree-1.8.7-2012.02@#####"
set :rvm_type, :system
before 'deploy:setup', 'rvm:install_rvm' # install RVM
before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, or:
require 'rvm/capistrano'
require "bundler/capistrano"
set :application, "#######"
set :rails_env, "production"
set :repository, "##################.git"
set :scm, "git"
set :scm_verbose, true
set :branch, "master"
server "ratts.com.br", :web, :app, :db, :primary => true
set :user, "root"
set :use_sudo, false
set :deploy_to, "/var/www/#{application}"
set :shared_children, shared_children + %w( config/database.yml .rvmrc )
default_run_options[:pty] = true
after "deploy:restart", "deploy:cleanup"
after "deploy:restart", "deploy:restore_permissions"
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
task :restore_permissions, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} chown -R www-data:www-data #{latest_release}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment