Sha256: 50b427c33b158426b4138ebcdd7f7ecadf653c2bc1152f493542b4c39d53c3f5
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
# heavily inspired by gitlab: # https://github.com/gitlabhq/gitlabhq/blob/master/config/unicorn.rb.example worker_processes ENV['WORKERS'].to_i if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test' listen '0.0.0.0:3000' else listen "unix:#{ENV['RUN_STATE_PATH']}/#{ENV['SERVICE']}/#{ENV['SERVICE']}", backlog: 64 end pid "#{ENV['RUN_STATE_PATH']}/#{ENV['SERVICE']}/#{ENV['SERVICE']}.pid" timeout 30 stdout_path "#{ENV['LOG_PATH']}/#{ENV['SERVICE']}/#{ENV['SERVICE']}.access.log" stderr_path "#{ENV['LOG_PATH']}/#{ENV['SERVICE']}/#{ENV['SERVICE']}.error.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| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! # The following is only recommended for memory/DB-constrained # installations. It is not needed if your system can house # twice as many worker_processes as you have configured. # # This allows a new master process to incrementally # phase out the old master process with SIGTTOU to avoid a # thundering herd (especially in the "preload_app false" case) # when doing a transparent upgrade. The last worker spawned # will then kill off the old master process with a SIGQUIT. old_pid = "#{server.config[:pid]}.oldbin" if old_pid != server.pid begin sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU Process.kill(sig, File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH end end end after_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
orats-0.9.1 | lib/orats/templates/includes/new/rails/config/unicorn.rb |