2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-12-13 21:48:25 +00:00
|
|
|
Capistrano::Configuration.instance(:must_exist).load do
|
|
|
|
namespace :bluepill do
|
2011-12-14 21:06:31 +00:00
|
|
|
set(:bluepill_binary) {"bundle exec bluepill --no-privileged"}
|
2011-12-13 21:48:25 +00:00
|
|
|
|
2012-02-17 14:32:03 +00:00
|
|
|
namespace :processes do
|
|
|
|
desc "Start processes that bluepill is monitoring"
|
|
|
|
task :start, :roles => [:app] do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} start"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Stop processes that bluepill is monitoring"
|
|
|
|
task :stop, :roles => [:app], :on_error => :continue do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} stop"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Restart processes that bluepill is monitoring"
|
|
|
|
task :restart, :roles => [:app] do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} restart"
|
|
|
|
end
|
2011-12-13 21:48:25 +00:00
|
|
|
|
2012-02-17 14:32:03 +00:00
|
|
|
desc "Prints bluepills monitored processes statuses"
|
|
|
|
task :status, :roles => [:app] do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} status"
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Restart DJ process"
|
|
|
|
task :restart_dj, :roles => [:app] do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} restart delayed_job"
|
|
|
|
end
|
2011-12-14 20:16:00 +00:00
|
|
|
end
|
|
|
|
|
2012-02-17 14:32:03 +00:00
|
|
|
desc "Start a bluepill process and load a config"
|
|
|
|
task :start, :roles => [:app] do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} APP_NAME=#{fetch :application} #{bluepill_binary} load config/production.pill"
|
2011-12-14 20:16:00 +00:00
|
|
|
end
|
|
|
|
|
2012-02-17 14:32:03 +00:00
|
|
|
desc "Quit bluepill"
|
2012-02-28 09:41:02 +00:00
|
|
|
task :quit, :roles => [:app] do
|
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} stop"
|
2011-12-14 21:06:31 +00:00
|
|
|
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} quit"
|
2011-12-14 14:47:32 +00:00
|
|
|
end
|
|
|
|
|
2012-02-17 14:32:03 +00:00
|
|
|
desc "Completely restart bluepill and monitored services"
|
|
|
|
task :restart, :roles => [:app] do
|
|
|
|
processes.stop; stop; start
|
2011-12-13 21:48:25 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|