Low commit activity in last 3 years
No release in over a year
Provides a health check API endpoint for rack apps
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 1.1, >= 1.1.0
~> 13.0
~> 3.9, >= 3.9.0
= 1.24.0

Runtime

~> 1.0
 Project Readme

DeepHealthCheck

Gem Version License Build Status Depfu Codecov

A simple Health status API

Getting Started

Install gem

 # Gemfile
 gem 'deep_health_check'

Add middleware before Rails::Rack::Logger to prevent false positive response if other middleware fails when database is down for example ActiveRecord::QueryCache

 # config/application.rb
 config.middleware.insert_after "Rails::Rack::Logger", DeepHealthCheck::MiddlewareHealthCheck

Or for protecting all endpoits with hatauth

# config/application.rb
config.middleware.use DeepHealthCheck::BasicAuthHealthCheck  do |username, password|
  username == "$USER" && password == "$PASS"
end

Protect Health Check endpoints using htauth credentials.

Health check middleware expose the following endpoints

  • /health
  • /db_health
  • /tcp_dependencies_health
    • dependencies must follow the below format and can be coonfigured using envioronment varables such as:
    # TCP_DEPENDENCY_${00..99}=${ip_or_host}:${port}
    TCP_DEPENDENCY_00=127.0.0.0:8080
  • /http_dependencies_health
    • dependencies must be valid http url and can be coonfigured using envioronment varables such as:
    # HTTP_DEPENDENCY_${00..99}=${ip_or_host}:${port}
    HTTP_DEPENDENCY_00=http://127.0.0.0:8080/health

Some of these endpoints provide information about the database and system status. By Default these endpoints are not protected and are accessible publicly. To reduce the security risk introduced by exposing these endpoints, We can protect them using htauth credentials. The following page provide all the necessary steps needed to achieve this task using nginx.

Nginx Configurations