Skip to content

Instantly share code, notes, and snippets.

@hughevans
Last active December 31, 2015 02:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughevans/7922367 to your computer and use it in GitHub Desktop.
Save hughevans/7922367 to your computer and use it in GitHub Desktop.
web: bundle exec puma -p $PORT -C config/puma.rb
if ENV['BOXEN_SOCKET_DIR']
bind "unix://#{ENV['BOXEN_SOCKET_DIR']}/my-app"
workers 2
end
if ENV['RACK_ENV'] == 'production'
db_pool = 5 # ENV['DB_POOL']
db_reap_freq = 10 # ENV['DB_REAP_FREQ']
environment 'production'
threads 4, 4 # threads_min, threads_max = 4 # db_pool - 1
workers 3
preload_app!
on_worker_boot do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = db_reap_freq
config['pool'] = db_pool
ActiveRecord::Base.establish_connection
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment