kubernetes-health 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -28
- data/kubernetes-health.gemspec +8 -2
- data/lib/kubernetes/health/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22eea741faba4096ddf070dc1135d466472913f5352db08a0e1a0e56e5199d21
|
4
|
+
data.tar.gz: 651e2e4a0057eec8cc7bc582767015c34ff90d0cbaf6e35f8993be2639801fc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d30a41632feaf497f2a1f1e144c661642f5a4dae8db114a484bef3651ec90134c652c8b0bbb1ccf1b2c8d27be603d4c38962f9ee557816d4568f5b353bdd853c
|
7
|
+
data.tar.gz: f1fa8dce9a80c68895050c66ce9be88cd6e412f1bbedf8352d7072c396763f2716d32ceead9bee742262cadbc3cf9780721bca89c47f31a1707253efc522ee07
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Kubernetes::Health
|
2
2
|
|
3
|
-
|
3
|
+
This gem allows kubernetes monitoring your app while it is running migrates and after it started.
|
4
|
+
|
5
|
+
# Features
|
6
|
+
- add routes `/_readiness` and `/_liveness` on rails stack by default.
|
7
|
+
- allow custom checks for `/_readiness` and `/_liveness` on rails stack.
|
8
|
+
- add routes `/_readiness` and `/_liveness` while `rake db:migrate` runs. (optional).
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -10,35 +15,28 @@ Add this line to your application's Gemfile:
|
|
10
15
|
gem 'kubernetes-health', '~> 2.0'
|
11
16
|
```
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
## Enable migrates monitoring.
|
18
|
-
|
19
|
-
This will run a Rack server for `/_readiness` route and will return `200` and `503` HTTP CODES alternately while your migrates are running.
|
18
|
+
## Enabling monitoring while `rake db:migrate` runs
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
Of course your Dockerfile entry script needs to run migrates before start your web app.
|
20
|
+
Your Dockerfile's entry script needs to run migrates before start your web app.
|
24
21
|
|
25
22
|
Add `KUBERNETES_HEALTH_ENABLE_RACK_ON_MIGRATE=true` environment variable.
|
26
23
|
|
27
|
-
or
|
24
|
+
or add in your `application.rb`.
|
28
25
|
|
29
26
|
```
|
30
|
-
|
27
|
+
# default: false
|
28
|
+
Kubernetes::Health::Config.enable_rack_on_migrate = true
|
31
29
|
```
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
If you need:
|
31
|
+
If you need customize http rotating codes:
|
36
32
|
|
37
33
|
```
|
38
|
-
|
34
|
+
# default: [200, 503]
|
35
|
+
Kubernetes::Health::Config.rack_on_migrate_rotate_http_codes = [200, 503]
|
39
36
|
```
|
40
37
|
|
41
|
-
|
38
|
+
In Kubernetes you need to configure your deployment `readinessProbe` like this:
|
39
|
+
|
42
40
|
```
|
43
41
|
readinessProbe:
|
44
42
|
httpGet:
|
@@ -50,29 +48,31 @@ Configure your deployment readinessProbe:
|
|
50
48
|
successThreshold: 3
|
51
49
|
```
|
52
50
|
|
53
|
-
|
51
|
+
### How `rake db:migrate` monitoring works
|
52
|
+
It will run a RACK server for `/_readiness` and `/_liveness` routes while a `rake db:migrate` runs and it will return `200` and `503` HTTP CODES alternately avoiding to reach `failureThreshold` or `successThreshold`.
|
54
53
|
|
55
|
-
|
54
|
+
The `failureThreshold` and `successThreshold` values must to greater than `2` forcing kubernetes to wait.
|
55
|
+
|
56
|
+
## Customizing checks
|
57
|
+
|
58
|
+
It only works for routes in rails stack, they are not executed while `rake db:migrate` runs.
|
59
|
+
|
60
|
+
Ex. Check if PostgreSQL is reachable. `params` is optional.
|
56
61
|
|
57
|
-
Ex. Check if PostgreSQL is working. `params` is optional.
|
58
62
|
```
|
59
63
|
Kubernetes::Health::Config.ready_if = lambda { |params|
|
60
64
|
ActiveRecord::Base.connection.execute("SELECT 1").cmd_tuples != 1
|
61
65
|
}
|
62
66
|
```
|
63
67
|
|
64
|
-
Set Kubernetes::Health::Config.live_if if you want to check other things.
|
65
|
-
|
66
|
-
Ex. Check if PostgreSQL is working. `params` is optional.
|
67
68
|
```
|
68
|
-
Kubernetes::Health::Config.
|
69
|
+
Kubernetes::Health::Config.live_if = lambda { |params|
|
69
70
|
ActiveRecord::Base.connection.execute("SELECT 1").cmd_tuples != 1
|
70
71
|
}
|
71
72
|
```
|
72
73
|
|
73
|
-
|
74
|
-
## Custom routes
|
74
|
+
## Customizing routes
|
75
75
|
```
|
76
76
|
Kubernetes::Health::Config.route_liveness = '/liveness'
|
77
77
|
Kubernetes::Health::Config.route_readiness = '/readiness
|
78
|
-
```
|
78
|
+
```
|
data/kubernetes-health.gemspec
CHANGED
@@ -9,8 +9,14 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Wagner Caixeta"]
|
10
10
|
spec.email = ["wagner@baladapp.com.br"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
12
|
+
spec.summary = %q{This gem allows kubernetes monitoring your app while it is running migrates and after it started.}
|
13
|
+
spec.description = %q{
|
14
|
+
This gem allows kubernetes monitoring your app while it is running migrates and after it started.
|
15
|
+
Features:
|
16
|
+
* add routes /_readiness and /_liveness on rails stack by default;
|
17
|
+
* allow custom checks for /_readiness and /_liveness on rails stack;
|
18
|
+
* add routes /_readiness and /_liveness while rake db:migrate runs.
|
19
|
+
}
|
14
20
|
spec.homepage = "https://github.com/platbr/kubernetes-health"
|
15
21
|
|
16
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes-health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wagner Caixeta
|
@@ -52,7 +52,11 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: "\n This gem allows kubernetes monitoring your app while it is running
|
56
|
+
migrates and after it started.\n Features:\n * add routes /_readiness and
|
57
|
+
/_liveness on rails stack by default;\n * allow custom checks for /_readiness
|
58
|
+
and /_liveness on rails stack;\n * add routes /_readiness and /_liveness while
|
59
|
+
rake db:migrate runs.\n "
|
56
60
|
email:
|
57
61
|
- wagner@baladapp.com.br
|
58
62
|
executables: []
|
@@ -97,5 +101,6 @@ requirements: []
|
|
97
101
|
rubygems_version: 3.0.1
|
98
102
|
signing_key:
|
99
103
|
specification_version: 4
|
100
|
-
summary:
|
104
|
+
summary: This gem allows kubernetes monitoring your app while it is running migrates
|
105
|
+
and after it started.
|
101
106
|
test_files: []
|