server_health_check-rails 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/server_health_check_rails.rb +12 -45
- data/lib/server_health_check_rails/engine.rb +4 -0
- data/lib/server_health_check_rails/version.rb +1 -1
- metadata +13 -22
- data/app/controllers/server_health_check_rails/application_controller.rb +0 -5
- data/app/controllers/server_health_check_rails/health_controller.rb +0 -13
- data/app/models/server_health_check_rails/health_check.rb +0 -26
- data/config/routes.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a4134d4a7eb67af5bccc2b95826d434feb9b3aaa
|
4
|
+
data.tar.gz: e588cc8e89148d7ae56a7a61f588e45dc0fb8ebd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d71156179804ef8aa43361c924836da6f24dee93b94a8cb79d45d7164435fc764a4abc20bc008a7d2e02b1a92375fb759b102d3529ea7f8ef43f2cbbcd56aa7
|
7
|
+
data.tar.gz: 7e2e69e502828185d8463c92d6a115b884c2902305a268d5ee67cc64a3b76987dce929f9db59512f31206b1246893a3f160524bab441f22ee4476d75d9ffa89e
|
@@ -1,60 +1,27 @@
|
|
1
|
-
require "server_health_check"
|
1
|
+
require "server_health_check/rack"
|
2
2
|
require "server_health_check_rails/version"
|
3
3
|
require "server_health_check_rails/engine"
|
4
|
-
require "set"
|
5
4
|
|
6
5
|
module ServerHealthCheckRails
|
7
6
|
class << self
|
8
|
-
def
|
9
|
-
|
10
|
-
@checks.keys
|
7
|
+
def method_missing(method, *args, &block)
|
8
|
+
ServerHealthCheckRack::Checks.send(method, *args, &block)
|
11
9
|
end
|
12
10
|
|
13
|
-
def
|
14
|
-
|
15
|
-
checks = Set.new(checks)
|
16
|
-
|
17
|
-
@checks.each do |name, check|
|
18
|
-
next unless checks.include?(name)
|
19
|
-
check.call(server_health_check)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def check(name, &block)
|
24
|
-
add_check name do |server_health_check|
|
25
|
-
server_health_check.check!(name, &block)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def check_active_record!
|
30
|
-
add_check "active_record" do |server_health_check|
|
31
|
-
server_health_check.active_record!
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def check_redis!(host: nil, port: 6379)
|
36
|
-
add_check "redis" do |server_health_check|
|
37
|
-
server_health_check.redis! host: host, port: port
|
38
|
-
end
|
11
|
+
def respond_to_missing?(method, include_private = false)
|
12
|
+
ServerHealthCheckRack::Checks.respond_to?(method)
|
39
13
|
end
|
14
|
+
end
|
40
15
|
|
41
|
-
|
42
|
-
|
43
|
-
|
16
|
+
class Config
|
17
|
+
class << self
|
18
|
+
def method_missing(method, *args, &block)
|
19
|
+
ServerHealthCheckRack::Config.send(method, *args, &block)
|
44
20
|
end
|
45
|
-
end
|
46
21
|
|
47
|
-
|
48
|
-
|
49
|
-
server_health_check.aws_creds!
|
22
|
+
def respond_to_missing?(method, include_private = false)
|
23
|
+
ServerHealthCheckRack::Config.respond_to?(method)
|
50
24
|
end
|
51
25
|
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def add_check(name, &block)
|
56
|
-
@checks ||= {}
|
57
|
-
@checks[name] = block
|
58
|
-
end
|
59
26
|
end
|
60
27
|
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.
|
4
|
+
version: 0.3.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-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,41 +29,35 @@ dependencies:
|
|
29
29
|
version: '3.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: server_health_check
|
34
|
+
name: server_health_check-rack
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.0'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
39
|
+
version: '0'
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.0'
|
50
44
|
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
46
|
+
version: '0'
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: bundler
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
56
50
|
requirements:
|
57
|
-
- - "
|
51
|
+
- - "~>"
|
58
52
|
- !ruby/object:Gem::Version
|
59
|
-
version: '1.
|
53
|
+
version: '1.13'
|
60
54
|
type: :development
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
57
|
requirements:
|
64
|
-
- - "
|
58
|
+
- - "~>"
|
65
59
|
- !ruby/object:Gem::Version
|
66
|
-
version: '1.
|
60
|
+
version: '1.13'
|
67
61
|
- !ruby/object:Gem::Dependency
|
68
62
|
name: rake
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,10 +96,6 @@ extra_rdoc_files: []
|
|
102
96
|
files:
|
103
97
|
- CODE_OF_CONDUCT.md
|
104
98
|
- LICENSE.txt
|
105
|
-
- app/controllers/server_health_check_rails/application_controller.rb
|
106
|
-
- app/controllers/server_health_check_rails/health_controller.rb
|
107
|
-
- app/models/server_health_check_rails/health_check.rb
|
108
|
-
- config/routes.rb
|
109
99
|
- lib/server_health_check-rails.rb
|
110
100
|
- lib/server_health_check/rails.rb
|
111
101
|
- lib/server_health_check_rails.rb
|
@@ -130,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
120
|
- !ruby/object:Gem::Version
|
131
121
|
version: '0'
|
132
122
|
requirements: []
|
133
|
-
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.4.8
|
134
125
|
signing_key:
|
135
126
|
specification_version: 4
|
136
127
|
summary: Healthcheck for Rails apps.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module ServerHealthCheckRails
|
2
|
-
class HealthController < ServerHealthCheckRails::ApplicationController
|
3
|
-
def index
|
4
|
-
check = ServerHealthCheckRails::HealthCheck.all
|
5
|
-
render status: check.http_status, json: check.to_h
|
6
|
-
end
|
7
|
-
|
8
|
-
def show
|
9
|
-
check = ServerHealthCheckRails::HealthCheck.new(params[:id])
|
10
|
-
render status: check.http_status, json: check.to_h
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module ServerHealthCheckRails
|
2
|
-
class HealthCheck
|
3
|
-
def initialize(*checks, logger: Rails.logger)
|
4
|
-
@check = ServerHealthCheck.new(logger: logger)
|
5
|
-
ServerHealthCheckRails.apply_checks(@check, checks)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.all
|
9
|
-
new(*ServerHealthCheckRails.all_checks)
|
10
|
-
end
|
11
|
-
|
12
|
-
def http_status
|
13
|
-
if @check.ok?
|
14
|
-
200
|
15
|
-
else
|
16
|
-
500
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_h
|
21
|
-
{
|
22
|
-
status: @check.results
|
23
|
-
}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/config/routes.rb
DELETED