Sha256: b91704621b5a74976d7d5f0b1a1dac90c5386e373ba8d4187110b31159ff3e1f

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

worker_processes <%= fetch(:unicorn_worker_processes) %>
timeout <%= fetch(:unicorn_timeout) %>
app_path = "<%= fetch(:deploy_to) %>"
listen "<%= fetch(:unicorn_sock_path) %>"
pid "<%= fetch(:unicorn_pid_path) %>"

stderr_path "<%= fetch(:unicorn_stderr_path) %>"
stdout_path "<%= fetch(:unicorn_stdout_path %>"

preload_app true

# use correct Gemfile on restarts
before_exec do |server|
  ENV['BUNDLE_GEMFILE'] = "#{app_path}/current/Gemfile"
end

preload_app true

before_fork do |server, worker|
  # the following is highly recomended for Rails + "preload_app true"
  # as there's no need for the master process to hold a connection
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.connection.disconnect!
  end

  # Before forking, kill the master process that belongs to the .oldbin PID.
  # This enables 0 downtime deploys.
  old_pid = "#{server.config[: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
      # someone else did our job for us
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
capistrano3-unicorn-nginx-0.0.3 lib/generators/capistrano3/unicorn_nginx/templates/unicorn.rb.erb
capistrano-simple-unicorn-1.1.4 lib/generators/capistrano/simple_unicorn/templates/unicorn.rb.erb
capistrano-simple-unicorn-1.1.3 lib/generators/capistrano/simple_unicorn/templates/unicorn.rb.erb
capistrano-simple-unicorn-1.1.2 lib/generators/capistrano/simple_unicorn/templates/unicorn.rb.erb
capistrano-simple-unicorn-1.1.1 lib/generators/capistrano/simple_unicorn/templates/unicorn.rb.erb
capistrano-simple-unicorn-1.1.0 lib/generators/capistrano/simple_unicorn/templates/unicorn.rb.erb