linqueta / rails-healthcheck

A simple way to configure a healthcheck route for a Rails application
MIT License
136 stars 10 forks source link

Make health check autodetectable. #77

Open rubys opened 1 year ago

rubys commented 1 year ago

Background: Rails 7.1 will be adding health checks. I work for Fly.io as a Rails Speciality and would like to make Fly.io automatically detect the presence of health checks and pre-configure applications to enable these health checks if I can detect them. The problem is that health checks can vary on paths and implementation, so I'm proposing the following way to detect checks:

bin/rails runner "p Rails.application.routes.url_helpers.rails_health_check_path"

This pull request will add as: :rails_healh_check to the route. Additionally the generator will comment out any Rails 7.1 health check that might be present.

See also:

rubys commented 1 year ago

More background on this request: https://fly.io/ruby-dispatch/health-checks/

linqueta commented 1 year ago

Hey @rubys , I did some tests using your PR as reference, I thought great the idea but the statement comment_lines isn't working on config/routes.rb.

Did you test it in some way?

Having it understood, we can move to commit your PR.