health_bit 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: 712c992c9824246024965917be0bf884a757b163a5b4d027226fa15d090c886b
4
- data.tar.gz: 3d9f192b7a93bed3dd706c8f7dddc965b446c40069b440d05353f585efac66be
3
+ metadata.gz: 1b89365fc234404da475087af408d01f927f8c58a0e41eadbe3d0f5bf172c551
4
+ data.tar.gz: 17a35b4d08227b12eb7d787843d760b01bd2d9f53d36eecb6b00d3811b689a8a
5
5
  SHA512:
6
- metadata.gz: 3731cea2f52998e7b54202dbcf7f2b4cae9ad82772ba23be92bb1290ac2858dc71250b0eec4d79651cbfb6073fb223f2f443af09a4e34a33dd945d87eb36b43e
7
- data.tar.gz: a59fa6db73a4888cdb3401abe2391d6ec73d44ac3a5023fd0806cf10d638e96e659a242f01de19fb7b8f9da349841613112b5e4eabe2d738ca7b837796a915f4
6
+ metadata.gz: 3e6441577cb24561a366b674978d501b86ae641ef40cdcccbea1054651a5aad1c3dd9d59a2f2b4cce34d3ce4f22fac8668265c87fbaa92771e9f61d1e522311f
7
+ data.tar.gz: 9e86554bad55338dcd40a5ca192e0aee79753936ad52935649a46980f66aac092359642cc41f53eadb5a55d8b61f6e895c181ee6206a4490266f02a3055d7620
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- health_bit (0.1.7)
4
+ health_bit (0.1.8)
5
5
  rack
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -22,11 +22,18 @@ Key differences:
22
22
  * [Add Checks](#add-checks)
23
23
  * [Add a Route](#add-a-route)
24
24
  * [Password Protection](#password-protection)
25
+ * [Multiple endpoints](#multiple-endpoints)
26
+
27
+ ## Check Examples
28
+
25
29
  * [Database check](#database-check)
26
30
  * [Redis check](#redis-check)
31
+ * [Sidekiq check](#sidekiq-check)
27
32
  * [Rails cache check](#rails-cache-check)
28
33
  * [Elasticsearch check](#elasticsearch-check)
29
- * [Multiple endpoints](#multiple-endpoints)
34
+ * [RabbitMQ check](#rabbitmq-check)
35
+ * [HTTP check](#http-check)
36
+ * [ClickHouse check](#clickhouse-check)
30
37
 
31
38
  ## Installation
32
39
 
@@ -40,8 +47,9 @@ gem 'health_bit'
40
47
 
41
48
  ```ruby
42
49
  # config/initializers/health_bit.rb
43
- # DEFAULT SETTINGS ARE SHOWN BELOW
50
+
44
51
  HealthBit.configure do |c|
52
+ # DEFAULT SETTINGS ARE SHOWN BELOW
45
53
  c.success_text = '%<count>d checks passed 🎉'
46
54
  c.headers = {
47
55
  'Content-Type' => 'text/plain;charset=utf-8',
@@ -87,9 +95,10 @@ HealthBit.add('Docker service') do
87
95
  end
88
96
 
89
97
  # The Check can be added as an object responding to a call
98
+ # (to be able to test your check)
90
99
  class Covid19Check
91
100
  def self.call
92
- true
101
+ false
93
102
  end
94
103
  end
95
104
 
@@ -112,14 +121,14 @@ end
112
121
  ## Password Protection
113
122
 
114
123
  Since the gem is a common rack application, you can add any rack
115
- middleware. Below is an example with HTTP-auth for the Rails.
124
+ middleware to it. Below is an example with HTTP-auth for the Rails.
116
125
 
117
126
  ```ruby
118
127
  # config/routes.rb
119
128
 
120
129
  Rails.application.routes.draw do
121
130
  HealthBit.rack.use Rack::Auth::Basic do |username, password|
122
- ActiveSupport::SecurityUtils.secure_compare(Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest('user')) & ActiveSupport::SecurityUtils.secure_compare(Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest('password'))
131
+ ActiveSupport::SecurityUtils.secure_compare(Digest::SHA256.hexdigest(username), Digest::SHA256.hexdigest('user')) & ActiveSupport::SecurityUtils.secure_compare(Digest::SHA256.hexdigest(password), Digest::SHA256.hexdigest('password'))
123
132
  end
124
133
 
125
134
  mount HealthBit.rack => '/health'
@@ -138,7 +147,15 @@ end
138
147
 
139
148
  ```ruby
140
149
  HealthBit.add('Redis') do
141
- Redis.current.ping == 'PONG'
150
+ Redis.current.ping == 'PONG'
151
+ end
152
+ ```
153
+
154
+ ## Sidekiq check
155
+
156
+ ```ruby
157
+ HealthBit.add('Sidekiq') do
158
+ Sidekiq.redis(&:ping) == 'PONG'
142
159
  end
143
160
  ```
144
161
 
@@ -158,11 +175,35 @@ HealthBit.add('Elasticsearch') do
158
175
  end
159
176
  ```
160
177
 
178
+ ## RabbitMQ check
179
+
180
+ ```ruby
181
+ HealthBit.add('RabbitMQ') do
182
+ Bunny::Connection.connect(&:connection)
183
+ end
184
+ ```
185
+
186
+ ## HTTP check
187
+
188
+ ```ruby
189
+ HealthBit.add('HTTP check') do
190
+ Net::HTTP.new('www.example.com', 80).request_get('/').kind_of?(Net::HTTPSuccess)
191
+ end
192
+ ```
193
+
194
+ ## ClickHouse check
195
+
196
+ ```ruby
197
+ HealthBit.add('ClickHouse') do
198
+ ClickHouse.connection.ping
199
+ end
200
+ ```
201
+
161
202
  ## Multiple endpoints
162
203
 
163
204
  Sometimes you have to add several health check endpoints. Let's say
164
205
  you have to check the docker container health and the health
165
- of your application as a whole. Below is an example for rails.
206
+ of your application as a whole. Below is an example for the Rails.
166
207
 
167
208
  ```ruby
168
209
  # config/initializers/health_bit.rb
@@ -83,4 +83,10 @@ module HealthBit
83
83
  end
84
84
  end
85
85
  end
86
+
87
+ def clone
88
+ Module.new.tap do |dolly|
89
+ dolly.singleton_class.include(HealthBit)
90
+ end
91
+ end
86
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HealthBit
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health_bit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-07 00:00:00.000000000 Z
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack