class Rails::HealthController

gracefully.
bad. Ideally, you should design your application to handle those outages
where your application is being restarted due to a third-party service going
Think carefully about what you want to check as it can lead to situations
application specific needs.
"rails/health#show" with your own controller action if you have
dependencies, such as the database or Redis cluster. Replace
NOTE: This endpoint does not reflect the status of all of your application’s
The health check will now be accessible via the /healthz path.
end
get “healthz” => “rails/health#show”, as: :rails_health_check
Rails.application.routes.draw do
"config/routes.rb":
/up, you can configure the path to be anything you’d like in your
While any newly generated Rails applications will have the health check at
in many situations.
health. This health check is designed to be a one-size fits all that will work
wrong, or a load balancer or Kubernetes controller used to determine a pod’s
whether it’s to an uptime monitor that will page an engineer when things go
In production, many applications are required to report their status upstream,
booted with no exceptions, and a 500 status code otherwise.
the /up path. This endpoint will return a 200 status code if the app has
Rails also comes with a built-in health check endpoint that is reachable at
Built-in Health Check Endpoint

def html_status(color:)

def html_status(color:)
  %(<!DOCTYPE html><html><body style="background-color: #{color}"></body></html>).html_safe
end

def render_down

def render_down
  render html: html_status(color: "red"), status: 500
end

def render_up

def render_up
  render html: html_status(color: "green")
end

def show

def show
  render_up
end