diff --git a/Gemfile b/Gemfile index 9d4c5bf1..d74ba069 100644 --- a/Gemfile +++ b/Gemfile @@ -15,11 +15,6 @@ gem 'rails', '~> 5.0.7' # Use Puma as the app server gem 'puma', '~> 3.0' -# enables serving assets in production and setting your logger to standard out -# both of which are required to run an application on a twelve-factor provider -# like heroku.com -gem 'rails_12factor', group: :production - # respond_to methods have been extracted to the responders gem # http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#responders gem 'responders', '~> 2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 73acb733..83540325 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -426,11 +426,6 @@ GEM rails-i18n (5.0.4) i18n (~> 0.7) railties (~> 5.0) - rails_12factor (0.0.3) - rails_serve_static_assets - rails_stdout_logging - rails_serve_static_assets (0.0.4) - rails_stdout_logging (0.0.3) railties (5.0.7.1) actionpack (= 5.0.7.1) activesupport (= 5.0.7.1) @@ -693,7 +688,6 @@ DEPENDENCIES rails-assets-waypoints! rails-controller-testing rails-i18n (~> 5.0.0) - rails_12factor rdoc-generator-fivefish recaptcha redcarpet diff --git a/config/environments/production.rb b/config/environments/production.rb index 7291c6fa..13c2e71e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -43,10 +43,17 @@ Osem::Application.configure do config.log_level = ENV['OSEM_LOG_LEVEL'].try(:to_sym) || :info # Prepend all log lines with the following tags - # config.log_tags = [ :subdomain, :uuid ] + config.log_tags = [:uuid] - # Use a different logger for distributed setups - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end # Use a different cache store in production # config.cache_store = :mem_cache_store