task :stage1 do
set :default_environment, {
'PATH' => "/home/rrichards/.rvm/rubies/ruby-1.8.7-p249/bin:/home/rrichards/.rvm/gems/ruby-1.8.7-p249/bin:/home/rrichards/.rvm/gems/ruby-1.8.7-p249@global/bin:/home/rrichards/.rvm/bin:$PATH",
'RUBY_VERSION' => 'ruby 1.8.7',
'GEM_HOME' => '/home/rrichards/.rvm/gems/ruby-1.8.7-p249',
'GEM_PATH' => '/home/rrichards/.rvm/gems/ruby-1.8.7-p249:/home/rrichards/.rvm/gems/ruby-1.8.7-p249@global',
'BUNDLE_PATH' => '/home/rrichards/.rvm/gems/ruby-1.8.7-p249'
}
set :deploy_to, "/home/rrichards/www/freedomsoft"
set :user, "rrichards"
set :runner, "rrichards"
set :domain, "stage1.freedomsoft.com"
set :rails_env, "staging"
set :port, 22
role :web, domain, :asset_host_syncher => false
role :app, "stage1.freedomsoft.com"
role :db, domain, :primary => true
after "deploy:update_code", "symlink_local"
end
set :application, "Carpenter"
default_run_options[:pty] = true
set :use_sudo, false
set :ssh_options, { :forward_agent => true }
ssh_options[:keys]
set :keep_releases, 3
set :scm, :git
set :branch, :master
set :scm_verbose, true
set :repository, "git@github.com:freedomsoft/freedomsoft.git"
set :scm_username, "deployer"
set :git_enable_submodules, :true
set :deploy_via, :remote_cache
set :migrate_target, 'current'
namespace :deploy do
task :start, :roles => :app do
run "~/local/bin/unicorn start"
end
task :stop, :roles => :app do
run "~/local/bin/unicorn stop"
end
task :restart, :roles => :app do
run "~/local/bin/unicorn restart"
end
end
task :console, :roles => :app do
input = ''
run "cd #{current_path} && ./script/console #{rails_env}" do |channel, stream, data|
next if data.chomp == input.chomp || data.chomp == ''
print data
channel.send_data(input = $stdin.gets) if data =~ /^(>|\?)>/
end
end
namespace :deploy do
task :hotfix, :roles => :app do
run "cd #{current_path} && git pull origin #{branch}"
end
end
task :symlink_local, :roles => :app do
run "ln -nfs /home/rrichards/local/conf/database.yml #{release_path}/config/database.yml"
end
#############################################################
# Capistrano deployment hooks
#############################################################
after "deploy:update_code", :symlink_local
after "deploy:hotfix", "deploy:restart"
after "deploy:restart", "deploy:cleanup"