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 +4 -4
- data/README.md +11 -0
- data/lib/health_monitor/configuration.rb +1 -1
- data/lib/health_monitor/providers/file_absence.rb +34 -0
- data/lib/health_monitor/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16d418a94d55bfea53470ed8a0b1d4b8614c32b2f3a0f439dd37859c99cb62b1
|
4
|
+
data.tar.gz: 5f53e4f8bcc43d2a2ae27fa02a14f44c277b2a37388b500b7c9450ca6834197d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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-
|
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
|