From 9ce04fb5dffbe0d719066f1619b9377d4f144ebf Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 15 Apr 2013 23:28:23 -0700 Subject: [PATCH] split out unicorn config into environments --- config/{unicorn.rb => unicorn/production.rb} | 12 ++-------- config/unicorn/staging.rb | 25 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) rename config/{unicorn.rb => unicorn/production.rb} (83%) create mode 100644 config/unicorn/staging.rb diff --git a/config/unicorn.rb b/config/unicorn/production.rb similarity index 83% rename from config/unicorn.rb rename to config/unicorn/production.rb index b45b362ff..9c2d4a1d6 100644 --- a/config/unicorn.rb +++ b/config/unicorn/production.rb @@ -2,22 +2,14 @@ app_path = "/var/www/danbooru2/current" # Set unicorn options -if Socket.gethostname =~ /sonohara|hijiribe/ - worker_processes 12 -else - worker_processes 1 -end +worker_processes 12 preload_app false timeout 180 listen "127.0.0.1:9000" # Spawn unicorn master worker for user apps (group: apps) -if Socket.gethostname =~ /li246/ - user 'danbooru', 'danbooru' -else - user 'albert', 'albert' -end +user 'albert', 'albert' # Fill path to your app working_directory app_path diff --git a/config/unicorn/staging.rb b/config/unicorn/staging.rb new file mode 100644 index 000000000..a1f7a7517 --- /dev/null +++ b/config/unicorn/staging.rb @@ -0,0 +1,25 @@ +# Set your full path to application. +app_path = "/var/www/danbooru2/current" + +# Set unicorn options +worker_processes 2 + +preload_app false +timeout 180 +listen "127.0.0.1:9000" + +# Spawn unicorn master worker for user apps (group: apps) +user 'danbooru', 'danbooru' + +# Fill path to your app +working_directory app_path + +# Should be 'production' by default, otherwise use other env +rails_env = ENV['RAILS_ENV'] || 'production' + +# Log everything to one file +stderr_path "log/unicorn.log" +stdout_path "log/unicorn.log" + +# Set master PID location +pid "#{app_path}/tmp/pids/unicorn.pid"