Sha256: fb6483bde4b06963b1cf17e7547ee494023e016ab26f75aefa617ea168c7d4b8
Contents?: true
Size: 1.61 KB
Versions: 6
Compression:
Stored size: 1.61 KB
Contents
working_directory "<%= current_path %>" pid "<%= unicorn_pid %>" stderr_path "<%= unicorn_std_log %>" stdout_path "<%= unicorn_err_log %>" listen "/tmp/socket.<%= application %>_<%= stage %>.sock", :backlog => <%= unicorn_listen_backlog %> worker_processes <%= unicorn_worker_count %> timeout <%= unicorn_timeout %> preload_app true before_fork do |server, worker| # Disconnect since the database connection will not carry over if defined? ActiveRecord::Base ActiveRecord::Base.connection.disconnect! end # 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 File.exists?(old_pid) && 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| # Start up the database connection again in the worker if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end if defined?(Sidekiq) Sidekiq.configure_client do |config| <% if sidekiq_redis_url %> config.redis = { :url => '<%= sidekiq_redis_url %>', :size => <%= sidekiq_redis_count %> } <% else %> config.redis = { :size => <%= sidekiq_redis_count %> } <% end %> end end end
Version data entries
6 entries across 6 versions & 1 rubygems