Created
May 16, 2014 14:50
-
-
Save braidn/4dc6f384d8357d85fe7d to your computer and use it in GitHub Desktop.
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 Integer(ENV["WEB_CONCURRENCY"] || 7) | |
working_directory "#{ENV['STACK_PATH']}" | |
listen "/tmp/web_server.sock", :backlog => 64 | |
timeout 30 | |
pid '/tmp/web_server.pid' | |
stderr_path "#{ENV['STACK_PATH']}/log/unicorn.stderr.log" | |
stdout_path "#{ENV['STACK_PATH']}/log/unicorn.stdout.log" | |
preload_app true | |
GC.respond_to?(:copy_on_write_friendly=) and | |
GC.copy_on_write_friendly = true | |
check_client_connection false | |
before_fork do |server, worker| | |
old_pid = '/tmp/web_server.pid.oldbin' | |
if File.exists?(old_pid) && server.pid != old_pid | |
begin | |
Process.kill("QUIT", File.read(old_pid).to_i) | |
rescue Errno::ENOENT, Errno::ESRCH | |
# someone else did our job for us | |
end | |
end | |
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