2012-10-16 00:08:19 -03:00
|
|
|
Capistrano::Configuration.instance.load do
|
|
|
|
after "deploy:stop", "puma:stop"
|
|
|
|
after "deploy:start", "puma:start"
|
|
|
|
after "deploy:restart", "puma:restart"
|
|
|
|
|
|
|
|
_cset(:puma_role) { :app }
|
|
|
|
|
|
|
|
namespace :puma do
|
|
|
|
desc "Start puma"
|
|
|
|
task :start, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
|
2012-10-20 10:16:18 +08:00
|
|
|
puma_env = fetch(:rack_env, fetch(:rails_env, "production"))
|
2012-10-16 09:21:49 -03:00
|
|
|
run "cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec puma -d -e #{puma_env} -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock'", :pty => false
|
2012-10-16 00:08:19 -03:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Stop puma"
|
|
|
|
task :stop, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
|
2012-10-16 01:47:34 -03:00
|
|
|
run "cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec pumactl -S #{shared_path}/sockets/puma.state stop"
|
2012-10-16 00:08:19 -03:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Restart puma"
|
|
|
|
task :restart, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
|
2012-10-16 01:47:34 -03:00
|
|
|
run "cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec pumactl -S #{shared_path}/sockets/puma.state restart"
|
2012-10-16 00:08:19 -03:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2012-10-20 10:16:18 +08:00
|
|
|
end
|