diff options
| author | mo khan <mo@mokhan.ca> | 2014-11-14 20:16:08 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-11-14 20:16:08 -0700 |
| commit | d719699adfe64d7c22885e7a2d30c31961471ae9 (patch) | |
| tree | 94fd17d3f20f495d508489c611e4ab00ffa3c66a | |
| parent | a28ebe9cfba7a82403ee54eab786c202a0656493 (diff) | |
add config for puma.
| -rw-r--r-- | Procfile | 2 | ||||
| -rw-r--r-- | config/puma.rb | 17 |
2 files changed, 18 insertions, 1 deletions
@@ -1 +1 @@ -web: bundle exec rails s -p $PORT +web: bundle exec puma -C config/puma.rb diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..95b40e1 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,17 @@ +workers Integer(ENV['PUMA_WORKERS'] || 3) +threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16) + +preload_app! + +rackup DefaultRackup +port ENV['PORT'] || 3000 +environment ENV['RACK_ENV'] || 'development' + +on_worker_boot do + # worker specific setup + ActiveSupport.on_load(:active_record) do + config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env] + config['pool'] = ENV['MAX_THREADS'] || 16 + ActiveRecord::Base.establish_connection(config) + end +end |
