diff options
author | danielgrippi <danielgrippi@gmail.com> | 2012-01-25 02:56:55 +0400 |
---|---|---|
committer | danielgrippi <danielgrippi@gmail.com> | 2012-01-25 02:56:55 +0400 |
commit | 52438ffaf2eba04e67c22eee7edfba1e5ac2b081 (patch) | |
tree | fa4fb9f61e7844f48774affa39acc6cdf18426e0 /config | |
parent | 100625d18cf9d33120a109f62400319de13d1b9d (diff) |
add unicorn back in. only use one worker process for now. also, move chrome_frame middleware into the correct load path in lib. [ci skip]
Diffstat (limited to 'config')
-rw-r--r-- | config/unicorn.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 000000000..6cfcc8f6d --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,45 @@ +rails_env = ENV['RAILS_ENV'] || 'development' + +# Enable and set these to run the worker as a different user/group +#user = 'diaspora' +#group = 'diaspora' + +worker_processes 1 + +## Load the app before spawning workers +#preload_app true + +# How long to wait before killing an unresponsive worker +timeout 30 + +#pid '/var/run/diaspora/diaspora.pid' +#listen '/var/run/diaspora/diaspora.sock', :backlog => 2048 + +# Ruby Enterprise Feature +if GC.respond_to?(:copy_on_write_friendly=) + GC.copy_on_write_friendly = true +end + + +before_fork do |server, worker| + # If using preload_app, enable this line + #ActiveRecord::Base.disconnect! + + old_pid = '/var/run/diaspora/diaspora.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 +end + + +after_fork do |server, worker| + # If using preload_app, enable this line + # ActiveRecord::Base.establish_connection + + # Enable this line to have the workers run as different user/group + #worker.user(user, group) +end |