Created
January 7, 2013 15:34
-
-
Save anonymous/4475871 to your computer and use it in GitHub Desktop.
Mina issue
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
namespace :sidekiq do | |
# ### sidekiq:quiet | |
desc "Quiet sidekiq (stop accepting new work)" | |
task :quiet do | |
queue %{ if [ -f #{sidekiq_pid} ]; then | |
echo "-----> Quiet sidekiq (stop accepting new work)" | |
#{echo_cmd %{(cd #{deploy_to}/#{current_path} && #{sidekiqctl} quiet #{sidekiq_pid})} } | |
fi } | |
end | |
# ### sidekiq:stop | |
desc "Stop sidekiq" | |
task :stop do | |
queue %[ if [ -f #{sidekiq_pid} ]; then | |
echo "-----> Stop sidekiq" | |
#{echo_cmd %[(cd #{deploy_to}/#{current_path} && #{sidekiqctl} stop #{sidekiq_pid} #{sidekiq_timeout})]} | |
fi ] | |
end | |
# ### sidekiq:start | |
desc "Start sidekiq" | |
task :start do | |
queue %{ | |
echo "-----> Start sidekiq" | |
#{echo_cmd %[(cd #{deploy_to}/#{current_path} && nohup #{sidekiq} -e #{rails_env} -C #{sidekiq_config} -P #{sidekiq_pid} >> #{sidekiq_log} 2>&1 </dev/null &) ] } | |
} | |
end | |
# ### sidekiq:restart | |
desc "Restart sidekiq" | |
task :restart do | |
invoke :'sidekiq:stop' | |
invoke :'sidekiq:start' | |
end | |
end | |
task :environment do | |
# NOOP | |
end | |
task :setup => :environment do | |
queue! %[mkdir -p "#{deploy_to}/shared/log"] | |
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"] | |
queue! %[mkdir -p "#{deploy_to}/shared/config"] | |
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"] | |
queue! %[touch "#{deploy_to}/shared/config/database.yml"] | |
queue! "cd #{deploy_to} && rake db:setup" | |
queue %[echo "-----> Be sure to edit 'shared/config/database.yml'."] | |
end | |
desc "Setup DB" | |
task :db_setup => :environment do | |
deploy do | |
invoke :'git:clone' | |
invoke :'deploy:link_shared_paths' | |
invoke :'bundle:install' | |
queue! "RAILS_ENV=production rake db:setup" | |
invoke :'rails:assets_precompile' | |
end | |
end | |
desc "Deploys the current version to the server." | |
task :deploy => :environment do | |
deploy do | |
# Put things that will set up an empty directory into a fully set-up | |
# instance of your project. | |
invoke :'sidekiq:quiet' | |
invoke :'git:clone' | |
invoke :'deploy:link_shared_paths' | |
invoke :'bundle:install' | |
invoke :'rails:db_migrate' | |
invoke :'rails:assets_precompile' | |
to :launch do | |
queue 'sudo service unicorn upgrade /etc/unicorn/eset.conf' | |
invoke :'sidekiq:restart' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment