2015-04-08 00:15:02 +08:00
|
|
|
app_path = File.expand_path( File.join(File.dirname(__FILE__), '..', '..'))
|
|
|
|
|
|
|
|
worker_processes 1
|
|
|
|
preload_app true
|
|
|
|
timeout 180
|
|
|
|
listen '/tmp/unicorn_wblog_en.sock'
|
2015-04-08 00:41:49 +08:00
|
|
|
pid "#{app_path}/tmp/pids/unicorn.pid"
|
2015-04-08 00:15:02 +08:00
|
|
|
user 'ruby', 'ruby'
|
|
|
|
stderr_path "log/unicorn.log"
|
|
|
|
stdout_path "log/unicorn.log"
|
|
|
|
|
|
|
|
before_fork do |server, worker|
|
|
|
|
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|
|
|
|
|
end
|
|
|
|
|
|
|
|
before_exec do |server|
|
2015-04-08 01:10:09 +08:00
|
|
|
ENV["BUNDLE_GEMFILE"] = "#{app_path}/Gemfile"
|
2015-04-08 00:15:02 +08:00
|
|
|
end
|