Skip to content

Instantly share code, notes, and snippets.

@3014zhangshuo
Created May 13, 2019 07:13
Show Gist options
  • Save 3014zhangshuo/e56fe8eb4df5496b4e897e8d65dc25c8 to your computer and use it in GitHub Desktop.
Save 3014zhangshuo/e56fe8eb4df5496b4e897e8d65dc25c8 to your computer and use it in GitHub Desktop.
puma config
bundle exec puma start -C config/puma.rb
threads_count = 32
threads 4, 32
port 8888
environment "production"
app_dir = '/opt/app/www.yoursite.com/current'
directory app_dir
rackup "#{app_dir}/config.ru"
shared_dir = '/opt/app/www.yoursite.com/shared'
workers 8
bind "unix://#{shared_dir}/sockets/puma.sock"
stdout_redirect "#{shared_dir}/log/puma.stdout.log", "#{shared_dir}/log/puma.stderr.log", true
pidfile "#{shared_dir}/pids/puma.pid"
state_path "#{shared_dir}/pids/puma.state"
daemonize true
preload_app!
before_fork do
ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
end
on_worker_boot do
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment