philae 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/philae/docker_probe.rb +3 -3
- data/lib/philae/etcd_probe.rb +2 -1
- data/lib/philae/http_probe.rb +2 -1
- data/lib/philae/mongo_probe.rb +2 -1
- data/lib/philae/pgsql_probe.rb +32 -0
- data/lib/philae/prober.rb +1 -4
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 98c6b24b9ffa3987fffbb4a47f404e8d20e728663be1dd3a6953972bfab2a7d6
|
4
|
+
data.tar.gz: f646a2b162c96cf3eced95b894f75ab74e64a13fb9dc40618ebf6757a721a068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a665aee100b59fa4057f1cb688aebf8fcf52282408142b3186d53da9e236522ad74c2945c26f0be66e38a377329cfb494863e24a85acde4f7ac72b4a7102e8
|
7
|
+
data.tar.gz: 8316c82012b480bb5cd6b43b2992a5b6e3712a78337031c51760903cc9d79a6962f71aeef5e1ed3a426a33c4d4ede4ddc0c99218c47835a5f881363cd4afd417
|
data/lib/philae/docker_probe.rb
CHANGED
@@ -12,14 +12,14 @@ module Philae
|
|
12
12
|
|
13
13
|
def check
|
14
14
|
Docker.url = @endpoint
|
15
|
-
Docker.options = @docker_options
|
15
|
+
Docker.options = @docker_options if !@docker_options.nil?
|
16
16
|
begin
|
17
17
|
Docker::Container.all
|
18
18
|
rescue
|
19
|
-
return {healthy: false, comment: 'Unable to communicate with docker'}
|
19
|
+
return { healthy: false, comment: 'Unable to communicate with docker' }
|
20
20
|
end
|
21
21
|
|
22
|
-
{ healthy: true, comment: '' }
|
22
|
+
return { healthy: true, comment: '' }
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/philae/etcd_probe.rb
CHANGED
data/lib/philae/http_probe.rb
CHANGED
data/lib/philae/mongo_probe.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'pg'
|
2
|
+
|
3
|
+
# Philae::PostgreSQLProbe tries to connect to the given connection string and
|
4
|
+
# ping the database. The connection string must be in the form
|
5
|
+
# `postgres://[username:password@]host1[:port1][/[database][?options]]`
|
6
|
+
module Philae
|
7
|
+
class PostgreSQLProbe
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(name, connection_string)
|
11
|
+
@name = name
|
12
|
+
@connection_string = connection_string
|
13
|
+
end
|
14
|
+
|
15
|
+
def check
|
16
|
+
begin
|
17
|
+
res = PG::Connection.ping(@connection_string)
|
18
|
+
rescue
|
19
|
+
return { healthy: false, comment: 'Unable to contact PostgreSQL' }
|
20
|
+
end
|
21
|
+
return { healthy: true, comment: '' } if res == PG::PQPING_OK
|
22
|
+
|
23
|
+
# https://deveiate.org/code/pg/PG/Connection.html#method-c-ping
|
24
|
+
reasons = {
|
25
|
+
PG::PQPING_REJECT => 'server is alive but rejecting connections',
|
26
|
+
PG::PQPING_NO_RESPONSE => 'could not establish connection',
|
27
|
+
PG::PQPING_NO_ATTEMPT => 'connection not attempted (bad params)',
|
28
|
+
}
|
29
|
+
return { healthy: false, comment: "Ping to PostgreSQL failed with the following reason: #{reasons[res]}" }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/philae/prober.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: philae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leo@scalingo.com
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: docker-api
|
@@ -27,19 +27,19 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '1.33'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: etcd
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: json
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,19 +55,19 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '2.1'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: mongo
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
63
|
+
version: '2.4'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
70
|
+
version: '2.4'
|
71
71
|
description:
|
72
72
|
email: hello@scalingo.com
|
73
73
|
executables: []
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/philae/http_probe.rb
|
81
81
|
- lib/philae/mongo_probe.rb
|
82
82
|
- lib/philae/nsq_probe.rb
|
83
|
+
- lib/philae/pgsql_probe.rb
|
83
84
|
- lib/philae/philae_probe.rb
|
84
85
|
- lib/philae/prober.rb
|
85
86
|
- lib/rack/philae_rack.rb
|
@@ -102,9 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
103
|
- !ruby/object:Gem::Version
|
103
104
|
version: '0'
|
104
105
|
requirements: []
|
105
|
-
|
106
|
-
rubygems_version: 2.6.13
|
106
|
+
rubygems_version: 3.0.3
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
|
-
summary: Provide an health check
|
109
|
+
summary: Provide an health check API
|
110
110
|
test_files: []
|