diff --git a/Capfile b/Capfile index feee1648..350ceaf0 100644 --- a/Capfile +++ b/Capfile @@ -13,6 +13,7 @@ require "rvm1/capistrano3" require "capistrano/bundler" require "capistrano/rails/assets" require "capistrano/rails/migrations" +require "rollbar/capistrano3" # Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } diff --git a/Gemfile.lock b/Gemfile.lock index 4b9170dd..e59fc728 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -346,7 +346,7 @@ GEM minitest (5.8.4) momentjs-rails (2.11.0) railties (>= 3.1) - multi_json (1.11.2) + multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) naught (1.1.0) @@ -463,7 +463,7 @@ GEM remotipart (1.2.1) responders (2.1.1) railties (>= 4.2.0, < 5.1) - rollbar (2.7.1) + rollbar (2.14.1) multi_json rspec-core (3.0.4) rspec-support (~> 3.0.0) @@ -689,4 +689,4 @@ DEPENDENCIES will_paginate-bootstrap BUNDLED WITH - 1.13.7 + 1.14.6 diff --git a/config/deploy.rb b/config/deploy.rb index f239d5d6..74cd246a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -35,5 +35,10 @@ append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/uplo # Ruby version / RVM set :rvm1_ruby_version, '2.3.3@retrospring' +# Rollbar +set :rollbar_token, '35f65946f562414da66d0d48073f5290' # TODO: before publishing this repo (again) remove this token +set :rollbar_env, Proc.new { fetch :stage } +set :rollbar_role, Proc.new { :app } + # Restart the app server after successful deploy after 'deploy:cleanup', 'deploy:restart' diff --git a/config/initializers/rollbar.rb b/config/initializers/rollbar.rb index a148e79e..790a06d5 100644 --- a/config/initializers/rollbar.rb +++ b/config/initializers/rollbar.rb @@ -1,12 +1,11 @@ -require 'rollbar/rails' 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'] - # Here we'll disable in 'test' and 'development': - if Rails.env.test? or Rails.env.development? + config.access_token = APP_CONFIG.dig('rollbar', 'access_token') + + # Here we'll disable in 'test': + if Rails.env.test? config.enabled = false end @@ -41,14 +40,21 @@ Rollbar.configure do |config| # config.use_async = true # Supply your own async handler: # config.async_handler = Proc.new { |payload| - # Thread.new { Rollbar.process_payload_safely(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 + config.use_sidekiq # You can supply custom Sidekiq options: config.use_sidekiq 'queue' => 'rollbar' + + # 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'] || Rails.env end diff --git a/config/justask.yml.example b/config/justask.yml.example index 725b5c16..821464e5 100644 --- a/config/justask.yml.example +++ b/config/justask.yml.example @@ -54,3 +54,6 @@ fog: directory: 'retrospring' # URL host, comment out to use default, GENERALLY you don't want to define this # host: '' + +rollbar: + access_token: 'sdklgfnaldkfg'