Skip to content

Instantly share code, notes, and snippets.

@tinti
Created November 7, 2012 16:00
Show Gist options
  • Save tinti/4032444 to your computer and use it in GitHub Desktop.
Save tinti/4032444 to your computer and use it in GitHub Desktop.
Rails 3.2.0 Capistrano
#require "bundler/capistrano"
require "rvm/capistrano"
# General
set :application, "test_capistrano"
set :domain, "test_capistrano.mxt.com.br"
set :user, "mxt"
set :runner, "mxt"
set :use_sudo, false
set :deploy_to, "/home/mxt/rails/#{application}"
set :repository_cache, "#{application}_cache"
set :environment, "production"
set :rvm_type, :user
#set :rvm_bin_path, "/home/mxt/.rvm/bin"
# Roles
role :web, "test_capistrano.mxt.com.br"
role :app, "test_capistrano.mxt.com.br"
role :db, "test_capistrano.mxt.com.br", :primary => true
# GIT
set :repository, "mxt@192.168.1.162:/home/mxt/git/test_capistrano.git"
set :branch, "master"
set :keep_releases, 5
set :deploy_via, :remote_cache
set :scm, :git
set :scm_username, "git"
set :scm_passphrase, Capistrano::CLI.password_prompt("Type your ssh passphrase for user #{scm_username}: ")
# SSH
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
ssh_options[:paranoid] = true # comment out if it gives you trouble. newest net/ssh needs this set.
######## Callbacks - No More Config ########
after 'deploy:symlink', 'deploy:cleanup' # makes sure there's only 3 deployments, deletes the extras
# Custom Tasks
namespace :deploy do
task(:start) {}
task(:stop) {}
desc "Restart Application"
task :restart, :roles => :web, :except => { :no_release => true } do
run "touch #{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