kubernetes-health 2.0.1 → 2.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d5ce6594cbd093d1eeee80c2eb544f216b5e9e88cdf13f737af125b766c38f5
4
- data.tar.gz: ea119848c807d5dadd80209d4209ac2676fe5cdee4d26198fc9b72522908bc61
3
+ metadata.gz: 22eea741faba4096ddf070dc1135d466472913f5352db08a0e1a0e56e5199d21
4
+ data.tar.gz: 651e2e4a0057eec8cc7bc582767015c34ff90d0cbaf6e35f8993be2639801fc7
5
5
  SHA512:
6
- metadata.gz: 017507ff1b871284d22b9a5576fb2893fa11422fcc10d9d4219d121dc655a62c5b8427f549ec22ddc9b226c2d7d24558625190e4d721cfc133714d88cd7b9cdf
7
- data.tar.gz: e1c50dae1f62c05f1ee79634b74c7a14648cfac4718b4e07b6c94708498a567feeb21321c045d34f8dd34085890b6a957dc2f2871dfb4e87bcdbcf95eecaa95d
6
+ metadata.gz: d30a41632feaf497f2a1f1e144c661642f5a4dae8db114a484bef3651ec90134c652c8b0bbb1ccf1b2c8d27be603d4c38962f9ee557816d4568f5b353bdd853c
7
+ data.tar.gz: f1fa8dce9a80c68895050c66ce9be88cd6e412f1bbedf8352d7072c396763f2716d32ceead9bee742262cadbc3cf9780721bca89c47f31a1707253efc522ee07
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Kubernetes::Health
2
2
 
3
- A gem that adds `/_readiness` and `/_liveness` and allows Kubernetes monitor your rails using HTTP while migrates are running.
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
- And then execute:
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
- If readinessProbe\`s failureThreshold=3 and successThreshold=3 it never will be reach until migrate ends.
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
- Kubernetes::Health::Config.enable_rack_on_migrate = true # default: false
27
+ # default: false
28
+ Kubernetes::Health::Config.enable_rack_on_migrate = true
31
29
  ```
32
30
 
33
- On your app.
34
-
35
- If you need:
31
+ If you need customize http rotating codes:
36
32
 
37
33
  ```
38
- Kubernetes::Health::Config.rack_on_migrate_rotate_http_codes = [200, 503] # default: [202, 503]
34
+ # default: [200, 503]
35
+ Kubernetes::Health::Config.rack_on_migrate_rotate_http_codes = [200, 503]
39
36
  ```
40
37
 
41
- Configure your deployment readinessProbe:
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
- ## Custom check
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
- Set Kubernetes::Health::Config.ready_if if you want to check other things.
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.ready_if = lambda { |params|
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
+ ```
@@ -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{A simple gem to add /_health to your Rails APP.}
13
- spec.description = %q{A simple gem to add /_health to your Rails APP for using with Kubernetes}
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|
@@ -1,5 +1,5 @@
1
1
  module Kubernetes
2
2
  module Health
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
5
5
  end
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.1
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: A simple gem to add /_health to your Rails APP for using with Kubernetes
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: A simple gem to add /_health to your Rails APP.
104
+ summary: This gem allows kubernetes monitoring your app while it is running migrates
105
+ and after it started.
101
106
  test_files: []