production unicorn changes

This commit is contained in:
r888888888 2016-11-07 03:24:34 -08:00
parent 898f3b105d
commit 619beb00af
3 changed files with 22 additions and 6 deletions

View File

@ -69,8 +69,8 @@ end
group :production do
gem 'newrelic_rpm'
# gem 'unicorn-worker-killer'
# gem 'gctools', :platforms => :ruby
gem 'unicorn-worker-killer'
gem 'gctools', :platforms => :ruby
end
group :development do

View File

@ -138,6 +138,8 @@ GEM
multipart-post (>= 1.2, < 3)
ffaker (2.1.0)
ffi (1.9.10-x64-mingw32)
gctools (0.2.4)
get_process_mem (0.2.1)
git (1.3.0)
github_api (0.14.5)
addressable (~> 2.4.0)
@ -401,6 +403,9 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
unicorn-worker-killer (0.4.4)
get_process_mem (~> 0)
unicorn (>= 4, < 6)
vcr (2.9.3)
webmock (1.21.0)
addressable (>= 2.3.6)
@ -435,6 +440,7 @@ DEPENDENCIES
dtext_rb!
factory_girl
ffaker
gctools
google-api-client
highline
kgio
@ -472,6 +478,7 @@ DEPENDENCIES
tzinfo-data
uglifier
unicorn
unicorn-worker-killer
vcr
webmock
whenever

View File

@ -2,9 +2,18 @@
require ::File.expand_path('../config/environment', __FILE__)
# if defined?(Unicorn) && Rails.env.production?
# require_dependency 'gctools/oobgc'
# use GC::OOB::UnicornMiddleware
# end
if defined?(Unicorn) && Rails.env.production?
# Unicorn self-process killer
require 'unicorn/worker_killer'
# Max requests per worker
use Unicorn::WorkerKiller::MaxRequests, 10_000, 15_000
# Max memory size (RSS) per worker
#use Unicorn::WorkerKiller::Oom, (192*(1024**2)), (256*(1024**2))
require 'gctools/oobgc'
use GC::OOB::UnicornMiddleware
end
run Rails.application