server_health_check-rails 0.1.0 → 0.2.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 +4 -4
- data/app/models/server_health_check_rails/health_check.rb +2 -2
- data/lib/server_health_check_rails.rb +1 -1
- data/lib/server_health_check_rails/version.rb +1 -1
- metadata +8 -10
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/README.md +0 -101
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/server_health_check-rails.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc0c6c14b8c48a77261703db77e515b1b8a3a82b
|
4
|
+
data.tar.gz: bb4678c823323e1d175dae4a989bd9179ead511e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b4db2672bf98d49bf54be3425596a746b0881df6c66d9bc59a99e56bfc5669b450f6922b6098cae89245e639d33f6941e68905e85e6f7a5ab59aa1a4ad0186
|
7
|
+
data.tar.gz: a24efba229a18d5578ad4ac95ad773730fff9a1e3bae7b97b111feb6d126c1eaaf66b5d41f29270f225923b55ebc4b75013a98862e9d25c42ae3612cff13f58c
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ServerHealthCheckRails
|
2
2
|
class HealthCheck
|
3
|
-
def initialize(*checks)
|
4
|
-
@check = ServerHealthCheck.new
|
3
|
+
def initialize(*checks, logger: Rails.logger)
|
4
|
+
@check = ServerHealthCheck.new(logger: logger)
|
5
5
|
ServerHealthCheckRails.apply_checks(@check, checks)
|
6
6
|
end
|
7
7
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: server_health_check-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Virata-Stone
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -37,6 +37,9 @@ dependencies:
|
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.0'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.0.1
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,6 +47,9 @@ dependencies:
|
|
44
47
|
- - "~>"
|
45
48
|
- !ruby/object:Gem::Version
|
46
49
|
version: '1.0'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.0.1
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: bundler
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,25 +100,17 @@ executables: []
|
|
94
100
|
extensions: []
|
95
101
|
extra_rdoc_files: []
|
96
102
|
files:
|
97
|
-
- ".gitignore"
|
98
|
-
- ".travis.yml"
|
99
103
|
- CODE_OF_CONDUCT.md
|
100
|
-
- Gemfile
|
101
104
|
- LICENSE.txt
|
102
|
-
- README.md
|
103
|
-
- Rakefile
|
104
105
|
- app/controllers/server_health_check_rails/application_controller.rb
|
105
106
|
- app/controllers/server_health_check_rails/health_controller.rb
|
106
107
|
- app/models/server_health_check_rails/health_check.rb
|
107
|
-
- bin/console
|
108
|
-
- bin/setup
|
109
108
|
- config/routes.rb
|
110
109
|
- lib/server_health_check-rails.rb
|
111
110
|
- lib/server_health_check/rails.rb
|
112
111
|
- lib/server_health_check_rails.rb
|
113
112
|
- lib/server_health_check_rails/engine.rb
|
114
113
|
- lib/server_health_check_rails/version.rb
|
115
|
-
- server_health_check-rails.gemspec
|
116
114
|
homepage: https://github.com/on-site/server_health_check-rails
|
117
115
|
licenses:
|
118
116
|
- MIT
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# server_health_check-rails
|
2
|
-
|
3
|
-
This gem provides a rails engine that automatically hooks in with the
|
4
|
-
[server_health_check gem](https://github.com/on-site/server_health_check). It
|
5
|
-
will add a /health and /health/:id endpoint which will return a JSON string of
|
6
|
-
the results of either all configured health checks, or just the one provided.
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Add this line to your application's Gemfile:
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
gem "server_health_check-rails"
|
14
|
-
```
|
15
|
-
|
16
|
-
And then execute:
|
17
|
-
|
18
|
-
$ bundle
|
19
|
-
|
20
|
-
Then configure your checks with the gem using the built in `server_health_check`
|
21
|
-
checks, or your own custom checks:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
# config/initializers/health_checks.rb
|
25
|
-
ServerHealthCheckRails.check_active_record!
|
26
|
-
ServerHealthCheckRails.check_redis!(host: "someredis.host", port: 1234)
|
27
|
-
ServerHealthCheckRails.check_aws_s3!("aws-bucket-to-check")
|
28
|
-
ServerHealthCheckRails.check_aws_creds!
|
29
|
-
ServerHealthCheckRails.check "custom_check" do
|
30
|
-
# Do some work here, then return true if it succeeded for false if not
|
31
|
-
# (exceptions will be caught by the server_health_check gem and the message
|
32
|
-
# will be reported as the status).
|
33
|
-
true
|
34
|
-
end
|
35
|
-
```
|
36
|
-
|
37
|
-
And mount the engine in your routes file:
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
# config/routes.rb
|
41
|
-
Rails.application.routes.draw do
|
42
|
-
mount ServerHealthCheckRails::Engine, at: "/"
|
43
|
-
# Your routes here
|
44
|
-
end
|
45
|
-
```
|
46
|
-
|
47
|
-
## Usage
|
48
|
-
|
49
|
-
You can now use your health checks in some automated service to monitor your app
|
50
|
-
with your custom checks.
|
51
|
-
|
52
|
-
You may use the endpoint for all checks at `/health`, which might result in
|
53
|
-
something like the following, though without the formatting:
|
54
|
-
|
55
|
-
```json
|
56
|
-
{
|
57
|
-
"status": {
|
58
|
-
"active_record": "OK",
|
59
|
-
"redis": "OK",
|
60
|
-
"aws_s3": "Failed",
|
61
|
-
"aws_creds": "OK",
|
62
|
-
"custom_check": "OK"
|
63
|
-
}
|
64
|
-
}
|
65
|
-
```
|
66
|
-
|
67
|
-
If you want to just check a single check, you can just use that in the url like
|
68
|
-
`/health/custom_check`:
|
69
|
-
|
70
|
-
```json
|
71
|
-
{
|
72
|
-
"status": {
|
73
|
-
"custom_check": "OK"
|
74
|
-
}
|
75
|
-
}
|
76
|
-
```
|
77
|
-
|
78
|
-
## Development
|
79
|
-
|
80
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
81
|
-
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
82
|
-
prompt that will allow you to experiment.
|
83
|
-
|
84
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
85
|
-
release a new version, update the version number in `version.rb`, and then run
|
86
|
-
`bundle exec rake release`, which will create a git tag for the version, push
|
87
|
-
git commits and tags, and push the `.gem` file to
|
88
|
-
[rubygems.org](https://rubygems.org).
|
89
|
-
|
90
|
-
## Contributing
|
91
|
-
|
92
|
-
Bug reports and pull requests are welcome on GitHub at
|
93
|
-
https://github.com/on-site/server_health_check-rails. This project is intended
|
94
|
-
to be a safe, welcoming space for collaboration, and contributors are expected
|
95
|
-
to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
96
|
-
conduct.
|
97
|
-
|
98
|
-
## License
|
99
|
-
|
100
|
-
The gem is available as open source under the terms of the
|
101
|
-
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "server_health_check/rails"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'server_health_check_rails/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "server_health_check-rails"
|
8
|
-
spec.version = ServerHealthCheckRails::VERSION
|
9
|
-
spec.authors = ["Mike Virata-Stone"]
|
10
|
-
spec.email = ["mjstone@on-site.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Healthcheck for Rails apps.}
|
13
|
-
spec.description = %q{Health check for Rails apps checking things like active record, redis, and AWS.}
|
14
|
-
spec.homepage = "https://github.com/on-site/server_health_check-rails"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
-
f.match(%r{^(test|spec|features)/})
|
19
|
-
end
|
20
|
-
spec.bindir = "exe"
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.add_runtime_dependency "rails", ">= 3.0", "< 6.0"
|
25
|
-
spec.add_runtime_dependency "server_health_check", "~> 1.0"
|
26
|
-
|
27
|
-
spec.add_development_dependency "bundler", "~> 1.13"
|
28
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
30
|
-
end
|