mirror of
http://ghproxy.cn/https://github.com/multunus/onemdm-server
synced 2025-12-06 02:04:57 +00:00
- https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
24 lines
875 B
Ruby
24 lines
875 B
Ruby
#Please read the following before making any changes
|
|
#1. https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
|
|
#2. https://devcenter.heroku.com/articles/concurrency-and-database-connections#threaded-servers
|
|
|
|
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
|
|
threads_count = Integer(ENV['MAX_THREADS'] || 1)
|
|
threads threads_count, threads_count
|
|
|
|
preload_app!
|
|
|
|
rackup DefaultRackup
|
|
port ENV['PORT'] || 3000
|
|
environment ENV['RACK_ENV'] || 'development'
|
|
|
|
on_worker_boot do
|
|
# Valid on Rails up to 4.1 the initializer method of setting `pool` size
|
|
ActiveSupport.on_load(:active_record) do
|
|
config = ActiveRecord::Base.configurations[Rails.env] ||
|
|
Rails.application.config.database_configuration[Rails.env]
|
|
config['pool'] = ENV['DB_POOL'] || 5
|
|
ActiveRecord::Base.establish_connection(config)
|
|
end
|
|
end
|