Skip to content

Commit 6ef01db

Browse files
committed
Add a basic Puma configuration file
Heroku recommends generating a config file rather than setting values inline in the Procfile: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
1 parent 79e367d commit 6ef01db

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
1+
web: bundle exec puma -C config/puma.rb

Diff for: config/puma.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
2+
threads_count = Integer(ENV['MAX_THREADS'] || 5)
3+
threads threads_count, threads_count
4+
5+
preload_app!
6+
7+
rackup DefaultRackup
8+
port ENV['PORT'] || 3000
9+
environment ENV['RACK_ENV'] || 'development'
10+
11+
on_worker_boot do
12+
# Worker specific setup for Rails 4.1+
13+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
14+
ActiveRecord::Base.establish_connection
15+
end

0 commit comments

Comments
 (0)