Sha256: 193a7a56ef0bae587e032c1b88ddd9cc35b3c6c4a50aef8ee3218762ad3af35d

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

worker_processes {{ unicorn_workers }}
working_directory "{{ be_app_path }}"
pid "{{ be_app_path }}/tmp/unicorn/unicorn.pid"
stderr_path "{{ be_app_path }}/log/unicorn.log"
stdout_path "{{ be_app_path }}/log/unicorn.log"

# Please read this and understand the risk you take by enabling preload_app
# http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-preload_app
preload_app false

timeout 30

listen "{{ unicorn_sockfile }}"

before_exec do |server|
  ENV["BUNDLE_GEMFILE"] = "#{Rails.root}/Gemfile"
end

GC.respond_to?(:copy_on_write_friendly=) and
  GC.copy_on_write_friendly = true

check_client_connection false

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

  old_pid = "#{server.config[:pid]}.oldbin"
  if 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

  # Throttle the master from forking too quickly by sleeping.  Due
  # to the implementation of standard Unix signal handlers, this
  # helps (but does not completely) prevent identical, repeated signals
  # from being lost when the receiving process is busy.
  sleep 1
end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
taperole-1.8.2 roles/unicorn_install/templates/unicorn.rb.j2
taperole-1.8.1 roles/unicorn_install/templates/unicorn.rb.j2
taperole-1.8.0 roles/unicorn_install/templates/unicorn.rb.j2
taperole-1.7.1 roles/unicorn_install/templates/unicorn.rb.j2
taperole-1.7.0 roles/unicorn_install/templates/unicorn.rb.j2