Skip to content

Commit

Permalink
Move to unix socket
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed Oct 23, 2012
1 parent 4f7c5dc commit cb21108
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions unicorn.conf.rb
@@ -1,9 +1,10 @@
app_dir = File.expand_path(File.dirname(__FILE__))
worker_processes 1
working_directory Dir.pwd
listen 8080, :tcp_nopush => true
pid "#{Dir.pwd}/tmp/pids/unicorn.pid"
stderr_path "#{Dir.pwd}/log/unicorn.log"
stdout_path "#{Dir.pwd}/log/unicorn.log"
working_directory app_dir
listen "#{app_dir}/tmp/sock/unicorn.sock", :backlog => 64
pid "#{app_dir}/tmp/pids/unicorn.pid"
stderr_path "#{app_dir}/log/unicorn.log"
stdout_path "#{app_dir}/log/unicorn.log"
preload_app true

before_fork do |server, worker|
Expand All @@ -18,7 +19,7 @@
#
# Using this method we get 0 downtime deploys.

old_pid = "#{Dir.pwd}/tmp/pids/unicorn.pid.oldbin"
old_pid = "#{app_dir}/tmp/pids/unicorn.pid.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
Expand Down

0 comments on commit cb21108

Please sign in to comment.