health_check_rb 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/linters.yml +27 -0
- data/.github/workflows/tests.yml +50 -0
- data/.gitignore +33 -0
- data/.rspec +1 -0
- data/.rubocop.yml +110 -0
- data/CHANGELOG +122 -0
- data/Gemfile +23 -0
- data/MIT-LICENSE +23 -0
- data/README.md +392 -0
- data/Rakefile +27 -0
- data/config/routes.rb +7 -0
- data/health_check_rb.gemspec +26 -0
- data/init.rb +3 -0
- data/lib/health_check_rb/base_health_check.rb +7 -0
- data/lib/health_check_rb/check/elasticsearch.rb +18 -0
- data/lib/health_check_rb/check/rabbitmq.rb +19 -0
- data/lib/health_check_rb/check/redis.rb +30 -0
- data/lib/health_check_rb/check/resque.rb +18 -0
- data/lib/health_check_rb/check/s3.rb +62 -0
- data/lib/health_check_rb/check/sidekiq.rb +20 -0
- data/lib/health_check_rb/health_check_controller.rb +80 -0
- data/lib/health_check_rb/health_check_routes.rb +18 -0
- data/lib/health_check_rb/middleware_health_check.rb +108 -0
- data/lib/health_check_rb/utils.rb +194 -0
- data/lib/health_check_rb/version.rb +5 -0
- data/lib/health_check_rb.rb +129 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/assets/config/manifest.js +1 -0
- data/spec/dummy/app/controllers/example_controller.rb +7 -0
- data/spec/dummy/config/database.yml +10 -0
- data/spec/dummy/config/initializers/health_check.rb +18 -0
- data/spec/dummy/config/initializers/middleware.rb +3 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/db/migrate/.keep +0 -0
- data/spec/dummy/fake_app.rb +18 -0
- data/spec/dummy/tmp/.keep +0 -0
- data/spec/fixtures/migrate/9_create_countries.rb +9 -0
- data/spec/health_check_rb_spec.rb +300 -0
- data/spec/spec_helper.rb +36 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 14630b876905fff84a2437a751baf3373d8086dc0a21fdce0489830bdcfe3b92
|
4
|
+
data.tar.gz: c61410bfd2c72da1f93e0574b20d61d2f0fa1a7efd1dd16731bd2d4575bccaa4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 750d39625f291cc6ceee874c76112a18143251dc8caa65770ab382188719fdd85123dea198abea62f27931c2e34aa26a8413bdc0b0ec86865f0cb0e623c53f64
|
7
|
+
data.tar.gz: 9f0f2be45d14264b56f1ee3c2e5943837b8616ee711728c85dee28819381a8ea5620e9c4dbdacff0ae776b56f64f512a49a89a2c15175ce26cc9fc02e9a60827
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Run Linters
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
env:
|
11
|
+
RAILS_ENV: test
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v4
|
15
|
+
|
16
|
+
- name: Setup Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 3.2
|
20
|
+
|
21
|
+
- name: Setup gems
|
22
|
+
run: |
|
23
|
+
bundle install --jobs 4 --retry 3
|
24
|
+
|
25
|
+
- name: Run RuboCop
|
26
|
+
run: |
|
27
|
+
bundle exec rubocop -S
|
@@ -0,0 +1,50 @@
|
|
1
|
+
name: Tests
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
pull_request:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-20.04
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby: ['3.1', '3.2', '3.3', '3.4']
|
13
|
+
rails: ['7.2', '8.0', 'edge']
|
14
|
+
middleware: ['false', 'true']
|
15
|
+
exclude:
|
16
|
+
- ruby: '3.1'
|
17
|
+
rails: '8.0'
|
18
|
+
- ruby: '3.1'
|
19
|
+
rails: 'edge'
|
20
|
+
fail-fast: false
|
21
|
+
|
22
|
+
env:
|
23
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
24
|
+
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v4
|
27
|
+
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
bundler-cache: true
|
33
|
+
|
34
|
+
- name: Test rails
|
35
|
+
run: |
|
36
|
+
bundle exec rails -v
|
37
|
+
|
38
|
+
- name: Setup smtp_mock for ruby
|
39
|
+
run: |
|
40
|
+
bundle exec smtp_mock -i ~
|
41
|
+
|
42
|
+
- name: Test smtp_mock for ruby
|
43
|
+
run: |
|
44
|
+
bundle exec smtp_mock --version
|
45
|
+
|
46
|
+
- name: Run tests
|
47
|
+
env:
|
48
|
+
MIDDLEWARE: ${{ matrix.middleware }}
|
49
|
+
RAILS_ENV: test
|
50
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Suggested by bundler
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
spec/dummy/db/*.sqlite3*
|
17
|
+
spec/dummy/log/*
|
18
|
+
.ruby-version
|
19
|
+
|
20
|
+
## PROJECT::SPECIFIC
|
21
|
+
bin/
|
22
|
+
railsapps/
|
23
|
+
gemfiles/*.gemfile.lock
|
24
|
+
,*
|
25
|
+
.vagrant
|
26
|
+
ubuntu*console.log
|
27
|
+
tmp
|
28
|
+
# See: https://gist.github.com/ianheggie/9327010
|
29
|
+
# for Global git ignore for OS/IDE/temp/backup files
|
30
|
+
|
31
|
+
spec/dummy/tmp/*
|
32
|
+
!spec/dummy/tmp/.keep
|
33
|
+
spec/dummy/db/*.sqlite3
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rails
|
4
|
+
- rubocop-rspec
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: 3.1
|
8
|
+
TargetRailsVersion: 7.2
|
9
|
+
NewCops: enable
|
10
|
+
ActiveSupportExtensionsEnabled: true
|
11
|
+
Include:
|
12
|
+
- '**/*.rake'
|
13
|
+
- '**/*.rb'
|
14
|
+
- '**/Rakefile'
|
15
|
+
- '**/Gemfile'
|
16
|
+
- '**/*.gemfile'
|
17
|
+
Exclude:
|
18
|
+
- 'spec/dummy/**/*'
|
19
|
+
- 'vendor/**/*'
|
20
|
+
|
21
|
+
Rails:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Rails/ApplicationController:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
RSpec/DescribedClass:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
RSpec/MultipleExpectations:
|
31
|
+
Max: 10
|
32
|
+
|
33
|
+
Lint/NonAtomicFileOperation:
|
34
|
+
Enabled: true
|
35
|
+
Exclude:
|
36
|
+
- 'spec/spec_helper.rb'
|
37
|
+
- 'spec/*_spec.rb'
|
38
|
+
|
39
|
+
RSpec/ExampleLength:
|
40
|
+
Max: 10
|
41
|
+
|
42
|
+
Metrics/AbcSize:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Metrics/BlockLength:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Metrics/ParameterLists:
|
49
|
+
Enabled: true
|
50
|
+
CountKeywordArgs: false
|
51
|
+
|
52
|
+
Metrics/ClassLength:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Metrics/CyclomaticComplexity:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Style/HashConversion:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Layout/LineLength:
|
62
|
+
Max: 140
|
63
|
+
|
64
|
+
Metrics/MethodLength:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Metrics/ModuleLength:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Metrics/PerceivedComplexity:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
Lint/AmbiguousOperatorPrecedence:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Rails/CreateTableWithTimestamps:
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
Rails/HelperInstanceVariable:
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
Rails/SkipsModelValidations:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Performance/ChainArrayAllocation:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
Style/AutoResourceCleanup:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Style/ExpandPathArguments:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
Style/ReturnNil:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
Style/UnlessLogicalOperators:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
Style/MethodCallWithArgsParentheses:
|
101
|
+
Enabled: true
|
102
|
+
AllowParenthesesInMultilineCall: true
|
103
|
+
AllowParenthesesInChaining: true
|
104
|
+
EnforcedStyle: omit_parentheses
|
105
|
+
|
106
|
+
Style/SuperWithArgsParentheses:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
Style/Documentation:
|
110
|
+
Enabled: false
|
data/CHANGELOG
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
= Change Log =
|
2
|
+
|
3
|
+
* 4.0.0 - main
|
4
|
+
* Support Rails 7.2 and 8.0 (support for older versions have been dropped)
|
5
|
+
* Support Ruby 3.1, 3.2, 3.3 and 3.4 (support for older versions have been dropped)
|
6
|
+
* GitHub tests have been added
|
7
|
+
* Rubocop linter has been added
|
8
|
+
* renamed to health_check_rb for own gem namespace
|
9
|
+
|
10
|
+
* 3.1.0 - 26 May 2021
|
11
|
+
* Updated README to clarify railsN branch status (they are intended to be stable, development to be a feature branch off them or master)
|
12
|
+
* Updated README with all the settings
|
13
|
+
* Updated all the branches to work with the latest travis and gem changes, as some gems needed to be locked down.
|
14
|
+
* Updated to test rails 6.0 and 6.1
|
15
|
+
* Got all travis tests passing
|
16
|
+
* Removed old, unused branches
|
17
|
+
* Merged PR Fix broken Cache-Control headers #93 from felixbuenemann
|
18
|
+
* Merged PR S3 should not depend on Rails secrets file #77 by natefaerber
|
19
|
+
* Merged PR RabbitMQ Health check #98 from rhuanbarreto
|
20
|
+
* Merged PR Use remote_ip to accept proxy-forwarded requests #102 by alessio-signorini but made it optional
|
21
|
+
* Fixed up failure setting to match previous output on error, and use it as a prefix when the error message is also output (not by default)
|
22
|
+
* Always log the error to rails log even if not including in html response
|
23
|
+
* Merged PR ensure REDIS connections are closed #88 from yld
|
24
|
+
* Merged PR more robust cache check #90 from masciugo
|
25
|
+
* Merged PR Add log_level config setting which defaults to 'info'. #97 from FloHeinle
|
26
|
+
* Merged PR get rid of old school hash rockets syntax #92 from DmytroStepaniuk
|
27
|
+
* Merged PR Converted whitelist testing to use IPAddr objects. #64 jordanyaker
|
28
|
+
* Added on_success and on_failure callbacks
|
29
|
+
* Makes sure errors are separated by a period and a space and a period always ends the list of errors
|
30
|
+
|
31
|
+
* 3.0.0
|
32
|
+
* First release on rails5 branch
|
33
|
+
* Depends on railties rather than rails so it can be used with trimmed down stacks
|
34
|
+
* Corrected ruby version required to match rails
|
35
|
+
* Cleaned up README
|
36
|
+
* redis_url now defaults to nil (url determined by redis gem)
|
37
|
+
* Cleaned out rails 4.0 dependent code
|
38
|
+
* Cleaned up test code and updated to rails 5 standards, uses smarter_bundler to handle gem ruby version issues
|
39
|
+
* Added rails 5.1 test
|
40
|
+
* Split all releases to this rails* branches - master is only for edge development
|
41
|
+
|
42
|
+
* 2.7.0
|
43
|
+
* Add ability to check health of redis when url is non-standard redis url
|
44
|
+
|
45
|
+
* 2.6.0
|
46
|
+
* Add named custom checks
|
47
|
+
|
48
|
+
* 2.5.0
|
49
|
+
* Added whitelist for IP# (Thanks Fernando Alvarez)
|
50
|
+
* reworked whitelist PR
|
51
|
+
* Expanded tests for whitelist and basic authentication
|
52
|
+
* reworked middleware, simplified error codes, added whitelist and basic authentication into middleware
|
53
|
+
* Removed unit tests as they where aonly applicable under rails 2.3 when installed in vendor/plugins
|
54
|
+
* #55 by mnoack - correct binstubs arg in test
|
55
|
+
* #54 by gkop - Lograge config snippet works with Rails 4.2.7.1, lograge 0.4.1
|
56
|
+
* Used ideas from #52 - use middleware to catch Rails stack exceptions
|
57
|
+
* #51 by tokenshift - Fixing NameError on `basic_auth_username`.
|
58
|
+
* Changes to address #50 by fillphafftek - allow standard check to be run from middleware if configured to do so, removed requirement for "middleware" to be passed in url for middleware tests
|
59
|
+
|
60
|
+
* 2.4.0
|
61
|
+
* Added tests for middleware
|
62
|
+
* Changed contributed middleware code to conform to existing url scheme
|
63
|
+
* Allow both GET and POST calls
|
64
|
+
* Prefer config.uri for changing route prefix
|
65
|
+
|
66
|
+
* 2.3.0
|
67
|
+
* Fix route reload issue
|
68
|
+
* Various fixes to get tests working with bundle/jruby and other gem issues
|
69
|
+
* Document additional branches
|
70
|
+
* Fix route reload issue (auto routing previously conflicted with devise)
|
71
|
+
* Removed ref to rails 2.3, 3.*
|
72
|
+
|
73
|
+
* 2.2.1
|
74
|
+
* Adjust private/public cache-control based on max_age set
|
75
|
+
|
76
|
+
* 2.2.0
|
77
|
+
* Add max_age so we can control the caching of responses, don't run tests if Last-modified still matches
|
78
|
+
* Added basic auth - Thanks omadahealth
|
79
|
+
* A few macinations due to gem changes and avoidning triggering deprecation notices
|
80
|
+
* Add single quote to README to make the configuration file valid - Thanks Ryan Selk <ryanselk@gmail.com>
|
81
|
+
* Fixed README formatting
|
82
|
+
* 2.1.0
|
83
|
+
* Updated contributed tests so there is both the forced check and a *-if-present check which tests if the gem's class is loaded
|
84
|
+
* Added resque-redis check - Thanks filiphaftek <filip.haftek@airhelp.com>
|
85
|
+
* In addition to adding a test file to S3, we will also try to delete it to confirm that delete operations are possible - Thanks Anton Dimitrov <dimitrov.anton@gmail.com>
|
86
|
+
* Added redis, sidekiq-redis and s3 health-checks - Thanks Filip <filip.haftek@airhelp.com>
|
87
|
+
* Fix render options - Thanks Yuji Hanamura <yuji.developer@gmail.com>
|
88
|
+
* Fix to always return a 200 status code on success rather than 304 (adds Last-Modified) - Thanks macgregordennis <macgregordennis@gmail.com>
|
89
|
+
* Added Rails 5.0 tests
|
90
|
+
|
91
|
+
* 2.0.0 - Removed silence - recommend to use a log filtering gem instead
|
92
|
+
|
93
|
+
* 1.4.1 - Rails 4 and route changes
|
94
|
+
* Now handles routes being generated multiple times by some gem / rails / ruby combinations - Previously multiple calls to health_check_routes where ignored, now explicit calls to health_check_route always adds the route but flags that it doesn't have to be added again on the end of the list
|
95
|
+
* Uses ActiveRecord::Migration.check_pending! if available and returns the message if an exception is raised (Rails 4.0+)
|
96
|
+
* Simplified routing rules down to one rule for Rails 3.0+
|
97
|
+
* Includes some changes for rails 4.1 (edge) - but still a work in progress
|
98
|
+
|
99
|
+
* 1.3.1 - Include changes from contributors:
|
100
|
+
* Migrations with dots are now handled
|
101
|
+
* the list of checks for "full" / "all" can be configured
|
102
|
+
|
103
|
+
* 1.2.0
|
104
|
+
* The gem can now be configured, including timeouts, status codes and text returned on success
|
105
|
+
* Custom checks can be added via initializer like config.add_custom_check { CustomCheckClass.a_custom_check }
|
106
|
+
* You can now request the response to be json or xml (via url or Content-accepted header)
|
107
|
+
* reduced tests to the versions of ruby recommended for the different versions of rails
|
108
|
+
|
109
|
+
* 1.1.2
|
110
|
+
* Change to bundler support for building gems, as jeweler gem was broken by v2.0.0 of rubygems
|
111
|
+
|
112
|
+
* 1.1.0
|
113
|
+
* Include cache check (Thanks to <https://github.com/mgomes1>) and some changes to test setup to workaround and diagnose test failures under rvm
|
114
|
+
|
115
|
+
* 1.0.2
|
116
|
+
* Included travis config and gemfiles used in travis tests in gem and changes to test setup so that gem test
|
117
|
+
|
118
|
+
* 1.x
|
119
|
+
* Includes Rails 3.x suppprt as an Engine
|
120
|
+
|
121
|
+
* 0.x
|
122
|
+
* Rails 2.3
|
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
8
|
+
gem 'rails', git: 'https://github.com/rails/rails.git'
|
9
|
+
else
|
10
|
+
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '7.2'}.0"
|
11
|
+
end
|
12
|
+
|
13
|
+
gem 'rake'
|
14
|
+
gem 'rspec-rails'
|
15
|
+
|
16
|
+
gem 'rubocop', require: false
|
17
|
+
gem 'rubocop-performance', require: false
|
18
|
+
gem 'rubocop-rails', require: false
|
19
|
+
gem 'rubocop-rspec', require: false
|
20
|
+
|
21
|
+
gem 'smtp_mock'
|
22
|
+
|
23
|
+
gem 'sqlite3', '~> 2.1'
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2010-2013 Ian Heggie
|
2
|
+
Copyright (c) 2025 Alexander Meindl
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|