Skip to content

Commit 007482e

Browse files
committed
Adding unicorn to see what happens.
1 parent a0a32a4 commit 007482e

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

Diff for: Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ gem 'activerecord-postgis-adapter'
4949
gem 'rgeo'
5050
gem 'rgeo-geojson'
5151
gem 'oj'
52+
gem 'unicorn'
5253

5354
group :development, :development_aws, :production, :test do
5455
gem 'rack-cors', :require => 'rack/cors'

Diff for: Gemfile.lock

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ GEM
4848
railties (>= 3.0, < 5.0)
4949
thor (>= 0.14, < 2.0)
5050
json (1.8.0)
51+
kgio (2.8.0)
5152
mail (2.5.4)
5253
mime-types (~> 1.16)
5354
treetop (~> 1.4.8)
@@ -80,6 +81,7 @@ GEM
8081
activesupport (= 4.0.0)
8182
rake (>= 0.8.7)
8283
thor (>= 0.18.1, < 2.0)
84+
raindrops (0.12.0)
8385
rake (10.1.0)
8486
rdoc (3.12.2)
8587
json (~> 1.4)
@@ -120,6 +122,10 @@ GEM
120122
uglifier (2.2.1)
121123
execjs (>= 0.3.0)
122124
multi_json (~> 1.0, >= 1.0.2)
125+
unicorn (4.6.3)
126+
kgio (~> 2.6)
127+
rack
128+
raindrops (~> 0.7)
123129

124130
PLATFORMS
125131
ruby
@@ -140,3 +146,4 @@ DEPENDENCIES
140146
sdoc
141147
turbolinks
142148
uglifier (>= 1.3.0)
149+
unicorn

Diff for: Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

Diff for: config/unicorn.rb

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# config/unicorn.rb
2+
3+
worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
4+
timeout Integer(ENV['WEB_TIMEOUT'] || 15)
5+
preload_app true
6+
7+
before_fork do |server, worker|
8+
9+
Signal.trap 'TERM' do
10+
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
11+
Process.kill 'QUIT', Process.pid
12+
end
13+
14+
defined?(ActiveRecord::Base) and
15+
ActiveRecord::Base.connection.disconnect!
16+
end
17+
18+
after_fork do |server, worker|
19+
20+
Signal.trap 'TERM' do
21+
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
22+
end
23+
24+
defined?(ActiveRecord::Base) and
25+
ActiveRecord::Base.establish_connection
26+
end

0 commit comments

Comments
 (0)