Skip to content

Instantly share code, notes, and snippets.

@gacha
Last active March 13, 2017 21:49
Show Gist options
  • Save gacha/6248399 to your computer and use it in GitHub Desktop.
Save gacha/6248399 to your computer and use it in GitHub Desktop.
puma config for rails
rails_env = ENV['RAILS_ENV'] || 'development'
rails_root = File.expand_path("../", File.dirname(__FILE__))
# threads
threads 0,1
# workers
case rails_env
when 'staging'
workers 1
when 'production'
workers 2
else
workers 0
end
# bind
if ['staging', 'production'].include?(rails_env)
bind 'unix://' + File.join(rails_root, "tmp/sockets/puma.sock")
else
bind 'tcp://0.0.0.0:3000'
end
pidfile File.join(rails_root, "tmp/pids/puma.pid")
state_path File.join(rails_root, "tmp/sockets/puma.state")
activate_control_app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment