Created
May 8, 2013 13:35
-
-
Save pfleidi/5540455 to your computer and use it in GitHub Desktop.
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
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' | |
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(:puma_cmd)} -q -d -e #{puma_env} -b 'tcp://127.0.0.1:9292' -S #{fetch(:puma_state)} --control 'unix://#{shared_path}/sockets/pumactl.sock'", :pty => false | |
end | |
desc 'Stop puma' | |
task :stop, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do | |
run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S #{fetch(:puma_state)} stop" | |
end | |
desc 'Restart puma' | |
task :restart, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do | |
run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S #{fetch(:puma_state)} restart" | |
end | |
desc "Status of puma" | |
task :status, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do | |
run "cd #{current_path} && #{fetch(:pumactl_cmd)} -S #{fetch(:puma_state)} stats" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment