middleware_healthcheck 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{MIT-LICENSE → LICENSE} +0 -0
- data/README.md +54 -13
- data/lib/middleware_healthcheck/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3385631d49a7b374953f938aa58f350c5a2acf1c4a37ecc0a2bf8ab410315b09
|
4
|
+
data.tar.gz: a50a238151aa178562a3041f857009699354ab262fa93b5a4ec9c2787e7ed5b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2b8ca12641253a4b7cdb3e8121c7a9d55d5879bfd424bb5bc74ae3d7c03beddd978a17e5d191f099dd54b72704b8d9c7d727193272b2cca66e1890c496bb6d7
|
7
|
+
data.tar.gz: 7010aab4e04ee708bde55d91b9f78f6074739fc760ac7c6e4898850776a0be73c7e3e9184e2295277ddd2dc72f7a4aa2d0036030c57615252d75d98e08228c19
|
data/{MIT-LICENSE → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
|
+
[![MiddlewareHealthcheck](logo.png)]()
|
2
|
+
|
1
3
|
# MiddlewareHealthcheck
|
2
4
|
|
5
|
+
[![CircleCI](https://circleci.com/bb/ff_engineering/middleware_healthcheck.svg?style=svg)](https://circleci.com/bb/ff_engineering/middleware_healthcheck) [![Gem Version](https://img.shields.io/gem/v/middleware_healthcheck.svg?style=flat-square)](https://rubygems.org/gems/middleware_healthcheck) [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](MIT-LICENSE)
|
6
|
+
|
7
|
+
Customizable health-check API endpoint for your service.
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
# Overview
|
12
|
+
|
13
|
+
Add a health check API endpoint (e.g. HTTP /healthcheck) that returns the health of your service to your rack or Ruby on Rails application.
|
14
|
+
|
15
|
+
## Features
|
16
|
+
|
17
|
+
- customizable endpoint
|
18
|
+
- custom checks
|
19
|
+
- two default checks provided
|
20
|
+
|
21
|
+
## Default checks
|
22
|
+
|
23
|
+
The default check when no params are passed doesn't try to connect to the database. This is useful when you want to check the health of an application instance inside of a load balancer for example (even if the database is down, the application servers would be healthy and should not be replaced).
|
24
|
+
|
25
|
+
```
|
26
|
+
/healthcheck
|
27
|
+
```
|
28
|
+
|
29
|
+
There is another check included that takes the database into consideration and will fail if the database is down.
|
30
|
+
|
31
|
+
```
|
32
|
+
/healthcheck?checks=active_record
|
33
|
+
```
|
34
|
+
|
35
|
+
# Getting started
|
36
|
+
|
3
37
|
## Installation
|
4
38
|
Add this line to your application's Gemfile:
|
5
39
|
```ruby
|
@@ -8,7 +42,7 @@ gem 'middleware_healthcheck'
|
|
8
42
|
|
9
43
|
And then execute:
|
10
44
|
```bash
|
11
|
-
$ bundle
|
45
|
+
$ bundle install
|
12
46
|
```
|
13
47
|
|
14
48
|
Or install it yourself as:
|
@@ -16,7 +50,7 @@ Or install it yourself as:
|
|
16
50
|
$ gem install middleware_healthcheck
|
17
51
|
```
|
18
52
|
|
19
|
-
|
53
|
+
# Usage
|
20
54
|
Run basic check (without running any advanced checkers):
|
21
55
|
```
|
22
56
|
/healthcheck
|
@@ -43,19 +77,20 @@ MiddlewareHealthcheck.configure do |config|
|
|
43
77
|
end
|
44
78
|
```
|
45
79
|
Available options:
|
46
|
-
|
47
|
-
healthcheck_path
|
48
|
-
full_check_param_name
|
49
|
-
selected_check_param_name
|
50
|
-
error_response_status
|
51
|
-
success_response_status
|
52
|
-
success_response_body
|
53
|
-
errors_delimiter
|
54
|
-
selected_check_param_split_delimiter
|
55
|
-
|
80
|
+
|
81
|
+
- healthcheck_path - the url endpoint for the healthcheck API (default: 'healthcheck')
|
82
|
+
- full_check_param_name (default: 'full')
|
83
|
+
- selected_check_param_name (default: 'checks')
|
84
|
+
- error_response_status
|
85
|
+
- success_response_status
|
86
|
+
- success_response_body
|
87
|
+
- errors_delimiter
|
88
|
+
- selected_check_param_split_delimiter
|
89
|
+
|
56
90
|
|
57
91
|
## Custom Checkers
|
58
92
|
Your Custom Checker class should look like this:
|
93
|
+
|
59
94
|
```ruby
|
60
95
|
class MyCustomChecker
|
61
96
|
attr_accessor :error
|
@@ -75,6 +110,7 @@ end
|
|
75
110
|
```
|
76
111
|
|
77
112
|
To include Custom Checker, just add
|
113
|
+
|
78
114
|
```ruby
|
79
115
|
HealthcheckMiddleware.configure do |config|
|
80
116
|
config.checkers << MyCustomChecker
|
@@ -82,6 +118,10 @@ end
|
|
82
118
|
```
|
83
119
|
in initializer.
|
84
120
|
|
121
|
+
# Contributing
|
122
|
+
|
123
|
+
Use the provided dockerized development environment. For more information check the [CONTRIBUTING](CONTRIBUTING.md) file.
|
124
|
+
|
85
125
|
## Development
|
86
126
|
|
87
127
|
```
|
@@ -93,5 +133,6 @@ docker-compose run --rm app bundle exec rspec
|
|
93
133
|
|
94
134
|
```
|
95
135
|
|
96
|
-
|
136
|
+
# License
|
97
137
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
138
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleware_healthcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wieczorkowski
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -78,7 +78,7 @@ executables: []
|
|
78
78
|
extensions: []
|
79
79
|
extra_rdoc_files: []
|
80
80
|
files:
|
81
|
-
-
|
81
|
+
- LICENSE
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
84
|
- lib/middleware_healthcheck.rb
|
@@ -90,7 +90,7 @@ files:
|
|
90
90
|
- lib/middleware_healthcheck/rails.rb
|
91
91
|
- lib/middleware_healthcheck/version.rb
|
92
92
|
- lib/tasks/middleware_healthcheck_tasks.rake
|
93
|
-
homepage:
|
93
|
+
homepage: https://bitbucket.org/ff_engineering/middleware_healthcheck/src/master/
|
94
94
|
licenses:
|
95
95
|
- MIT
|
96
96
|
metadata: {}
|