diff --git a/config.ru b/config.ru index 5aeb3fac7..44460b1c6 100644 --- a/config.ru +++ b/config.ru @@ -1,8 +1,6 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) - -if defined?(Unicorn) && Rails.env.production? +if defined?(Unicorn) && ENV["RAILS_ENV"] == "production" # Unicorn self-process killer require 'unicorn/worker_killer' @@ -10,7 +8,9 @@ if defined?(Unicorn) && Rails.env.production? use Unicorn::WorkerKiller::MaxRequests, 5_000, 10_000 # Max memory size (RSS) per worker - #use Unicorn::WorkerKiller::Oom, (192*(1024**2)), (256*(1024**2)) + use Unicorn::WorkerKiller::Oom, (192*(1024**2)), (256*(1024**2)) end +require ::File.expand_path('../config/environment', __FILE__) + run Rails.application diff --git a/config/environments/production.rb b/config/environments/production.rb index 42f5b1f0c..fe2b55a09 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -48,7 +48,7 @@ Rails.application.configure do # Use the lowest log level to ensure availability of diagnostic information # when problems arise. - config.log_level = :debug + config.log_level = :info # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] diff --git a/config/unicorn/production.rb b/config/unicorn/production.rb index c41a1c5e9..b795ce873 100644 --- a/config/unicorn/production.rb +++ b/config/unicorn/production.rb @@ -1,20 +1,20 @@ # Set your full path to application. -app_path = "/var/www/danbooru/current" +app_path = "/home/e621/e621ng" # Set unicorn options -worker_processes 10 +worker_processes 15 timeout 180 #listen "127.0.0.1:9000", :tcp_nopush => true -listen "/tmp/.unicorn.sock", :backlog => 512 +listen "#{app_path}/tmp/.unicorn.sock", :backlog => 512 # Spawn unicorn master worker for user apps (group: apps) -user 'danbooru', 'danbooru' +user 'e621', 'e621' # Fill path to your app working_directory app_path -# Should be 'production' by default, otherwise use other env +# Should be 'production' by default, otherwise use other env rails_env = ENV['RAILS_ENV'] || 'production' # Log everything to one file