Sha256: 4480cd83b329c0807f5fc8234749dec0caf4a77522095021eafe1d29b067e34f

Contents?: true

Size: 1.72 KB

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
enjoy_cms-0.4.1 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0.5 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0.4 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0.3 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0.2 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0.1 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0 lib/generators/enjoy/cms/templates/unicorn.erb
enjoy_cms-0.4.0.beta3 lib/generators/enjoy/cms/templates/unicorn.erb