Sha256: 36cf45c83e724e8443f0a38c11ace3ab8b105d74fafae197cd0175fe251d503d

Contents?: true

Size: 1019 Bytes

Versions: 12

Compression:

Stored size: 1019 Bytes

Contents

working_directory "<%= current_path %>"
pid "<%= unicorn_pid %>"
stderr_path "<%= unicorn_std_log %>"
stdout_path "<%= unicorn_err_log %>"

listen "/tmp/socket.<%= application %>_<%= stage %>.sock", :backlog => <%= unicorn_listen_backlog %>
worker_processes <%= unicorn_worker_processes %>
timeout 30

preload_app true

before_fork do |server, worker|
    # Disconnect since the database connection will not carry over
    if defined? ActiveRecord::Base
        ActiveRecord::Base.connection.disconnect!
    end

    # Quit the old unicorn process
    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

after_fork do |server, worker|
    # Start up the database connection again in the worker
    if defined?(ActiveRecord::Base)
        ActiveRecord::Base.establish_connection
    end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
caploy-0.1.2 lib/caploy/templates/unicorn/unicorn.rb.erb
caploy-0.1.1 lib/caploy/templates/unicorn/unicorn.rb.erb
caploy-0.1.0 lib/caploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.6 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.5 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.4 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.3 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.2 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.1 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.3.0 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.2.5 lib/ms_deploy/templates/unicorn/unicorn.rb.erb
ms_deploy-0.2.4 lib/ms_deploy/templates/unicorn/unicorn.rb.erb