Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Capistrano recipe for Puma start/stop/restarts
set :shared_children, shared_children << 'tmp/sockets'
namespace :deploy do
desc "Start the application"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
end
desc "Stop the application"
task :stop, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec pumactl -S #{shared_path}/sockets/puma.state stop"
end
desc "Restart the application"
task :restart, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec pumactl -S #{shared_path}/sockets/puma.state restart"
end
desc "Status of the application"
task :status, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec pumactl -S #{shared_path}/sockets/puma.state stats"
end
end
@linjunpop

This comment has been minimized.

Copy link

@linjunpop linjunpop commented Sep 24, 2012

The start script should add -e production,
see this: puma/puma#149 (comment)

@plentz

This comment has been minimized.

Copy link

@plentz plentz commented Oct 16, 2012

@shtirlic

This comment has been minimized.

Copy link

@shtirlic shtirlic commented Feb 27, 2013

My fork with vars and more clean https://gist.github.com/shtirlic/5052306
thx @joelmoss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment