Skip to content

Commit

Permalink
Fix Blazer checks notifications (#710)
Browse files Browse the repository at this point in the history
* Set proper hosts in all environments and enable checks in development

* All blazer checks will be run every 5 minutes

* Wrap Blazer command in a scheduled job
  • Loading branch information
pil0u authored Nov 30, 2024
1 parent 40d5fbc commit 76686fc
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 8 deletions.
9 changes: 9 additions & 0 deletions app/jobs/blazer/run_all_checks_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module Blazer
class RunAllChecksJob < ApplicationJob
def perform
Blazer.run_checks
end
end
end
3 changes: 0 additions & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,5 @@ class Application < Rails::Application

# Disable partial writes when changing default values
config.active_record.partial_inserts = false

# Blazer requires a default URL options to be set
config.action_mailer.default_url_options = { host: "dummy_host" }
end
end
3 changes: 0 additions & 3 deletions config/blazer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ audit: true
slack_webhook_url: <%= ENV["BLAZER_SLACK_WEBHOOK_URL"] %>

check_schedules:
- "1 day"
- "1 hour"
- "5 minutes"
- "10 seconds"

# enable anomaly detection
# note: with trend, time series are sent to https://trendapi.org
Expand Down
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/A2WQYCHoUBaHaAaCVxv8cwlFtjiQG4dqudUD+fhdwK4nSVrjIbAG4XFgP2Exu3n4oZ4354BawF2NGs0YFbAF5QiDAt68BdCkbFio0JfxmiN0BkbzZiFON3tVjR7gm8Ql1BcIb062FIVawsGxUReIrMTSmPCYGx/2gqtkF0AIR3iTddEQNwwRbqonoeFxo3BZFBO2BoINMU5B+17S67822llQ0d20kbp7KXdO0hyRbNVUA/qMEwh+Zx2PoO14aotgNJozcSplFPRwZs6btpgX8YIVLBhbCGy/IqlIe8JH58yN9cnEhv1wZ4o39lo8XdMAidXTFB+11Z4Pcs3RWOz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j4oIHoE5VIsljA5++tIxxqoagd2PAthesCyN/U3fxmNYpQevpnYrT8E8AaGr0H0w9M8VZB0CEoFdMDba5wiQL5FuIOYmQUXbk4x5aZfQLFgT/kPEvqfGSgj9zfeIH6+a0wDbMgvMASzCJ/s3ZGAkh3T8hPSGZyCq6lbibq6VKN+csbrjORRY9Ri54D0jswsienvQlINqoYTQgIkm0HthCkpqIRO5tZqsDDUVB/Emo0nlfQ2jksi360+ZhuRSzlBsYg6sgCSwp+/E4OUbB7h5W40cAA6xiFkFD8kVUhYG9pRxHFSPv8IoeR2DeMY6246sm4S--8RhFlA+1NKBmXppM--9lutNkVPjH//qHrW0OtBJg==
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

# Blazer requires a default URL options to be set
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
end
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,7 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

# Blazer requires a default URL options to be set
config.action_mailer.default_url_options = { host: "aoc.lewagon.community" }
end
3 changes: 2 additions & 1 deletion config/initializers/blazer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
if Rails.env.production?
ENV["BLAZER_USERNAME"] = Rails.application.credentials.dig(:blazer, :username)
ENV["BLAZER_PASSWORD"] = Rails.application.credentials.dig(:blazer, :password)
ENV["BLAZER_SLACK_WEBHOOK_URL"] = Rails.application.credentials.dig(:blazer, :slack_webhook_url)
end

ENV["BLAZER_SLACK_WEBHOOK_URL"] = Rails.application.credentials.dig(:blazer, :slack_webhook_url)
5 changes: 5 additions & 0 deletions config/initializers/good_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
update_puzzles_difficulty: {
cron: "*/5 0-2 1-25 12 * America/New_York",
class: "UpdatePuzzlesDifficultyJob"
},
# every 5 minutes
blazer_run_all_checks: {
cron: "*/5 * * * *",
class: "Blazer::RunAllChecksJob"
}
}
}
Expand Down

0 comments on commit 76686fc

Please sign in to comment.