Skip to content

Instantly share code, notes, and snippets.

@azell
Forked from mebezac/Gemfile
Last active August 29, 2015 14:12
Show Gist options
  • Save azell/2928c608778b20f6a9db to your computer and use it in GitHub Desktop.
Save azell/2928c608778b20f6a9db to your computer and use it in GitHub Desktop.
#config/initializers/database_connection.rb
Rails.application.config.after_initialize do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
if config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds
config['pool'] = ENV['DB_POOL'] || 5
ActiveRecord::Base.establish_connection(config)
end
end
end
gem 'foreman'
gem 'puma'
web: bundle exec puma -t ${PUMA_MIN_THREADS:-8}:${PUMA_MAX_THREADS:-12} -w ${PUMA_WORKERS:-2} -p $PORT -e ${RACK_ENV:-development}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment