mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Refactor capistrano
* Cleanup * Add -q option for :start
This commit is contained in:
parent
2e24400246
commit
233a62c936
1 changed files with 14 additions and 12 deletions
|
@ -1,26 +1,28 @@
|
|||
Capistrano::Configuration.instance.load do
|
||||
after "deploy:stop", "puma:stop"
|
||||
after "deploy:start", "puma:start"
|
||||
after "deploy:restart", "puma:restart"
|
||||
after 'deploy:stop', 'puma:stop'
|
||||
after 'deploy:start', 'puma:start'
|
||||
after 'deploy:restart', 'puma:restart'
|
||||
|
||||
_cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
|
||||
_cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
|
||||
_cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
|
||||
_cset(:puma_role) { :app }
|
||||
|
||||
namespace :puma do
|
||||
desc "Start puma"
|
||||
desc 'Start puma'
|
||||
task :start, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
|
||||
puma_env = fetch(:rack_env, fetch(:rails_env, "production"))
|
||||
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
|
||||
puma_env = fetch(:rack_env, fetch(:rails_env, 'production'))
|
||||
run "cd #{current_path} && #{fetch(:puma_cmd)} -q -d -e #{puma_env} -b 'unix://#{shared_path}/sockets/puma.sock' -S #{fetch(:puma_state)} --control 'unix://#{shared_path}/sockets/pumactl.sock'", :pty => false
|
||||
end
|
||||
|
||||
desc "Stop puma"
|
||||
desc 'Stop puma'
|
||||
task :stop, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
|
||||
run "cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec pumactl -S #{shared_path}/sockets/puma.state stop"
|
||||
run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S fetch(:puma_state) stop"
|
||||
end
|
||||
|
||||
desc "Restart puma"
|
||||
desc 'Restart puma'
|
||||
task :restart, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
|
||||
run "cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec pumactl -S #{shared_path}/sockets/puma.state restart"
|
||||
run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S fetch(:puma_state) restart"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue