Sha256: 8edb4b1f66d7356c78d641592a556548b232aba2e23145695283f21ba1a3a287

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

APP_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))

ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'

require 'redis'
worker_processes 2

#user "unprivileged_user", "unprivileged_group"

working_directory APP_ROOT

listen "#{APP_ROOT}/tmp/sockets/unicorn.sock", :backlog => 64
listen 8080, :tcp_nopush => true

timeout 90

pid "#{APP_ROOT}/tmp/pids/unicorn.pid"

stderr_path "#{APP_ROOT}/log/unicorn.stderr.log"
stdout_path "#{APP_ROOT}/log/unicorn.stdout.log"

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

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

  sleep 1
end

after_fork do |server, worker|
  # per-process listener ports for debugging/admin/migrations
  # addr = "127.0.0.1:#{9293 + worker.nr}"
  # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)

  defined?(ActiveRecord::Base) and
      ActiveRecord::Base.establish_connection

  $redis = Redis.connect
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 lib/generators/ab_admin/install/templates/config/unicorn_config.rb
ab_admin-0.2.2 lib/generators/ab_admin/install/templates/config/unicorn_config.rb
ab_admin-0.2.1 lib/generators/ab_admin/install/templates/config/unicorn_config.rb
ab_admin-0.2.0 lib/generators/ab_admin/install/templates/config/unicorn_config.rb
ab_admin-0.1.2 lib/generators/ab_admin/install/templates/config/unicorn_config.rb
ab_admin-0.1.1 lib/generators/ab_admin/install/templates/config/unicorn_config.rb
ab_admin-0.1.0 lib/generators/ab_admin/install/templates/config/unicorn_config.rb