Created
January 26, 2011 09:20
-
-
Save IskanderHaziev/796457 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
require 'hoptoad_notifier/capistrano' | |
require 'capistrano/ext/multistage' | |
set :stages, %w(testing staging production) | |
set :default_stage, 'staging' | |
set :use_sudo, false | |
default_run_options[:pty] = true | |
set :scm, :git | |
set :repository, "git@github.com:Turn2Live/turn2live.git" | |
########################################################################################### | |
# set :deploy_via, :remote_cache # This does not work with submodules for some reason - SKW | |
# set :git_shallow_clone, 1 # Danger when used with branching - SKW | |
########################################################################################### | |
# set :git_enable_submodules, 1 | |
# t2l | |
#role :app, "209.20.92.216" | |
#role :web, "209.20.92.216" | |
#role :db, "209.20.92.216", :primary => true | |
# moodfish | |
role :app, "209.20.93.172" | |
role :web, "209.20.93.172" | |
role :db, "209.20.93.172", :primary => true | |
set :scm_username, "deployer" | |
set :scm_passphrase, "nodep4Udude" | |
set :user, "deployer" | |
set :runner, "deployer" | |
# set :use_sudo, true | |
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path. | |
require "rvm/capistrano" # Load RVM's capistrano plugin. | |
set :rvm_ruby_string, 'ruby-1.8.7@moodfish303' # Or whatever env you want it to run in. | |
set :rvm_type, :user | |
namespace :deploy do | |
task :default do | |
set :migrate_target, :latest | |
update_code | |
copy_database_configuration | |
migrate | |
symlink | |
#update_crontab | |
restart | |
cleanup | |
end | |
desc "Setup db, facebooker config for deployment" | |
task :copy_database_configuration do | |
db_config = "/home/deployer/config/#{rails_env}_database.yml" | |
run "cp #{db_config} #{release_path}/config/database.yml" | |
config = "/home/deployer/config/#{rails_env}.rb" | |
run "cp #{config} #{release_path}/config/environments/#{rails_env}.rb" | |
#run "cp -pR /home/deployer/playlists/#{rails_env}/* #{release_path}/public/playlist/" | |
facebooker_config = "/home/deployer/config/#{rails_env}_facebooker.yml" | |
run "cp #{facebooker_config} #{release_path}/config/facebooker.yml" | |
end | |
desc "Restarting mod_rails with restart.txt" | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "touch #{File.join(current_path,'tmp','restart.txt')}" | |
end | |
desc "Update the crontab file" | |
task :update_crontab, :roles => :db do | |
run "cd #{release_path} && whenever --update-crontab #{application}" | |
end | |
[:start, :stop].each do |t| | |
desc "#{t} task is a no-op with mod_rails" | |
task t, :roles => :app do ; end | |
end | |
#after "deploy:update_code", "deploy:copy_database_configuration" ####, "workling:start" #### | |
#after "deploy:update_code", "deploy:restart" | |
end | |
namespace :workling do | |
desc "Stop Workling" | |
task :stop do | |
pid = capture("cat /home/deployer/apps/#{application}/current/log/workling_monitor.pid") | |
puts "Killing PID: #{pid}" | |
run "kill -9 #{pid}" | |
run "rm /home/deployer/apps/#{application}/current/log/workling_monitor.pid" | |
pid = capture("cat /home/deployer/apps/#{application}/current/log/workling.pid") | |
puts "Killing PID: #{pid}" | |
run "kill -9 #{pid}" | |
run "rm /home/deployer/apps/#{application}/current/log/workling.pid" | |
end | |
desc "Start Workling" | |
task :start do | |
puts "Starting Workling..." | |
run "cd #{release_path};RAILS_ENV=#{rails_env} script/workling_client start" | |
end | |
end | |
Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier| | |
$: << File.join(vendored_notifier, 'lib') | |
end | |
require 'hoptoad_notifier/capistrano' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment