rack-ecg 0.0.3 → 0.2.0

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
- SHA1:
3
- metadata.gz: 6e69b8b06f6e9447931c2dd5f6a709153fc05054
4
- data.tar.gz: 7fd824b68af2e6db167af65b7518004c1c7aabce
2
+ SHA256:
3
+ metadata.gz: 83d08e1fb5c31c7f5883cbf1b698b207ce837980d511f35f7d7c32300067d5c4
4
+ data.tar.gz: 88688776e3d95f7b040b0701d9955830bfa833c6ec44e8bcf6a1ce647a30d7a7
5
5
  SHA512:
6
- metadata.gz: 80b858e5dbf7874a6db6d70361c7f8c5726b515113e3bece707c9c857ed70d0d14448ee640899433f7bc4206458cb418b23b03b66d72e32b18c2b5a347c2bcc8
7
- data.tar.gz: 6fa5476c8cba27af405f0c648be87843d79c89f166328ca0b8b15368f3d8cb1b8c3fda15ddc0c850e8d5b66711635c1ca02193001e5cd514fe43074599f8582d
6
+ metadata.gz: d5c0db20e6bf5cfab2e64252ecce8d6f38a240d6356813929a134c8b1dc7fec25cb663b756230b9b81087fef1cef05c196be31258b699181b210a0c75877651b
7
+ data.tar.gz: e77ddb23c3b406fb3e51621364a38be99e3ef5fdb3a0fb91fb850fa21add92415a0e1e47539619fa5c148701eb076782d3de555ef63de15ec7286e48388e983e
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "19:00"
@@ -0,0 +1,22 @@
1
+ name: test
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ ruby: ["2.6", "2.7", "3.0", "3.1"]
10
+ runs-on: ubuntu-latest
11
+ name: Test (Ruby ${{ matrix.ruby }})
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ - name: Run the default task
19
+ run: |
20
+ gem install bundler -v 2.3.7
21
+ bundle install
22
+ bundle exec rake
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
2
+ # configuration file. It makes it possible to enable/disable
3
+ # certain cops (checks) and to alter their behavior if they accept
4
+ # any parameters. The file can be placed either in your home
5
+ # directory or in some project directory.
6
+ #
7
+ # RuboCop will start looking for the configuration file in the directory
8
+ # where the inspected file is and continue its way up to the root directory.
9
+ #
10
+ # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
11
+
12
+ inherit_gem:
13
+ rubocop-shopify: rubocop.yml
14
+
15
+ AllCops:
16
+ Exclude:
17
+ - 'vendor/**/*'
18
+
19
+ Naming/FileName:
20
+ Exclude:
21
+ - 'lib/rack-ecg.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.9
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --files lib/**/*.rb
data/CHANGELOG.md ADDED
@@ -0,0 +1,84 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.2.0] - 2022-02-21
9
+
10
+ ### Added
11
+
12
+ - The `static` check, which uses the provided check parameters to return the same result every time.
13
+
14
+ ### Changed
15
+
16
+ - **Breaking**: The Redis check now requires being configured with an instance of the Redis client, via the named `instance` parameter
17
+ - **Deprecated**: The `git_revision` check will be removed in rack-ecg version 1.0.0. For a suggested replacement, [see the GitRevision Check Replacement example](./examples/gitrevision_check_replacement.ru), which uses the `static` check to memoize the value.
18
+
19
+ ### Removed
20
+
21
+ - **Breaking:** Dropped support for Ruby versions < 2.6.0
22
+
23
+ ## [0.1.0] - 2020-12-16
24
+
25
+ ### Added
26
+
27
+ - YARD-based gem documentation
28
+
29
+ ### Changed
30
+
31
+ - **Breaking**: The Rack::ECG initializer now uses named options, instead of an options hash.
32
+
33
+ If you manually initialized an instance, you may need to use the `**` operator to pass these options. (e.g. `Rack::ECG.new(nil, **options)`)
34
+
35
+ ### Removed
36
+
37
+ - **Breaking:** Dropped support for Ruby versions < 2.5.0
38
+
39
+ ## [0.0.5] - 2017-05-12
40
+
41
+ ### Added
42
+
43
+ - A new `sequel` check (#8), which checks if the Sequel database connection is active.
44
+
45
+ ## [0.0.4] - 2017-05-04
46
+
47
+ ### Added
48
+
49
+ - A new `active_record` check (#7), which checks if the ActiveRecord connection is active.
50
+ - A new `redis` check (#7), which checks if the Redis connection is active.
51
+
52
+ ## [0.0.3] - 2017-02-13
53
+
54
+ ### Added
55
+
56
+ - Accept a `hook` in configuration, which is run when all check results have been gathered (#6)
57
+
58
+ ### Fixed
59
+
60
+ - Resolved an issue with the migration version check and MySQL connections (#3)
61
+
62
+ ## [0.0.2] - 2015-06-17
63
+
64
+ ### Added
65
+
66
+ - Support running Rack::ECG as a standalone application
67
+ - Support adding checks via the `CheckRegistry`
68
+
69
+ ## [0.0.1] - 2015-04-09
70
+
71
+ ### Added
72
+
73
+ - Base middleware to use in Rails or Rack apps
74
+ - `git_revision` check to return the current git revision
75
+ - `migration_version` check to return the current ActiveRecord migration version
76
+
77
+ [Unreleased]: https://github.com/envato/rack-ecg/compare/v0.2.0...HEAD
78
+ [0.2.0]: https://github.com/envato/rack-ecg/compare/v0.1.0...v0.2.0
79
+ [0.1.0]: https://github.com/envato/rack-ecg/compare/v0.0.5...v0.1.0
80
+ [0.0.5]: https://github.com/envato/rack-ecg/compare/v0.0.4...v0.0.5
81
+ [0.0.4]: https://github.com/envato/rack-ecg/compare/v0.0.3...v0.0.4
82
+ [0.0.3]: https://github.com/envato/rack-ecg/compare/v0.0.2...v0.0.3
83
+ [0.0.2]: https://github.com/envato/rack-ecg/compare/v0.0.1...v0.0.2
84
+ [0.0.1]: https://github.com/envato/rack-ecg/releases/tag/v0.0.1
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in rack-ecg.gemspec
4
6
  gemspec
data/README.md CHANGED
@@ -1,21 +1,23 @@
1
1
  # Rack::ECG
2
2
 
3
- An easy to configure Rack middleware for Ruby web apps to provide a simple
4
- health check endpoint that tells you vital life signs about your app. All
5
- without the boilerplate service checking code you've written 10 times before.
3
+ [![Gem version](https://img.shields.io/gem/v/rack-ecg)][gem-page] [![Rubydoc](https://img.shields.io/badge/docs-rubydoc-success)][rubydoc]
6
4
 
7
- (it's ECG as in electrocardiogram - as in the machine that monitors how your
8
- heart works)
5
+ Rack middleware for Ruby web apps, providing a simple and extensible health
6
+ check endpoint, with minimal configuration.
7
+
8
+ > Electrocardiogram (ECG): A recording of the electrical activity of the heart.
9
9
 
10
10
  ## Features
11
- - simple 1 line to drop into your `config.ru` or `config/application.rb` file to
12
- set up
11
+
12
+ - Start with a single line in your `config.ru` or `config/application.rb` file.
13
13
  - reports git revision status
14
14
  - reports ActiveRecord migration schema version
15
15
  - reports errors if any check can't be executed for whatever reason
16
16
  - JSON output
17
17
 
18
- ## Development Status [![travis ci build](https://api.travis-ci.org/envato/rack-ecg.svg)](https://travis-ci.org/envato/rack-ecg)
18
+ ## Development Status
19
+
20
+ [![Build Status](https://github.com/envato/rack-ecg/workflows/test/badge.svg?branch=main)](https://github.com/envato/rack-ecg/actions?query=branch%3Amain)
19
21
 
20
22
  `Rack::ECG` is extracted from production code in use at
21
23
  [Envato](http://envato.com). However, it is undergoing early development, and
@@ -23,23 +25,15 @@ APIs and features are almost certain to be in flux.
23
25
 
24
26
  ## Getting Started
25
27
 
26
- Add this line to your application's Gemfile:
28
+ Add this to your application's `Gemfile`:
27
29
 
28
30
  ```ruby
29
- gem 'rack-ecg'
31
+ gem 'rack-ecg', '~> 0.2.0`
30
32
  ```
31
33
 
32
- And then execute:
33
-
34
- $ bundle
35
-
36
- Or install it yourself as:
37
-
38
- $ gem install rack-ecg
34
+ Then run `bundle install`.
39
35
 
40
- ### Rails
41
-
42
- In Rails you can add `Rack::ECG` to your `config/application.rb` as a middleware
36
+ In Rails you can add `Rack::ECG` to your `config/application.rb` as a middleware:
43
37
 
44
38
  ```ruby
45
39
  # config/application.rb
@@ -48,9 +42,7 @@ config.middleware.use Rack::ECG
48
42
  # ...
49
43
  ```
50
44
 
51
- ### Rack
52
-
53
- In Rack apps, you can add `Rack::ECG` to your `config.ru`
45
+ In Rack apps, you can add `Rack::ECG` to your `config.ru`:
54
46
 
55
47
  ```ruby
56
48
  # config.ru
@@ -61,6 +53,8 @@ use Rack::ECG
61
53
  run MyRackApp
62
54
  ```
63
55
 
56
+ ## Usage
57
+
64
58
  You can now hit your app and get a basic health check response from `Rack::ECG`
65
59
 
66
60
  ```
@@ -79,39 +73,149 @@ status if any of the checks fail.
79
73
 
80
74
  ## Configuration
81
75
 
82
- There are options that can be passed to `use Rack::ECG` to customise how it
83
- works.
76
+ There are options that can be passed to `use Rack::ECG` to customise how it works.
84
77
 
85
- ### `checks`
86
- Out of the box `Rack::ECG` doesn't do much and just checks that
87
- HTTP responses can be returned. There are a number of built in checks that
88
- `Rack::ECG` can be told to do (more to come)
89
- - `:git_revision` - this assumes your code is deployed via git and exists in a
90
- git repo, and that the `git` command can access it
91
- - `:migration_version` - this assumes you are using ActiveRecord migrations. It
92
- queries the `schema_versions` table and tells you what version the database is
93
- at.
78
+ ### Checks
94
79
 
95
- So using `git_revision` and `migration_version` would look like:
80
+ By default, `Rack::ECG` indicates that the service is reponsive via a `http` check. Additional checks are included in this gem, and can be enabled by passing their configuration to the `checks` parameter. To enable a check, add its name, and optionally configuration, to the `checks` array:
96
81
 
97
82
  ```ruby
98
- use Rack::ECG, checks: [:git_revision, :migration_version]
83
+ use Rack::ECG, checks: [
84
+ # no configuration required, or allowed
85
+ :http,
86
+ # passing configuration options
87
+ [:static, { name: "app", value: "my-cool-app" }],
88
+ # some checks can be used multiple times
89
+ [:static, { name: "env", value: Rails.env }],
90
+ ]
99
91
  ```
100
92
 
93
+ #### `active_record`
94
+
95
+ Requires a configured ActiveRecord connection. Does not support configuration. Indicates whether the connection to the default database is currently open. On success, returns something in the following format:
96
+
97
+ ```json
98
+ {
99
+ "active_record": {
100
+ "status": "ok",
101
+ "value": true
102
+ }
103
+ }
101
104
  ```
102
- $ curl http://localhost:9292/_ecg
105
+
106
+ #### `error`
107
+
108
+ Does not support configuration. Always returns the following:
109
+
110
+ ```json
111
+ {
112
+ "error": {
113
+ "status": "error",
114
+ "value": "PC LOAD ERROR"
115
+ }
116
+ }
117
+ ```
118
+
119
+ #### `git_revision`
120
+
121
+ **Deprecated**: will be removed in version 1.0.0. [See the GitRevision Check Replacement example](./examples/git_revision_check_replacement.ru), which uses the `static` check to memoize the value.
122
+
123
+ Requires the `git` executable on path, and that the application's working directory is within a Git repository. Does not support configuration. On success, returns something in the following format:
124
+
125
+ ```json
126
+ {
127
+ "git_revision": {
128
+ "status": "ok",
129
+ "value": "dc840f9d5563e6e5a8b34da29c298764e3046039"
130
+ }
131
+ }
132
+ ```
133
+
134
+ #### `http`
135
+
136
+ Automatically included, and does not support configuration. Always returns the following:
137
+
138
+ ```json
103
139
  {
104
140
  "http": {
105
141
  "status": "ok",
106
142
  "value": "online"
107
- },
108
- "git_revision": {
109
- "status": "ok",
110
- "value": "fb16e2c3b88af671c42880e6977bba34d7b05ba6\n"
111
- },
143
+ }
144
+ }
145
+ ```
146
+
147
+ #### `migration_version`
148
+
149
+ Requires a configured ActiveRecord connection, and that ActiveRecord migrations are in use. Does not support configuration. Queries the `schema_versions` table on the default database to report the current migration version. On success, returns something in the following format:
150
+
151
+ ```json
152
+ {
112
153
  "migration_version": {
113
154
  "status": "ok",
114
- "value": "20150319050250"
155
+ "value": "20210506024055"
156
+ }
157
+ }
158
+ ```
159
+
160
+ #### `redis`
161
+
162
+ Requires the Redis gem. Requires configuration, an instance of a Redis client. Indicates whether the Redis client passed in is currently connected to the Redis database. On success, returns something in the following format:
163
+
164
+ ```json
165
+ {
166
+ "redis": {
167
+ "status": "ok",
168
+ "value": true
169
+ }
170
+ }
171
+ ```
172
+
173
+ #### `sequel`
174
+
175
+ Requires the Sequel gem. Requires configuration, and can be configured multiple times. Indicates whether a (new) connection can be established to the configured Sequel database.
176
+
177
+ Given the following configuration:
178
+
179
+ ```ruby
180
+ {
181
+ connection: "sqlite://events.db",
182
+ name: "events", # must be unique per sequel check
183
+ }
184
+ ```
185
+
186
+ Returns the something in the following format on success:
187
+
188
+ ```json
189
+ {
190
+ "sequel_events": {
191
+ "status": "ok",
192
+ "value": true
193
+ }
194
+ }
195
+ ```
196
+
197
+ #### `static`
198
+
199
+ Returns the same value every time. Requires configuration, and can be configured multiple times.
200
+
201
+ Given the following configuration:
202
+
203
+ ```ruby
204
+ {
205
+ name: "image_build_url", # must be unique per static check
206
+ success: true, # default value
207
+ status: Rack::ECG::Check::Status::OK, # optional, overrides `success`
208
+ value: ENV["IMAGE_BUILD_URL"],
209
+ }
210
+ ```
211
+
212
+ Returns the something in the following format:
213
+
214
+ ```json
215
+ {
216
+ "image_build_url": {
217
+ "status": "ok",
218
+ "value": "https://example.com/pipelines/my-cool-app/builds/1234"
115
219
  }
116
220
  }
117
221
  ```
@@ -125,11 +229,23 @@ a different path by setting the `at` option. e.g.
125
229
  use Rack::ECG, at: "/health_check"
126
230
  ```
127
231
 
128
- More examples are provided in [/examples](https://github.com/envato/rack-ecg/tree/master/examples)
232
+ ### `hook`
233
+
234
+ The `hook` option takes a `Proc` or equivalent, and calls it after the checks
235
+ have run, but before the response is complete.
236
+
237
+ ```ruby
238
+ use Rack::ECG, hook: Proc.new { |success, _checks| puts "Is healthy? #{success}" }
239
+ ```
240
+
241
+ - `success`: whether the response will indicate success
242
+ - `checks`: an array of the check names and values
243
+
244
+ More examples are provided in [/examples](https://github.com/envato/rack-ecg/tree/main/examples)
129
245
 
130
246
  ## Requirements
131
- - Ruby >= 1.9.3 (this may be increased to Ruby >= 2.0 if it makes sense to use
132
- Ruby 2.0 features)
247
+
248
+ - Ruby >= 2.6
133
249
  - Rack
134
250
  - To use optional `git_revision` check, your deployed code needs to be in a git repo, and
135
251
  `git` command must be accessible on the server
@@ -145,24 +261,24 @@ migrations stored in `schema_versions` table
145
261
 
146
262
  ## Maintainers
147
263
 
148
- - [Tao Guo](https://github.com/taoza)
149
- - [Warren Seen](https://github.com/warrenseen)
264
+ - [Liam Dawson](https://github.com/liamdawson)
150
265
 
151
- ## Authors
266
+ ## Contributors
152
267
 
268
+ - [Tao Guo](https://github.com/taoza)
153
269
  - [Julian Doherty](https://github.com/madlep)
154
270
  - [Warren Seen](https://github.com/warrenseen)
155
271
 
156
272
  ## License
157
273
 
158
274
  `Rack::ECG` uses MIT license. See
159
- [`LICENSE.txt`](https://github.com/envato/rack-ecg/blob/master/LICENSE.txt) for
275
+ [`LICENSE.txt`](https://github.com/envato/rack-ecg/blob/main/LICENSE.txt) for
160
276
  details.
161
277
 
162
278
  ## Code of conduct
163
279
 
164
280
  We welcome contribution from everyone. Read more about it in
165
- [`CODE_OF_CONDUCT.md`](https://github.com/envato/rack-ecg/blob/master/CODE_OF_CONDUCT.md)
281
+ [`CODE_OF_CONDUCT.md`](https://github.com/envato/rack-ecg/blob/main/CODE_OF_CONDUCT.md)
166
282
 
167
283
  ## Contributing
168
284
 
@@ -178,7 +294,7 @@ For larger new features: Do everything as above, but first also make contact wit
178
294
 
179
295
  ## About
180
296
 
181
- This project is maintained by the [Envato engineering team][webuild] and funded by [Envato][envato].
297
+ This project is maintained by the [Envato engineering team][webuild] and funded by [Envato][envato].
182
298
 
183
299
  [<img src="http://opensource.envato.com/images/envato-oss-readme-logo.png" alt="Envato logo">][envato]
184
300
 
@@ -188,3 +304,5 @@ Encouraging the use and creation of open source software is one of the ways we s
188
304
  [envato]: https://envato.com?utm_source=github
189
305
  [oss]: http://opensource.envato.com//?utm_source=github
190
306
  [careers]: http://careers.envato.com/?utm_source=github
307
+ [gem-page]: https://rubygems.org/gems/rack-ecg
308
+ [rubydoc]: https://www.rubydoc.info/gems/rack-ecg/
data/Rakefile CHANGED
@@ -1,7 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
 
3
- require 'rspec/core/rake_task'
5
+ require "rspec/core/rake_task"
6
+ require "rubocop/rake_task"
7
+ require "yard"
4
8
 
5
9
  RSpec::Core::RakeTask.new(:spec)
10
+ RuboCop::RakeTask.new(:rubocop)
11
+ YARD::Rake::YardocTask.new
12
+
13
+ task(default: [:rubocop, :spec, :yard])
6
14
 
7
- task :default => :spec
15
+ task(:watch_docs) do
16
+ sh "yard server --reload"
17
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "rack-ecg"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,18 @@
1
+ # for running tests across different versions locally
2
+
3
+ version: "3"
4
+ services:
5
+ ruby30: &ruby30
6
+ image: ruby:3.0
7
+ volumes:
8
+ - ./:/app
9
+ command: bash -c 'gem update --system && cd /app && { ! [ -f Gemfile.lock ] || rm Gemfile.lock; } && bundle install && bundle exec rake'
10
+ ruby27:
11
+ <<: *ruby30
12
+ image: ruby:2.7
13
+ ruby26:
14
+ <<: *ruby30
15
+ image: ruby:2.6
16
+ ruby25:
17
+ <<: *ruby30
18
+ image: ruby:2.5
data/examples/basic.ru CHANGED
@@ -1,5 +1,7 @@
1
- require 'rack/ecg'
1
+ # frozen_string_literal: true
2
2
 
3
- use Rack::ECG
3
+ require "rack/ecg"
4
4
 
5
- run -> (env) { [200, {}, ["Hello, World"]] }
5
+ use(Rack::ECG)
6
+
7
+ run(->(_env) { [200, {}, ["Hello, World"]] })
data/examples/checks.ru CHANGED
@@ -1,5 +1,7 @@
1
- require 'rack/ecg'
1
+ # frozen_string_literal: true
2
2
 
3
- use Rack::ECG, checks: [:git_revision, :migration_version]
3
+ require "rack/ecg"
4
4
 
5
- run -> (env) { [200, {}, ["Hello, World"]] }
5
+ use(Rack::ECG, checks: [:git_revision, :migration_version])
6
+
7
+ run(->(_env) { [200, {}, ["Hello, World"]] })
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rack/ecg"
4
+
5
+ # This example behaves just like the deprecated GitRevision check, except that the value is memoized.
6
+ # i.e. "Fetching the git revision" shouldn't show up for every `GET /_ecg` request.
7
+ #
8
+ # Also consider writing the git revision to a file, or storing it in an environment variable, so it can found more
9
+ # efficiently and with fewer dependencies.
10
+
11
+ def git_revision
12
+ puts "Fetching the git revision"
13
+
14
+ _stdin, stdout, stderr, wait_thread = Open3.popen3("git rev-parse HEAD")
15
+
16
+ success = wait_thread.value.success?
17
+
18
+ status = success ? Rack::ECG::Check::Status::OK : Rack::ECG::Check::Status::ERROR
19
+
20
+ value = success ? stdout.read : stderr.read
21
+ value = value.strip
22
+
23
+ { name: :git_revision, status: status, value: value }
24
+ end
25
+
26
+ use(Rack::ECG, { checks: [[:static, git_revision]] })
27
+
28
+ run(->(_env) { [200, {}, ["Hello, World"]] })
data/examples/hook.ru ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rack/ecg"
4
+
5
+ log_check_results = proc do |success, checks|
6
+ next if success
7
+
8
+ checks.each do |check_name, check_status|
9
+ next unless check_status[:status] == "error"
10
+
11
+ puts "Check #{check_name} failed: #{check_status[:value]}"
12
+ end
13
+ end
14
+
15
+ use(Rack::ECG, checks: [:git_revision, :migration_version], hook: log_check_results)
16
+
17
+ run(->(_env) { [200, {}, ["Hello, World"]] })
@@ -1,5 +1,7 @@
1
- require 'rack/ecg'
1
+ # frozen_string_literal: true
2
2
 
3
- use Rack::ECG, at: "/health_check"
3
+ require "rack/ecg"
4
4
 
5
- run -> (env) { [200, {}, ["Hello, World"]] }
5
+ use(Rack::ECG, at: "/health_check")
6
+
7
+ run(->(_env) { [200, {}, ["Hello, World"]] })
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rack/ecg"
4
+ require "sequel"
5
+ require "sqlite3"
6
+
7
+ use(Rack::ECG, checks: [
8
+ :http,
9
+ [:sequel, { connection: "sqlite://events.db", name: "events" }],
10
+ [:sequel, { connection: "sqlite://projections.db", name: "projections" }],
11
+ ])
12
+
13
+ run(->(_env) { [200, {}, ["Hello, World"]] })
@@ -1,3 +1,5 @@
1
- require 'rack/ecg'
1
+ # frozen_string_literal: true
2
2
 
3
- run Rack::ECG.new
3
+ require "rack/ecg"
4
+
5
+ run(Rack::ECG.new)