app_path            = "<%= current_path %>"

working_directory   "#{app_path}"
pid                 "#{app_path}/tmp/pids/unicorn.pid"
stderr_path         "#{app_path}/log/unicorn.log"
stdout_path         "#{app_path}/log/unicorn.log"

listen              "/tmp/unicorn.sock"
worker_processes    <%= unicorn_workers %>
timeout             60
preload_app         true

before_fork do |server, worker|
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.connection.disconnect!
  end

  sleep 1
end

after_fork do |server, worker|
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.establish_connection
  end
end

app_path            = "<%= current_path %>"

working_directory   "#{app_path}"
pid                 "#{app_path}/tmp/pids/unicorn.pid"

listen              "/tmp/unicorn.sock"
worker_processes    <%= unicorn_workers %>
timeout             60
preload_app         true

before_fork do |server, worker|
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.connection.disconnect!
  end

  sleep 1
end

after_fork do |server, worker|
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.establish_connection
  end
end

Use upstart to log unicorn
Use upstart to log unicorn

- With upstart we get free log rotation through copytruncate of output
  of stderr and stdout
