A Ruby gem that adds a simple Rails engine to your application to see if it's ready to serve requests. The endpoint and mounting options are configurable using the standard Rails conventions.
This Engine is used by Custom Ink to verify whether their infrastructure is able to serve HTTP requests, and allows Kubernetes to add/remove applications from the load-balancer based upon the results returned.
- Ruby
>= 2.2.0
- Ruby on Rails
>= 3.2.22.5
This Matrix provides an overview on which versions of Ruby are tested against which Ruby on Rails versions. These combinations are guaranteed to work, whereas other combinations might work but are not guaranteed.
Ruby Version | Rails ~> 3.2 |
Rails ~> 4.0 |
Rails ~> 4.1 |
Rails ~> 4.2 |
Rails ~> 5.0 |
Rails ~> 5.1 |
Rails ~> 5.2 |
Rails ~> 6.0 |
Rails ~> 6.1 |
Rails 7.0.0 | Rails ~> 7.0 |
---|---|---|---|---|---|---|---|---|---|---|---|
2.2 |
☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | - | - | - | - |
2.3 |
- | - | - | - | ☑️ | ☑️ | ☑️ | - | - | - | - |
2.4 |
- | - | - | - | ☑️ | ☑️ | ☑️ | - | - | - | - |
2.5 |
- | - | - | - | - | ☑️ | ☑️ | ☑️ | ☑️ | - | - |
2.6 |
- | - | - | - | - | - | ☑️ | ☑️ | ☑️ | - | - |
2.7 |
- | - | - | - | - | - | - | ☑️ | ☑️ | ☑️ | - |
3.0 |
- | - | - | - | - | - | - | - | - | ☑️ | - |
3.1 |
- | - | - | - | - | - | - | - | - | - | ☑️ |
Add this line to your application's Gemfile:
gem 'is_it_ready', github: 'customink/is_it_ready'
And then execute:
% bundle install
Simply mount the engine in your config/routes.rb
and the routes will be available under the given path.
Rails.application.routes.draw do
mount IsItReady::Engine => "/is_it_ready"
end
With the above snippet, the health check will be available under:
Sometimes additional configuration might be required. For example when the endpoint is reserved in your application
or conflicts with another plugin. In this case, creating an initializer under config/initializers/is_it_ready.rb
can help.
# Initializer example to overwrite specific settings for the gem, or to enable certain features.
#
# Overwrite the endpoint that's used for listening to the required calls from the ReadinessProbe.
# Setting this value, changes the second entry to be the path defined here, as well as the path under which
# the application has been mounted:
# * https://your-domain/something_else
# This is more for cosmetic purposes, or when mountain multiple engines under the same endpoint with distinct routes.
::IsItReady.endpoint = '/something_else'
# Setting the bearer token will protect the endpoint with Basic HTTP Auth.
# When this value is set, every incoming request on this endpoint must provided the
# AUTHORIZATION header with a Bearer or Token associated to it.
# Failure to do so, will return in an HTTP UNAUTHORIZED response.
::IsItReady.bearer_token = 'my-secret-token'
- Fork it (https://github.com/customink/is_it_ready/fork).
- Run
bin/setup
to ensure your environment is configured for development. - Run
bin/test
to ensure all tests pass - Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Adding a new feature
- Push to the branch:
git push origin my-new-feature
- Create a new pull request to our repository