Skip to content

Commit

Permalink
Merge pull request #422 from concord-consortium/add-rollbar
Browse files Browse the repository at this point in the history
Add Rollbar.js config.
  • Loading branch information
scytacki authored Nov 8, 2017
2 parents f92b8c1 + 371ee88 commit 5fdbe78
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ source "http://rubygems.org"
gem "httpclient", "~> 2.2"
gem "httparty"

gem 'rollbar'
gem 'oj', '~> 2.12.14'

gem "capistrano", "~> 2.14.1" # :require => "capistrano"
# gem 'capistrano-autoscaling', "0.0.8.3", :path => "../capistrano-autoscaling/"
gem 'capistrano-autoscaling', "0.0.8.5", :git => "git://github.com/concord-consortium/capistrano-autoscaling", :branch => "concord"
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ GEM
faraday (~> 0.7)
httpauth (~> 0.1)
multi_json (~> 1.3)
oj (2.12.14)
omniauth (1.1.4)
hashie (>= 1.2, < 3)
rack
Expand Down Expand Up @@ -472,6 +473,8 @@ GEM
remarkable_activerecord (3.1.13)
remarkable (~> 3.1.13)
rspec (>= 1.2.0)
rollbar (2.15.5)
multi_json
rsolr (1.1.1)
builder (>= 2.1.2)
rspec (2.11.0)
Expand Down Expand Up @@ -681,6 +684,7 @@ DEPENDENCIES
net-sftp (~> 2.0)
newrelic_rpm (~> 4.4, >= 4.4.0.336)
nokogiri (~> 1.7.0)
oj (~> 2.12.14)
omniauth
omniauth-google-oauth2
omniauth-oauth
Expand All @@ -702,6 +706,7 @@ DEPENDENCIES
react-rails (~> 1.7)
redcarpet (~> 2.1.1)
remarkable_activerecord (~> 3.1.13)
rollbar
rspec (~> 2.11.0)
rspec-rails (~> 2.11.0)
ruby-debug
Expand Down
84 changes: 84 additions & 0 deletions config/initializers/rollbar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
Rollbar.configure do |config|
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.

config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']

#
# Add Rollbar.js config
#
config.js_enabled = true
config.js_options = {
accessToken: ENV['ROLLBAR_CLIENT_ACCESS_TOKEN'],
captureUncaught: true,
payload: {
environment: "production"
}
}

# Here we'll disable in 'test':
#if Rails.env.test?
# config.enabled = false
#end

# Disable rails rollbar. Use only the rollbar.js config.
config.enabled = false

# By default, Rollbar will try to call the `current_user` controller method
# to fetch the logged-in user object, and then call that object's `id`,
# `username`, and `email` methods to fetch those properties. To customize:
# config.person_method = "my_current_user"
# config.person_id_method = "my_id"
# config.person_username_method = "my_username"
# config.person_email_method = "my_email"

# If you want to attach custom data to all exception and message reports,
# provide a lambda like the following. It should return a hash.
# config.custom_data_method = lambda { {:some_key => "some_value" } }

# Add exception class names to the exception_level_filters hash to
# change the level that exception is reported at. Note that if an exception
# has already been reported and logged the level will need to be changed
# via the rollbar interface.
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
# 'ignore' will cause the exception to not be reported at all.
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
#
# You can also specify a callable, which will be called with the exception instance.
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })

# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
# is not installed)
# config.use_async = true
# Supply your own async handler:
# config.async_handler = Proc.new { |payload|
# Thread.new { Rollbar.process_from_async_handler(payload) }
# }

# Enable asynchronous reporting (using sucker_punch)
# config.use_sucker_punch

# Enable delayed reporting (using Sidekiq)
# config.use_sidekiq
# You can supply custom Sidekiq options:
# config.use_sidekiq 'queue' => 'default'

# If your application runs behind a proxy server, you can set proxy parameters here.
# If https_proxy is set in your environment, that will be used. Settings here have precedence.
# The :host key is mandatory and must include the URL scheme (e.g. 'http://'), all other fields
# are optional.
#
# config.proxy = {
# host: 'http://some.proxy.server',
# port: 80,
# user: 'username_if_auth_required',
# password: 'password_if_auth_required'
# }

# If you run your staging application instance in production environment then
# you'll want to override the environment reported by `Rails.env` with an
# environment variable like this: `ROLLBAR_ENV=staging`. This is a recommended
# setup for Heroku. See:
# https://devcenter.heroku.com/articles/deploying-to-a-custom-rails-environment
config.environment = ENV['ROLLBAR_ENV'].presence || Rails.env
end
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ services:
#
CC_PORTAL_VERSION:

#
# Set rollbar access tokens
#
ROLLBAR_ACCESS_TOKEN:
ROLLBAR_CLIENT_ACCESS_TOKEN:

# no ports are published, see below for details
volumes:
- .:/rigse
Expand Down

0 comments on commit 5fdbe78

Please sign in to comment.