Skip to content

Commit

Permalink
Replace puma with unicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Sep 4, 2015
1 parent 0a387f5 commit 7af3329
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ group :development, :test do
end

group :production do
gem 'puma'
gem 'skylight'
gem 'unicorn'
end

group :test do
Expand Down
9 changes: 7 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -240,7 +245,6 @@ DEPENDENCIES
nokogiri
pg
pry
puma
rails (~> 4.2.4)
rails_12factor
rails_admin
Expand All @@ -251,6 +255,7 @@ DEPENDENCIES
spring
sqlite3
uglifier
unicorn
validates_formatting_of
webmock

Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: bundle exec puma -p $PORT
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
18 changes: 18 additions & 0 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7af3329

Please sign in to comment.