Sha256: d32e2e75ee377f62935d23567751631dbaa0c36c80a683f4d470f68de2d5f08c
Contents?: true
Size: 1.72 KB
Versions: 13
Compression:
Stored size: 1.72 KB
Contents
rails_root = "/home/<%= app_name.downcase %>/www/<%= app_name.downcase %>" worker_processes 2 working_directory rails_root # This loads the application in the master process before forking # worker processes # Read more about it here: # http://unicorn.bogomips.org/Unicorn/Configurator.html preload_app true timeout 30 # This is where we specify the socket. # We will point the upstream Nginx module to this socket later on listen "#{rails_root}/tmp/sockets/unicorn.sock", :backlog => 64 pid "#{rails_root}/tmp/pids/unicorn.pid" # Set the path of the log files inside the log folder of the testapp stderr_path "#{rails_root}/log/unicorn.stderr.log" stdout_path "#{rails_root}/log/unicorn.stdout.log" before_fork do |server, worker| server.logger.info("worker=#{worker.nr} spawning in #{Dir.pwd}") # graceful shutdown. old_pid_file = "#{rails_root}/tmp/pids/unicorn.pid.oldbin" if File.exists?(old_pid_file) && server.pid != old_pid_file begin old_pid = File.read(old_pid_file).to_i server.logger.info("sending QUIT to #{old_pid}") # we're killing old unicorn master right there Process.kill("QUIT", old_pid) rescue Errno::ENOENT, Errno::ESRCH # someone else did our job for us end end end ## no need for noSQL # before_fork do |server, worker| # # This option works in together with preload_app true setting # # What is does is prevent the master process from holding # # the database connection # defined?(ActiveRecord::Base) and # ActiveRecord::Base.connection.disconnect! # end # # after_fork do |server, worker| # # Here we are establishing the connection after forking worker # # processes # defined?(ActiveRecord::Base) and # ActiveRecord::Base.establish_connection # end
Version data entries
13 entries across 13 versions & 1 rubygems