Sha256: 2f7f0c0fd0ddefc1084c0f4fc0d84a06cc5b68b3d69d5034f3978735045e315e

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

worker_processes <%= node[:railsapp][:worker_processes] %>

timeout <%= node[:railsapp][:request_timeout] %>

user '<%= node[:railsapp][:worker_user] %>',
     '<%= node[:railsapp][:worker_group] %>'

listen "<%= node[:shared_path] %>/sockets/unicorn.sock"
pid "<%= node[:shared_path] %>/pids/unicorn.pid"

working_directory File.readlink("<%= node[:current_path] %>")

stderr_path "<%= node[:shared_path] %>/log/unicorn.log"
stdout_path "<%= node[:shared_path] %>/log/unicorn.log"

preload_app true
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)

before_exec do |server|
    ENV['BUNDLE_GEMFILE'] = '<%= node[:current_path] %>/Gemfile'
end

before_fork do |server, worker|
  old_pid = "#{server.config[: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
  # Application-specific
  <%= node[:railsapp][:before_fork] %>
end

after_fork do |server, worker|
  child_pid = server.config[:pid].sub('.pid', ".#{worker.nr}.pid")
  system("echo #{Process.pid} > #{child_pid}")
  # Application-specific
  <%= node[:railsapp][:after_fork] %>
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mana-0.0.10 cookbooks/railsapp/templates/default/unicorn.rb.erb
mana-0.0.8 cookbooks/railsapp/templates/default/unicorn.rb.erb
mana-0.0.7 cookbooks/railsapp/templates/default/unicorn.rb.erb
mana-0.0.6 cookbooks/railsapp/templates/default/unicorn.rb.erb
mana-0.0.5 cookbooks/railsapp/templates/default/unicorn.rb.erb
mana-0.0.4 cookbooks/railsapp/templates/default/unicorn.rb.erb