health-monitor-rails 12.3.0 → 12.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 952a62b089d3b56df2b8ab11b329dae2512d285db4027bde6705892e171ff755
4
- data.tar.gz: 36a7996a83a871a82814caef5d31d2cc880b1f40bd12e2f191290e72a9d1537f
3
+ metadata.gz: 16d418a94d55bfea53470ed8a0b1d4b8614c32b2f3a0f439dd37859c99cb62b1
4
+ data.tar.gz: 5f53e4f8bcc43d2a2ae27fa02a14f44c277b2a37388b500b7c9450ca6834197d
5
5
  SHA512:
6
- metadata.gz: a9878debcd730c9848ec50af8ed0b1ed912adffc240c1aab657c82a40e0113ac32a335f53ef32c9c7a3487eee68483235b767009e900c376eb1df55dd28cf2cd
7
- data.tar.gz: d361fd7cf5fe894de0d2bce196b06c23f9c3015d1dfa545ba0158c441e2c4f1caed1d6053975a9ff545082025ec1a1c387644a7aaa4dbede0e020c8869289cac
6
+ metadata.gz: e09ede9673ea8c30618eeffb12b169920705b4f54376e091141008303c060a6071ec627eec576724901f046d3c697e30c0519235a22175ec100ce58286188c97
7
+ data.tar.gz: b0383068465c7ebb1e4beedd46c9f26801fcd2fdae8f0b591be3a4967bb72bb94f13a6a62a3c35290c3385f187ec917cafd3ea5add28386afa2c44bda9a6d6de
data/README.md CHANGED
@@ -177,6 +177,7 @@ The following services are currently supported:
177
177
  * Resque
178
178
  * Delayed Job
179
179
  * Solr
180
+ * FileAbsence
180
181
 
181
182
  ## Configuration
182
183
 
@@ -318,6 +319,12 @@ Please note that `url` or `connection` can't be used at the same time.
318
319
  * `url`: the URL used to connect to your Solr instance - must be a string. You can also use `url` to explicitly configure authentication (e.g., `'https://user:pass@example.solr.com:8983/'`)
319
320
  * `collection`: An optional parameter used to connect to your specific Solr collection - must be a string. By setting this parameter the code will check the status of this individual collection in your Solr instance instead of just the status of the overall Solr instance
320
321
 
322
+ ### FileAbsence
323
+
324
+ This check allows you to create a file on your server when you would like to force the check to fail. For example if you are utilizing the `health.json` as you health check page for your load balancer and would like to force a machine offline.
325
+
326
+ * `filename`: the file relative to the rails root that must remain absent for the health check to remain passing. For example: `public/remove-from-nginx`
327
+
321
328
  ### Adding a Custom Provider
322
329
 
323
330
  It's also possible to add custom health check providers suited for your needs (of course, it's highly appreciated and encouraged if you'd contribute useful providers to the project).
@@ -441,9 +448,11 @@ nicolas@desktop:$ echo $?
441
448
  ```
442
449
 
443
450
  ## Development
451
+
444
452
  In order to work on development on the gem itself
445
453
 
446
454
  ### Installing the gems
455
+
447
456
  Use the [appraisal gem](https://github.com/thoughtbot/appraisal) to install the bundles for different rails versions:
448
457
 
449
458
  ```bash
@@ -453,7 +462,9 @@ appraisal install
453
462
  ```
454
463
 
455
464
  ### Running the tests
465
+
456
466
  Use appraisal to run the tests using rake
467
+
457
468
  ```bash
458
469
  appraisal rake
459
470
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  module HealthMonitor
4
4
  class Configuration
5
- PROVIDERS = %i[cache database delayed_job redis resque sidekiq solr].freeze
5
+ PROVIDERS = %i[cache database delayed_job file_absence redis resque sidekiq solr].freeze
6
6
 
7
7
  attr_accessor :basic_auth_credentials,
8
8
  :environment_variables,
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'health_monitor/providers/base'
4
+
5
+ module HealthMonitor
6
+ module Providers
7
+ class FileAbsenceException < StandardError; end
8
+
9
+ class FileAbsence < Base
10
+ class Configuration < Base::Configuration
11
+ DEFAULT_FILENAME = nil
12
+ attr_accessor :filename
13
+
14
+ def initialize(provider)
15
+ super(provider)
16
+
17
+ @filename = DEFAULT_FILENAME
18
+ end
19
+ end
20
+
21
+ def check!
22
+ return unless File.exist?(configuration.filename)
23
+
24
+ raise FileAbsenceException.new("Unwanted file #{configuration.filename} exists!")
25
+ end
26
+
27
+ private
28
+
29
+ def configuration_class
30
+ ::HealthMonitor::Providers::FileAbsence::Configuration
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HealthMonitor
4
- VERSION = '12.3.0'
4
+ VERSION = '12.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health-monitor-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.3.0
4
+ version: 12.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Beder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-22 00:00:00.000000000 Z
11
+ date: 2024-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -45,6 +45,7 @@ files:
45
45
  - lib/health_monitor/providers/cache.rb
46
46
  - lib/health_monitor/providers/database.rb
47
47
  - lib/health_monitor/providers/delayed_job.rb
48
+ - lib/health_monitor/providers/file_absence.rb
48
49
  - lib/health_monitor/providers/redis.rb
49
50
  - lib/health_monitor/providers/resque.rb
50
51
  - lib/health_monitor/providers/sidekiq.rb