Skip to content

Commit

Permalink
Merge pull request #1384 from rubymonsters/anja-bring-back-unicorn
Browse files Browse the repository at this point in the history
move back to unicorn
  • Loading branch information
zaziemo authored Jul 19, 2024
2 parents a1c53f6 + 81fed18 commit 7bf22d1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ gem 'sassc-rails'

gem 'uglifier', '>= 1.0.3'

gem 'puma', '~> 3.4'
gem 'unicorn', '~> 5.1'

gem 'rack-piwik', '~> 0.3.0', require: 'rack/piwik'

Expand Down
8 changes: 6 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ GEM
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
jsonapi-renderer (0.2.2)
kgio (2.11.4)
launchy (2.5.2)
addressable (~> 2.8)
letter_opener (1.8.1)
Expand Down Expand Up @@ -327,7 +328,6 @@ GEM
method_source (~> 1.0)
psych (3.3.3)
public_suffix (5.0.1)
puma (3.12.6)
racc (1.7.1)
rack (2.2.6.4)
rack-attack (6.7.0)
Expand Down Expand Up @@ -367,6 +367,7 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
raindrops (0.20.1)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
Expand Down Expand Up @@ -450,6 +451,9 @@ GEM
execjs (>= 0.3.0, < 3)
unaccent (0.4.0)
unicode-display_width (1.4.1)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
uniform_notifier (1.16.0)
warden (1.2.9)
rack (>= 2.0.9)
Expand Down Expand Up @@ -508,7 +512,6 @@ DEPENDENCIES
poltergeist (= 1.18.1)
pry
psych (< 4.0)
puma (~> 3.4)
rack-attack
rack-piwik (~> 0.3.0)
rack-timeout
Expand All @@ -524,6 +527,7 @@ DEPENDENCIES
simple_form
stackprof
uglifier (>= 1.0.3)
unicorn (~> 5.1)
webrick (~> 1.7)

RUBY VERSION
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 -C config/puma.rb
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
1 change: 1 addition & 0 deletions app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def profiles_for_index

def build_categories_and_tags_for_tags_filter
@categories = Category.sorted_categories
# builds variables like @tags_internet
Category.all.includes(:translations).each do |category|
tags = ActsAsTaggableOn::Tag
.belongs_to_category(category.id)
Expand Down
4 changes: 2 additions & 2 deletions config/honeybadger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ development_environments:
# revision: null

# Enable verbose debug logging (useful for troubleshooting).
debug: true
debug: false

# Enable Honeybadger Insights
insights:
enabled: true
enabled: false
15 changes: 0 additions & 15 deletions config/puma.rb

This file was deleted.

22 changes: 22 additions & 0 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 1)
timeout 15
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

defined?(ActiveRecord::Base) and
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 send QUIT'
end

defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end

0 comments on commit 7bf22d1

Please sign in to comment.