Merge pull request #104 from indentlabs/use-puma

Use puma
This commit is contained in:
Andrew Brown 2016-10-16 21:05:24 +02:00 committed by GitHub
commit f10f9d7547
6 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,9 @@
source 'https://rubygems.org'
gem 'rails', '4.2.5'
gem 'puma', '~> 3.6.0'
gem 'puma-heroku'
gem 'rack-timeout'
# Storage
gem 'aws-sdk', '~> 1.50'

View File

@ -201,9 +201,13 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puma (3.6.0)
puma-heroku (1.0.0)
puma (~> 3.0)
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)
@ -361,6 +365,9 @@ DEPENDENCIES
paperclip (~> 4.2.0)
pg
pry
puma (~> 3.6.0)
puma-heroku
rack-timeout
rails (= 4.2.5)
rails-jquery-autocomplete
rails-perftest

1
Procfile Normal file
View File

@ -0,0 +1 @@
web: bundle exec puma -C config/puma.rb

View File

@ -22,6 +22,7 @@ test: &test
cucumber:
<<: *test
production:
url: <%= ENV['DATABASE_URL'] %>
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %>

View File

@ -0,0 +1 @@
Rack::Timeout.timeout = 20 # seconds

17
config/puma.rb Normal file
View File

@ -0,0 +1,17 @@
require 'puma/plugin/heroku'
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