rails-healthcheck icon indicating copy to clipboard operation
rails-healthcheck copied to clipboard

Make health check autodetectable.

Open rubys opened this issue 2 years ago • 2 comments
trafficstars

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

rubys avatar Feb 07 '23 19:02 rubys

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

rubys avatar Feb 21 '23 20:02 rubys

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.

linqueta avatar May 08 '23 00:05 linqueta