The project is in a healthy, maintained state
This gem has been renamed to rails-health-monitor. Please update your Gemfile to use 'rails-health-monitor' instead.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

RailsHealthMonitor

Gem Version Documentation GitHub

A comprehensive health checking gem for Ruby on Rails applications and their dependencies.

🌐 Live Documentation & Demo

Features

  • Rails Version Check: Validates Rails version compatibility
  • Ruby Version Check: Ensures Ruby version is supported
  • Database Connectivity: Tests database connection health
  • Gem Dependencies: Analyzes gem health and outdated packages
  • Security Vulnerabilities: Checks for known security issues
  • HTTP Health Endpoint: Provides /health endpoint for monitoring
  • Rake Tasks: Command-line health checking tools

Installation

Add this line to your application's Gemfile:

gem 'rails-health-monitor'

And then execute:

bundle install

Or install it directly:

gem install rails-health-monitor

Usage

Programmatic Usage

# Run complete health check
results = RailsHealthMonitor.check

# Check specific components
analyzer = RailsHealthMonitor::GemAnalyzer.new
gem_health = analyzer.analyze

Rake Tasks

# Complete health check
rake health:check

# Check gem dependencies only
rake health:gems

# Check database connectivity
rake health:database

HTTP Health Dashboard

The gem automatically adds protected /health endpoints with comprehensive web dashboards:

# Main dashboard (requires authentication)
http://localhost:3000/health

Authentication:

  • Default: username admin, password health123
  • Custom: Set HEALTH_USERNAME and HEALTH_PASSWORD environment variables

Dashboard Features:

  • 🏥 Visual health overview with status indicators
  • 📊 Real-time health score (0-100)
  • 🔧 System information (Rails/Ruby versions)
  • 💾 Database connectivity status
  • 📦 Gem dependencies analysis
  • 🔒 Security vulnerability overview with detailed list
  • 🎯 Priority actions with color-coded urgency
  • 🔄 Auto-refresh every 30 seconds
  • 🔐 Password-protected access

Configuration

The gem works out of the box with minimal configuration. The health middleware is automatically added to your Rails application.

Authentication Configuration

# Set custom credentials (optional)
export HEALTH_USERNAME=your_username
export HEALTH_PASSWORD=your_secure_password

Default credentials:

  • Username: admin
  • Password: health123

Manual Setup Options

Option 1: Middleware Setup (Recommended) Add to config/application.rb:

require 'rails_health_monitor'

module YourAppName
  class Application < Rails::Application
    config.middleware.use RailsHealthMonitor::DashboardMiddleware
  end
end

Option 2: Routes Setup (Alternative) Add to config/routes.rb:

Rails.application.routes.draw do
  get '/health', to: proc { |env|
    results = RailsHealthMonitor.check
    [200, {'Content-Type' => 'application/json'}, [results.to_json]]
  }
end

Then restart your server:

rails server

Troubleshooting

"No route matches [GET] '/health'" Error

If you get this error, the middleware isn't loaded. Try:

  1. Manual middleware setup (see above)
  2. Restart your Rails server:
    rails server
  3. Verify gem installation:
    bundle install
    bundle list | grep rails-health-monitor

Development

After checking out the repo, run:

bundle install

To run tests:

bundle exec rspec

Building and Publishing

To build the gem:

bundle exec rake build

To release a new version:

bundle exec rake release

This will:

  1. Build the gem
  2. Create a git tag for the version
  3. Push the tag to GitHub
  4. Push the gem to RubyGems.org

Links

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

The gem is available as open source under the terms of the MIT License.


Made with ❤️ by Arshdeep Singh