server_health_check-rails 0.1.0 → 0.2.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
  SHA1:
3
- metadata.gz: 462bcb33ddff0e63b2fdd82b38cb734578ca4ee0
4
- data.tar.gz: 4756e7c64b8553709ae490e4db8c8af9b49f1520
3
+ metadata.gz: bc0c6c14b8c48a77261703db77e515b1b8a3a82b
4
+ data.tar.gz: bb4678c823323e1d175dae4a989bd9179ead511e
5
5
  SHA512:
6
- metadata.gz: 517e853cf964201158a34b1a855cd385c18946f0edc5b590b4d14e656cb9183b1eeb7b45269744cf9c12d8d15347b04c9421ab355c343d46c609fac2a7d3b096
7
- data.tar.gz: 79768519e033f82d43b741b801c7120cbb849f5a257bd64f9b293951e526ccc25dbeb8931a3708e4bebc19a506651cd4bd69d6fc1e4e2be8447a8ea578a2a96d
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
 
@@ -34,7 +34,7 @@ module ServerHealthCheckRails
34
34
 
35
35
  def check_redis!(host: nil, port: 6379)
36
36
  add_check "redis" do |server_health_check|
37
- server_health_check.redis! host: nil, port: 6379
37
+ server_health_check.redis! host: host, port: port
38
38
  end
39
39
  end
40
40
 
@@ -1,3 +1,3 @@
1
1
  module ServerHealthCheckRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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: 2016-12-02 00:00:00.000000000 Z
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
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.2
5
- before_install: gem install bundler -v 1.13.3
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in server_health_check-rails.gemspec
4
- gemspec
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
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
9
-
10
- task :default => :test
@@ -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,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -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