Created
November 25, 2010 18:11
-
-
Save miloops/715746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift(File.expand_path("~/.rvm/lib")) | |
require 'rvm/capistrano' | |
require 'bundler/capistrano' | |
set :rvm_ruby_string, '1.9.2-p0' | |
if ENV['STAGE'] == 'staging' | |
set :rvm_type, :user | |
set :branch, "jammit" | |
set :application, "app_name_staging" | |
set :domain, "190.15.198.197:8091" | |
set :rails_env, 'staging' | |
namespace :deploy do | |
task :start do | |
run "cd #{current_path} && passenger start -p 3001 -e staging -d --user #{user} --log-file #{shared_path}/log/passenger.3001.log --pid-file #{shared_path}/pids/passenger.3001.pid" | |
end | |
task :stop do | |
run "cd #{current_path} && passenger stop -p 3001 --pid-file #{shared_path}/pids/passenger.3001.pid" | |
end | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
#run "touch #{File.join(current_path,'tmp','restart.txt')}" | |
stop | |
start | |
end | |
end | |
task :restart_delayed_job, :roles => :app do | |
sudo "/usr/sbin/monit restart delayed_job_membresias" | |
end | |
elsif ENV['STAGE'] == 'production' | |
set :application, "app_name" | |
set :branch, "master" | |
set :domain, "www.app_name.com" | |
set :rails_env, 'production' | |
namespace :deploy do | |
task :start do end | |
task :stop do end | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
sudo "touch #{File.join(current_path,'tmp','restart.txt')}" | |
end | |
end | |
task :restart_delayed_job, :roles => :app do | |
sudo "/usr/sbin/monit restart delayed_job_app_name" | |
end | |
end | |
set :scm, :git | |
set :user, "capistrano" | |
set :repository, "[email protected]:miloops/app_name.git" | |
set :spinner_user, nil | |
default_run_options[:pty] = true | |
ssh_options[:forward_agent] = true | |
set :runner, user | |
set :deploy_to, "/home/#{user}/apps/#{application}" | |
set :deploy_via, :remote_cache | |
role :app, domain | |
role :web, domain | |
role :db, domain, :primary => true | |
set :config_files, %w(database.yml) | |
desc "After update code link images" | |
task :after_update_code do | |
on_rollback { | |
puts " | |
********** | |
Required config files were missing! | |
Please copy #{config_files.join(', ')} to the server! | |
******** | |
" | |
} | |
config_files.each do |file| | |
run "cp #{shared_path}/config/#{file} #{release_path}/config/" | |
end | |
end | |
task :before_restart, :roles => :app do | |
restart_delayed_job | |
end | |
require 'hoptoad_notifier/capistrano' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment