added dj to deploy (starting only one worker for now)

This commit is contained in:
Timothy N. Tsvetkov 2011-04-11 20:51:54 +04:00
parent 1a6330956b
commit ad61eec876
1 changed files with 7 additions and 6 deletions

View File

@ -34,24 +34,27 @@ task :symlink_config_files do
run "mkdir -p #{deploy_to}/#{shared_dir}/config" run "mkdir -p #{deploy_to}/#{shared_dir}/config"
run "yes n | cp -i #{release_path}/config/database.yml.sample #{deploy_to}/#{shared_dir}/config/database.yml" run "yes n | cp -i #{release_path}/config/database.yml.sample #{deploy_to}/#{shared_dir}/config/database.yml"
# run "yes n | cp -i #{release_path}/config/config.yml.sample #{deploy_to}/#{shared_dir}/config/config.yml"
run "yes n | cp -i #{release_path}/config/application.yml.sample #{deploy_to}/#{shared_dir}/config/application.yml" run "yes n | cp -i #{release_path}/config/application.yml.sample #{deploy_to}/#{shared_dir}/config/application.yml"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml" run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
# run "ln -nfs #{deploy_to}/#{shared_dir}/config/config.yml #{release_path}/config/config.yml"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/application.yml #{release_path}/config/application.yml" run "ln -nfs #{deploy_to}/#{shared_dir}/config/application.yml #{release_path}/config/application.yml"
end end
namespace :deploy do namespace :deploy do
desc "Restarting mod_rails with restart.txt" desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do task :restart, :roles => :app, :except => { :no_release => true } do
run "cd #{deploy_to}/current ; ([ -f tmp/pids/unicorn.pid ] && kill -USR2 `cat tmp/pids/unicorn.pid`); true" run "cd #{deploy_to}/current ; ([ -f tmp/pids/unicorn.pid ] && kill -USR2 `cat tmp/pids/unicorn.pid`); true"
restart_dj
end end
%w(start).each { |name| task name, :roles => :app do deploy.restart end } %w(start).each { |name| task name, :roles => :app do deploy.restart end }
desc "Restart delayed job"
task :restart_dj, :roles => :web do
run "cd #{deploy_to}/current ; RAILS_ENV=production ./script/delayed_job stop; RAILS_ENV=production ./script/delayed_job start; true"
end
desc "Rude restart application" desc "Rude restart application"
task :rude_restart, :roles => :web do task :rude_restart, :roles => :web do
run "cd #{deploy_to}/current ; pkill unicorn; sleep 0.5; pkill -9 unicorn; sleep 0.5 ; unicorn_rails -c config/unicorn.rb -E production -D " run "cd #{deploy_to}/current ; pkill unicorn; sleep 0.5; pkill -9 unicorn; sleep 0.5 ; unicorn_rails -c config/unicorn.rb -E production -D "
@ -64,9 +67,7 @@ namespace :deploy do
envs = "RAILS_ENV=production" envs = "RAILS_ENV=production"
# Precaching assets # Precaching assets
run_locally "bash -c '" + run_locally "bash -c '#{envs} jammit'"
# "#{envs} compass compile && " +
"#{envs} jammit'"
# Uploading prechached assets # Uploading prechached assets
top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true