Replace puma with unicorn

This commit is contained in:
Erik Michaels-Ober 2015-09-04 22:28:15 +02:00
parent 0a387f5b69
commit 7af33296fc
4 changed files with 27 additions and 4 deletions

View File

@ -32,8 +32,8 @@ group :development, :test do
end
group :production do
gem 'puma'
gem 'skylight'
gem 'unicorn'
end
group :test do

View File

@ -93,6 +93,7 @@ GEM
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
@ -114,7 +115,6 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puma (2.13.4)
rack (1.6.4)
rack-pjax (0.8.0)
nokogiri (~> 1.5)
@ -165,6 +165,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.15.0)
rake (10.4.2)
remotipart (1.2.1)
responders (2.1.0)
@ -218,6 +219,10 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unicorn (4.9.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
validates_formatting_of (0.9.0)
activemodel
warden (1.2.3)
@ -240,7 +245,6 @@ DEPENDENCIES
nokogiri
pg
pry
puma
rails (~> 4.2.4)
rails_12factor
rails_admin
@ -251,6 +255,7 @@ DEPENDENCIES
spring
sqlite3
uglifier
unicorn
validates_formatting_of
webmock

View File

@ -1 +1 @@
web: bundle exec puma -p $PORT
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

18
config/unicorn.rb Normal file
View File

@ -0,0 +1,18 @@
worker_processes 3
timeout 30
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
end
ActiveRecord::Base.establish_connection
end