Use unicorn.rb config, sans prefork for now.

This commit is contained in:
Mathias Meyer 2012-12-05 18:19:23 +01:00
parent 37e04c16ae
commit 47287014a1
2 changed files with 2 additions and 21 deletions

View File

@ -1,23 +1,4 @@
# http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/
worker_processes 3 # amount of unicorn workers to spin up
worker_processes 4 # amount of unicorn workers to spin up
timeout 30 # restarts workers that hang for 15 seconds
preload_app true
before_fork do |server, worker|
ActiveRecord::Base.connection.disconnect! if defined?(ActiveRecord::Base)
end
after_fork do |server, worker|
require 'travis'
Travis::Amqp.connect
ActiveRecord::Base.establish_connection if defined?(ActiveRecord::Base)
if $metriks_reporter
$metriks_reporter.stop
$metriks_reporter.start
end
end

View File

@ -3,6 +3,6 @@ cd "$(dirname "$0")/.."
[ $PORT ] || PORT=3000
[ $RACK_ENV ] || RACK_ENV=development
cmd="ruby -I lib -S bundle exec ruby -I lib -S unicorn config.ru -p $PORT -E $RACK_ENV"
cmd="ruby -I lib -S bundle exec ruby -I lib -S unicorn config.ru -c config/unicorn.rb -p $PORT -E $RACK_ENV"
[[ $RACK_ENV == "development" ]] && exec rerun "$cmd -l 127.0.0.1:$PORT"
exec $cmd