Sha256: 5cb536080a61826e25817c5379617bdd77ce5097c0697f1a3bd81c3df9a0a1ed

Contents?: true

Size: 1.25 KB

Versions: 214

Compression:

Stored size: 1.25 KB

Contents

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

if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
  begin
    #rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
    #rvm_lib_path = File.join(rvm_path, 'lib')
    #$LOAD_PATH.unshift rvm_lib_path
    require 'rvm'
    RVM.use_from_path! APP_ROOT
  rescue LoadError
    raise "RVM ruby lib is currently unavailable."
  end
end

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

worker_processes 4
working_directory APP_ROOT

preload_app true

timeout 30

listen APP_ROOT + "/tmp/sockets/unicorn.sock", :backlog => 64

pid APP_ROOT + "/tmp/pids/unicorn.pid"

stderr_path APP_ROOT + "/log/unicorn.stderr.log"
stdout_path APP_ROOT + "/log/unicorn.stdout.log"

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

  old_pid = Rails.root + '/tmp/pids/unicorn.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
      puts "Old master alerady dead"
    end
  end
end

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

Version data entries

214 entries across 214 versions & 1 rubygems

Version Path
inline_forms-5.0.20 lib/generators/templates/unicorn.rb
inline_forms-5.0.19 lib/generators/templates/unicorn.rb
inline_forms-5.0.18 lib/generators/templates/unicorn.rb
inline_forms-5.0.17 lib/generators/templates/unicorn.rb
inline_forms-5.0.16 lib/generators/templates/unicorn.rb
inline_forms-5.0.15 lib/generators/templates/unicorn.rb
inline_forms-5.0.6 lib/generators/templates/unicorn.rb
inline_forms-5.0.4 lib/generators/templates/unicorn.rb
inline_forms-5.0.0 lib/generators/templates/unicorn.rb
inline_forms-3.2.11 lib/generators/templates/unicorn.rb
inline_forms-3.2.10 lib/generators/templates/unicorn.rb
inline_forms-3.2.9 lib/generators/templates/unicorn.rb
inline_forms-3.2.8 lib/generators/templates/unicorn.rb
inline_forms-3.2.7 lib/generators/templates/unicorn.rb
inline_forms-3.2.6 lib/generators/templates/unicorn.rb
inline_forms-3.2.5 lib/generators/templates/unicorn.rb
inline_forms-3.2.4 lib/generators/templates/unicorn.rb
inline_forms-3.2.3 lib/generators/templates/unicorn.rb
inline_forms-3.2.2 lib/generators/templates/unicorn.rb
inline_forms-3.2.1 lib/generators/templates/unicorn.rb