Created
August 28, 2012 17:49
-
-
Save kyv/3501351 to your computer and use it in GitHub Desktop.
unicorn.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 4 | |
user "http", "http" | |
working_directory "/etc/unicorn" # available in 0.94.0+ | |
listen "/tmp/.sock", :backlog => 64 | |
timeout 30 | |
pid "/var/run/unicorn/unicorn.pid" | |
stderr_path "/var/log/unicorn/error.log" | |
stdout_path "/var/log/unicorn/out.log" | |
preload_app true | |
GC.respond_to?(:copy_on_write_friendly=) and | |
GC.copy_on_write_friendly = true | |
before_fork do |server, worker| | |
defined?(ActiveRecord::Base) and | |
ActiveRecord::Base.connection.disconnect! | |
end | |
after_fork do |server, worker| | |
defined?(ActiveRecord::Base) and | |
ActiveRecord::Base.establish_connection | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment