Skip to content

Instantly share code, notes, and snippets.

@sebatyler
Created February 17, 2015 02:02
Show Gist options
  • Save sebatyler/4116f9b1bdd80659d4f9 to your computer and use it in GitHub Desktop.
Save sebatyler/4116f9b1bdd80659d4f9 to your computer and use it in GitHub Desktop.
puma ruby on rails deployment
set :puma_conf, "#{fetch(:deploy_to)}/current/config/puma.rb"
# default hook 끄고 항상 phased-restart (zero downtime)
namespace :puma do
Rake::Task['check'].clear_actions
Rake::Task['smart_restart'].clear_actions
end
after 'deploy:finished', 'puma:phased-restart'
RACK_ENV = ENV['RACK_ENV'] || 'production'
PREFIX = "/var/www/rails/#{RACK_ENV}"
CURRENT = "#{PREFIX}/current"
SHARED = "#{PREFIX}/shared"
environment "#{RACK_ENV}"
rackup "#{CURRENT}/config.ru"
pidfile "#{SHARED}/tmp/pids/puma.pid"
state_path "#{SHARED}/tmp/pids/puma.state"
stdout_redirect "#{SHARED}/log/puma_access.log", "#{SHARED}/log/puma_error.log", true
bind "unix://#{SHARED}/tmp/sockets/puma.sock"
threads 8, 32
workers 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment