Sha256: f2d5360bf03df85efa22cc6fc06aa03a6ea0fffb6a423dc29f78ba23511430f0

Contents?: true

Size: 1.02 KB

Versions: 30

Compression:

Stored size: 1.02 KB

Contents

# Load ENV vars via Figaro
require 'figaro'
Figaro.application = Figaro::Application.new(environment: 'production', path: File.expand_path('../../../config/application.yml', __FILE__))
Figaro.load

app_path = "#{ENV['DEPLOY_DIRECTORY']}/current"
working_directory app_path

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

stderr_path "#{app_path}/log/unicorn.err.log"
stdout_path "#{app_path}/log/unicorn.out.log"

worker_processes 3
timeout 30
preload_app true

listen "#{app_path}/tmp/sockets/unicorn.sock", backlog: 64

before_exec do |_|
  ENV["BUNDLE_GEMFILE"] = File.join(app_path, "Gemfile")
end

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

  old_pid = "#{app_path}/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
    end
  end
end

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

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
inline_forms-6.2.4 lib/generators/templates/unicorn/production.rb
inline_forms-6.2.3 lib/generators/templates/unicorn/production.rb
inline_forms-6.2.2 lib/generators/templates/unicorn/production.rb
inline_forms-6.2.1 lib/generators/templates/unicorn/production.rb
inline_forms-6.1.1 lib/generators/templates/unicorn/production.rb
inline_forms-6.1.0 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.8 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.7 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.6 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.5 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.4 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.3 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.2 lib/generators/templates/unicorn/production.rb
inline_forms-6.0.1 lib/generators/templates/unicorn/production.rb
inline_forms-5.2.8 lib/generators/templates/unicorn/production.rb
inline_forms-5.2.7 lib/generators/templates/unicorn/production.rb
inline_forms-5.2.6 lib/generators/templates/unicorn/production.rb
inline_forms-5.2.5 lib/generators/templates/unicorn/production.rb
inline_forms-5.2.4 lib/generators/templates/unicorn/production.rb
inline_forms-5.2.3 lib/generators/templates/unicorn/production.rb