Created
February 1, 2012 18:16
-
-
Save jhbabon/1718428 to your computer and use it in GitHub Desktop.
Basic unicorn configuration for Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# config/server/unicorn.rb | |
require 'fileutils' | |
# required data | |
env = ENV['RACK_ENV'] | |
app_dir = File.expand_path('../../..', __FILE__) | |
app_key = 'app' | |
pids_file = "unicorn.pid" | |
pids_dir = "#{app_dir}/tmp/pids" | |
::FileUtils.mkdir_p "#{pids_dir}" | |
log_file = "unicorn_#{env}.log" | |
log_dir = "#{app_dir}/log" | |
::FileUtils.mkdir_p "#{log_dir}" | |
# unicorn configuration | |
working_directory app_dir | |
pid "#{pids_dir}/#{pids_file}" | |
stderr_path "#{log_dir}/#{log_file}" | |
stdout_path "#{log_dir}/#{log_file}" | |
if env == 'production' | |
listen "/tmp/unicorn.#{app_key}.sock" | |
worker_processes 2 | |
timeout 30 | |
else | |
listen '127.0.0.1:3000' | |
worker_processes 1 | |
timeout 240 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment