rails-healthcheck 1.1.1 → 1.1.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 +40 -28
- data/lib/generators/healthcheck/install_generator.rb +1 -0
- data/lib/healthcheck/configuration.rb +0 -1
- data/lib/healthcheck/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41e3825b8a1931d4740ab2a7dd883decbd5de9799bcfbc707078babd111789a8
|
4
|
+
data.tar.gz: fc76c416917531adfc415d8b1f67e741abfd48f3132bfcf5298b4a38b1b8fe2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1194978affdbf2c2a6340e7c3a23e28867df07431cf0cf24005fd6c42d63ef9ab5527e4871ead6f6efd2624d5af8b685fbf033568f4b1deca31e01f7247b0ddc
|
7
|
+
data.tar.gz: 810207678952fe7831d803afe44951fda41cd03ad84879a801a530845562e826ff66fd09d19715d354cb81f96bd35bcc9bf8db2edfdce542d957e8799505aca3
|
data/README.md
CHANGED
@@ -1,13 +1,26 @@
|
|
1
1
|
# [Rails::Healthcheck][gem_page]
|
2
2
|
|
3
|
+
[![Gem Version][gem_version_image]][gem_version_page]
|
3
4
|
[![Build Status][travis_status_image]][travis_page]
|
4
5
|
[![Maintainability][code_climate_maintainability_image]][code_climate_maintainability_page]
|
5
6
|
[![Test Coverage][code_climate_test_coverage_image]][code_climate_test_coverage_page]
|
6
|
-
[![Gem Version][gem_version_image]][gem_version_page]
|
7
7
|
|
8
8
|
A simple way to configure a healthcheck route in Rails applications
|
9
9
|
|
10
|
-
##
|
10
|
+
## Table of Contents
|
11
|
+
- [Getting started](#getting-started)
|
12
|
+
- [Installation](#installation)
|
13
|
+
- [Settings](#settings)
|
14
|
+
- [Verbose Errors](#verbose-errors)
|
15
|
+
- [Ignoring logs](#ignoring-logs)
|
16
|
+
- [Lograge](#lograge)
|
17
|
+
- [Requests Examples](#requests-examples)
|
18
|
+
- [Contributing](#contributing)
|
19
|
+
- [License](#license)
|
20
|
+
|
21
|
+
## Getting started
|
22
|
+
|
23
|
+
### Installation
|
11
24
|
|
12
25
|
Add this line to your application's Gemfile:
|
13
26
|
|
@@ -15,14 +28,15 @@ Add this line to your application's Gemfile:
|
|
15
28
|
gem 'rails-healthcheck'
|
16
29
|
```
|
17
30
|
|
18
|
-
and run:
|
31
|
+
and run the command bellow to create the initializer:
|
19
32
|
|
20
33
|
```
|
21
34
|
rails generate healthcheck:install
|
22
35
|
```
|
23
36
|
|
24
37
|
## Settings
|
25
|
-
|
38
|
+
|
39
|
+
You can set the settings in the initializer file (_config/initializers/healthcheck.rb_):
|
26
40
|
|
27
41
|
```ruby
|
28
42
|
# frozen_string_literal: true
|
@@ -35,18 +49,15 @@ Healthcheck.configure do |config|
|
|
35
49
|
config.method = :get
|
36
50
|
|
37
51
|
# -- Checks --
|
38
|
-
# Check if the db is available
|
39
52
|
# config.add_check :database, -> { ActiveRecord::Base.connection.execute('select 1') }
|
40
|
-
# Check if the db is available and without pending migrations
|
41
53
|
# config.add_check :migrations,-> { ActiveRecord::Migration.check_pending! }
|
42
|
-
# Check if the cache is available
|
43
54
|
# config.add_check :cache, -> { Rails.cache.read('some_key') }
|
44
|
-
# Check if the application required envs are defined
|
45
55
|
# config.add_check :environments, -> { Dotenv.require_keys('ENV_NAME', 'ANOTHER_ENV') }
|
46
56
|
end
|
47
57
|
```
|
48
58
|
|
49
|
-
### Verbose
|
59
|
+
### Verbose Errors
|
60
|
+
|
50
61
|
When happen an error and verbose is enabled (`config.verbose = true`), the response will be like this:
|
51
62
|
|
52
63
|
```json
|
@@ -67,10 +78,26 @@ When happen an error and verbose is enabled (`config.verbose = true`), the respo
|
|
67
78
|
}
|
68
79
|
```
|
69
80
|
|
70
|
-
|
81
|
+
## Ignoring logs
|
71
82
|
|
72
|
-
|
83
|
+
### Lograge
|
84
|
+
|
85
|
+
If you are using [Lograge](https://github.com/roidrage/lograge) you can ignore Healthcheck logs using this code:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
# config/environments/production.rb
|
89
|
+
|
90
|
+
Rails.application.configure do
|
91
|
+
config.lograge.enabled = true
|
92
|
+
config.lograge.ignore_actions = [Healthcheck::CONTROLLER_ACTION]
|
93
|
+
end
|
73
94
|
```
|
95
|
+
|
96
|
+
### Requests Examples
|
97
|
+
|
98
|
+
- Success
|
99
|
+
|
100
|
+
```shell
|
74
101
|
curl -i localhost:3000/healthcheck
|
75
102
|
|
76
103
|
HTTP/1.1 200 OK
|
@@ -88,7 +115,7 @@ Transfer-Encoding: chunked
|
|
88
115
|
```
|
89
116
|
|
90
117
|
- Error
|
91
|
-
```
|
118
|
+
```shell
|
92
119
|
curl -i localhost:3000/healthcheck
|
93
120
|
|
94
121
|
HTTP/1.1 503 Service Unavailable
|
@@ -106,7 +133,7 @@ Transfer-Encoding: chunked
|
|
106
133
|
```
|
107
134
|
|
108
135
|
- Error (Verbose)
|
109
|
-
```
|
136
|
+
```shell
|
110
137
|
curl -i localhost:3000/healthcheck
|
111
138
|
|
112
139
|
HTTP/1.1 503 Service Unavailable
|
@@ -125,21 +152,6 @@ Transfer-Encoding: chunked
|
|
125
152
|
{"code":503,"errors":[{"name":"zero_division","exception":"ZeroDivisionError","message":"divided by 0"}]}
|
126
153
|
```
|
127
154
|
|
128
|
-
## Ignoring logs
|
129
|
-
|
130
|
-
### Lograge
|
131
|
-
|
132
|
-
If you are using [Lograge](https://github.com/roidrage/lograge) you can ignore Healthcheck logs using this code:
|
133
|
-
|
134
|
-
```ruby
|
135
|
-
# config/environments/production.rb
|
136
|
-
|
137
|
-
Rails.application.configure do
|
138
|
-
config.lograge.enabled = true
|
139
|
-
config.lograge.ignore_actions = [Healthcheck::CONTROLLER_ACTION]
|
140
|
-
end
|
141
|
-
```
|
142
|
-
|
143
155
|
## Contributing
|
144
156
|
|
145
157
|
1. Fork it
|
@@ -5,6 +5,7 @@ require 'rails/generators/base'
|
|
5
5
|
module Healthcheck
|
6
6
|
class InstallGenerator < Rails::Generators::Base
|
7
7
|
def create_initializer_file
|
8
|
+
desc 'It creates an initialize to set the healthcheck settings'
|
8
9
|
create_file(
|
9
10
|
'config/initializers/healthcheck.rb',
|
10
11
|
<<~HEALTHCHECK_INITIALIZER_TEXT
|
data/lib/healthcheck/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-healthcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- linqueta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -164,5 +164,5 @@ rubyforge_project:
|
|
164
164
|
rubygems_version: 2.7.6
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
|
-
summary:
|
167
|
+
summary: Healthcheck route for a Rails application
|
168
168
|
test_files: []
|