2014-07-06 20:02:15 -06:00
|
|
|
rails_env = ENV['RAILS_ENV'] || 'production'
|
2015-05-03 15:27:08 -07:00
|
|
|
|
|
|
|
dir = 'rails'
|
|
|
|
|
|
|
|
# The rule of thumb is to use 1 worker per processor core available,
|
|
|
|
# however since we'll be hosting many apps on this server,
|
|
|
|
# we need to take a less aggressive approach
|
|
|
|
worker_processes 2
|
|
|
|
|
|
|
|
# We deploy with capistrano, so "current" links to root dir of current release
|
2015-05-03 15:30:29 -07:00
|
|
|
directory = '/home/rails'
|
2015-05-03 15:27:08 -07:00
|
|
|
port = 8080
|
|
|
|
|
|
|
|
if ENV['RAILS_ENV'] == 'preview'
|
|
|
|
directory = '/home/preview'
|
|
|
|
port = 8081
|
|
|
|
end
|
|
|
|
|
|
|
|
working_directory directory
|
|
|
|
|
|
|
|
# Listen on unix socket
|
2015-05-03 15:36:00 -07:00
|
|
|
listen "127.0.0.1:#{port}", :backlog => 64
|
2015-05-03 15:27:08 -07:00
|
|
|
|
|
|
|
pid "/home/unicorn/#{ENV['RAILS_ENV']}.pid"
|
|
|
|
|
2015-05-03 15:30:29 -07:00
|
|
|
stderr_path "#{directory}/log/unicorn.log"
|
|
|
|
stdout_path "#{directory}/log/unicorn.log"
|