rails-healthcheck
rails-healthcheck copied to clipboard
Make health check autodetectable.
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:
- https://github.com/superfly/flyctl/pull/1678
- https://github.com/rails/rails/pull/47217
- https://github.com/rails/rails/pull/46936
More background on this request: https://fly.io/ruby-dispatch/health-checks/
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.