Skip to content

Commit

Permalink
Use unicorn in production
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmorrison committed Nov 28, 2012
1 parent 39bbcb1 commit 3b3203a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ group :development, :test do
end

group :production do
gem 'thin'
gem 'unicorn'
gem 'rack-canonical-host'
end
15 changes: 8 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ GEM
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
daemons (1.1.8)
database_cleaner (0.7.2)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (0.12.10)
excon (0.13.4)
execjs (1.4.0)
multi_json (~> 1.0)
Expand Down Expand Up @@ -114,6 +112,7 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.3)
kgio (2.7.4)
launchy (2.1.0)
addressable (~> 2.2.6)
libwebsocket (0.1.3)
Expand Down Expand Up @@ -161,6 +160,7 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
raindrops (0.10.0)
rdoc (3.12)
json (~> 1.4)
rest-client (1.6.7)
Expand Down Expand Up @@ -205,10 +205,6 @@ GEM
tilt (~> 1.1, != 1.3.0)
stripe (1.6.3)
rest-client (~> 1.4)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.3)
timecop (0.3.5)
Expand All @@ -220,6 +216,11 @@ GEM
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
xpath (0.1.4)
unicorn (4.4.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
websocket (1.0.4)
nokogiri (~> 1.3)

PLATFORMS
Expand Down Expand Up @@ -249,6 +250,6 @@ DEPENDENCIES
sendgrid
simplecov
stripe (~> 1.6.2)
thin
timecop (~> 0.3)
uglifier (~> 1.2.3)
unicorn
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec unicorn_rails -p $PORT -c ./config/unicorn.rb
17 changes: 17 additions & 0 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D

rails_env = ENV['RAILS_ENV'] || 'production'

# 3 workers and 1 master
worker_processes 3

# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true

# Restart any workers that haven't responded in 30 seconds
timeout 30

after_fork do |server, worker|
ActiveRecord::Base.establish_connection
end

0 comments on commit 3b3203a

Please sign in to comment.