Skip to content

Commit

Permalink
Update Unicorn config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade Rubick committed Sep 26, 2011
1 parent 1445bc6 commit 3c1edf3
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions config/unicorn.rb
@@ -1,10 +1,34 @@
app_path = "/web_apps/rails_pet_clinic"
app_path = "/web_apps/rails_pet_clinic/"

working_directory app_path
listen "/tmp/rails_pet_clinic.socket", :backlog => 64
user 'www-data', 'www-data'

worker_processes 3
pid "/tmp/unicorn.pid"
stdout_path ="#{app_path}/log/unicorn.stdout.log"
stderr_path ="#{app_path}/log/unicorn.stderr.log"


stderr_path "#{app_path}/log/unicorn.stderr.log"
stdout_path "#{app_path}/log/unicorn.stdout.log"

pid "#{app_path}/pids/unicorn.pid"
stdout_path ="/tmp/unicorn.stdout.log"
stderr_path ="/tmp/unicorn.stderr.log"


preload_app true
timeout 30

before_fork do |server, worker|
# This option works in together with preload_app true setting
# What is does is prevent the master process from holding
# the database connection
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, worker|
# Here we are establishing the connection after forking worker
# processes
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end

0 comments on commit 3c1edf3

Please sign in to comment.