GRN-73: Added settings for externalizing logs (#441)

* Added settoings for externalizing logs

* Fix for passing rubocop

* Attempt to fix jenkins fail

* Final Jenkins fix
This commit is contained in:
Jesus Federico 2019-04-08 16:06:14 -04:00 committed by GitHub
parent 154bb883b6
commit 57aa72ecee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 6 deletions

View File

@ -91,7 +91,6 @@ group :test do
gem 'faker'
gem "factory_bot_rails"
gem 'webmock'
# Ruby linting.
gem 'rubocop'
end
@ -100,12 +99,13 @@ group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
gem 'remote_syslog_logger'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

View File

@ -221,6 +221,8 @@ GEM
ffi (>= 0.5.0, < 2)
redcarpet (3.4.0)
redis (3.3.5)
remote_syslog_logger (1.0.4)
syslog_protocol
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
@ -293,6 +295,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
syslog_protocol (0.9.2)
tabler-rubygem (0.1.2)
autoprefixer-rails (>= 6.0.3)
term-ansicolor (1.6.0)
@ -359,6 +362,7 @@ DEPENDENCIES
random_password
redcarpet
redis (~> 3.0)
remote_syslog_logger
rspec-rails (~> 3.7)
rubocop
sass-rails (~> 5.0)

View File

@ -99,9 +99,14 @@ Rails.application.configure do
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"] == "true"
logger = ActiveSupport::Logger.new(STDOUT)
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
elsif ENV["RAILS_LOG_REMOTE_NAME"] && ENV["RAILS_LOG_REMOTE_PORT"]
require 'remote_syslog_logger'
logger_program = ENV["RAILS_LOG_REMOTE_TAG"] || "greenlight-#{ENV['RAILS_ENV']}"
config.logger = RemoteSyslogLogger.new(ENV["RAILS_LOG_REMOTE_NAME"],
ENV["RAILS_LOG_REMOTE_PORT"], program: logger_program)
end
# Do not dump schema after migrations.

View File

@ -159,4 +159,12 @@ PAGINATION_NUMBER=25
# https://docs.docker.com/config/containers/logging/syslog/#options
# https://help.papertrailapp.com/kb/configuration/encrypting-remote-syslog-with-tls-ssl/
#
# For sending logs to a remote aggregator enable these variables:
#
# RAILS_LOG_REMOTE_NAME=logxx.papertrailapp.com
# RAILS_LOG_REMOTE_PORT=9999
# RAILS_LOG_REMOTE_TAG=greenlight
#
# Force SSL
#
# ENABLE_SSL=true

View File

@ -133,7 +133,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @user.id
post :join, params: { room_uid: @room, join_name: @user.name }
expect(response).to redirect_to(@user.main_room.join_path(@user.name, {}, @user.uid))
expect(response).to redirect_to(@owner.main_room.join_path(@user.name, {}, @user.uid))
end
it "should use join name if user is not logged in and meeting running" do
@ -141,7 +141,7 @@ describe RoomsController, type: :controller do
post :join, params: { room_uid: @room, join_name: "Join Name" }
expect(response).to redirect_to(@user.main_room.join_path("Join Name", {}))
expect(response).to redirect_to(@owner.main_room.join_path("Join Name", {}))
end
it "should render wait if meeting isn't running" do
@ -159,7 +159,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @owner.id
post :join, params: { room_uid: @room, join_name: @owner.name }
expect(response).to redirect_to(@user.main_room.join_path(@owner.name, { user_is_moderator: true }, @owner.uid))
expect(response).to redirect_to(@owner.main_room.join_path(@owner.name, { user_is_moderator: true }, @owner.uid))
end
it "redirects to root if owner of room is not verified" do