A gem to provide health checks for CWDS products. Adds a /system_information
endpoint to perform health checks. Designed to be used for monitoring services
such as New Relic and load balancer checks. It returns JSON defined with in
CWDS development practices.
Add the following line to your Gemfile:
gem 'system_information'
And execute:
bundle
:redis
- checks if Redis is available with a ping:perry
- checks if Perry is available according to its health check
To change the configuration, create a file config/initializers/system_information.rb
and add a config block:
SystemInformation.configure do |config|
config.application = 'CWDS Example System'
config.version = "#{ENV.fetch('APP_VERSION', 'unknown')}"
# Add all needed checks here following a symbol name/url string pattern
config.checks =
[
{ name: :redis, url: "redis://#{ENV.fetch('REDIS_HOST', 'localhost')}:#{ENV.fetch('REDIS_PORT', 6379)}" },
{ name: :perry, url: "#{ENV.fetch('PERRY_BASE_URL', 'http://localhost/perry')}/system-information" }
]
end
The options include:
- config.application - Name of the application
- config.version = Version, optional currently
- config.checks - Add any checks of dependent services following the format in the example
Then add to middleware within config/application.rb
, this should probably be the first Rack middleware loaded ahead of authentication:
config.middleware.use config.middleware.use SystemInformation::SystemInformationMiddleware