Skip to content

Commit d5e8d45

Browse files
Added unicorn
1 parent ac2499e commit d5e8d45

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
33
ruby '1.9.3'
44

55
gem 'rails', '~> 3.2.6'
6+
gem 'unicorn'
67
gem 'mongoid', '~> 3.0.0.rc'
78
gem 'doorkeeper', git: 'https://github.com/andreareginato/doorkeeper', branch: 'mongoid_v3'
89
gem 'rabl'

Gemfile.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ GEM
106106
i18n (0.6.0)
107107
journey (1.0.4)
108108
json (1.7.4)
109+
kgio (2.7.4)
109110
launchy (2.1.1)
110111
addressable (~> 2.3)
111112
libwebsocket (0.1.5)
@@ -165,6 +166,7 @@ GEM
165166
rake (>= 0.8.7)
166167
rdoc (~> 3.4)
167168
thor (>= 0.14.6, < 2.0)
169+
raindrops (0.10.0)
168170
rake (0.9.2.2)
169171
rb-fchange (0.0.5)
170172
ffi
@@ -220,6 +222,10 @@ GEM
220222
uglifier (1.0.4)
221223
execjs (>= 0.3.0)
222224
multi_json (>= 1.0.2)
225+
unicorn (4.3.1)
226+
kgio (~> 2.6)
227+
rack
228+
raindrops (~> 0.7)
223229
webmock (1.8.7)
224230
addressable (>= 2.2.7)
225231
crack (>= 0.1.7)
@@ -260,5 +266,6 @@ DEPENDENCIES
260266
shoulda
261267
spork (~> 1.0rc)
262268
uglifier (~> 1.0.3)
269+
unicorn
263270
webmock
264271
yajl-ruby

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: bundle exec rails server -p $PORT
1+
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

config/application.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,8 @@ class Application < Rails::Application
6161

6262
# Middlewares
6363
config.middleware.use 'Hostable'
64+
65+
# Set the default Logger in application.rb to STDOUT, otherwise logging with unicorn doesn't work
66+
config.logger = Logger.new(STDOUT)
6467
end
6568
end

config/unicorn.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
worker_processes 4 # amount of unicorn workers to spin up
2+
timeout 30 # restarts workers that hang for 30 seconds
3+
preload_app true # load the application before forking workers (et to true if you use NewRelic or you won't see any data)
4+
# prefork not needed for Mongoid as it is lazy loaded

0 commit comments

Comments
 (0)