Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added puma as the default server on heroku
  • Loading branch information
rootux committed Jan 3, 2017
1 parent f3f2e92 commit ac5f2f5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -72,6 +72,7 @@ gem 'simple_form'
gem 'font-awesome-sass'
gem 'bootstrap-modal-rails'
gem 'google-api-client'
gem 'rack-timeout'

group :production do
# needed by herokus
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -224,6 +224,7 @@ GEM
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rack-timeout (0.4.2)
rails (4.2.5)
actionmailer (= 4.2.5)
actionpack (= 4.2.5)
Expand Down Expand Up @@ -364,6 +365,7 @@ DEPENDENCIES
pg
puma
pundit
rack-timeout
rails (= 4.2.5)
rails_12factor
rmagick
Expand Down
1 change: 1 addition & 0 deletions Procfile
@@ -0,0 +1 @@
web: bundle exec puma -C config/puma.rb
2 changes: 2 additions & 0 deletions config/initializers/timeout.rb
@@ -0,0 +1,2 @@
# config/initializers/timeout.rb
Rack::Timeout.timeout = 25 # seconds
15 changes: 15 additions & 0 deletions config/puma.rb
@@ -0,0 +1,15 @@
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end

0 comments on commit ac5f2f5

Please sign in to comment.