Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable rails health check in routes #565

Merged
merged 1 commit into from
May 17, 2024
Merged

Conversation

robbevp
Copy link
Member

@robbevp robbevp commented May 12, 2024

This PR adds the default rails health check as an endpoint in the routes. This allows us to setup some kind of uptime monitoring, without calling any of our actual controllers. In theory, we could also have clients (especially those with an audio cahce) check this before making any actual requests for new data.

From the docs:

This endpoint will return a 200 status code if the app has booted with no exceptions, and a 500 status code otherwise.

Example request:

$ curl localhost:3000/api/up --verbose             
*   Trying [::1]:3000...
* Connected to localhost (::1) port 3000
> GET /api/up HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/8.4.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< x-frame-options: SAMEORIGIN
< x-xss-protection: 0
< x-content-type-options: nosniff
< x-permitted-cross-domain-policies: none
< referrer-policy: strict-origin-when-cross-origin
< x-api-version: 0.20.0
< content-type: text/html; charset=utf-8
< vary: Accept, Origin
< etag: W/"7e6c9877b2dec7dfadc43e742246d94d"
< cache-control: max-age=0, private, must-revalidate
< x-request-id: 6b2f8970-cbac-4a8f-a4bc-39174fef2e4b
< x-runtime: 0.019172
< server-timing: start_processing.action_controller;dur=0.01, render_template.action_view;dur=0.01, process_action.action_controller;dur=0.26
< Content-Length: 73
< 
* Connection #0 to host localhost left intact
<!DOCTYPE html><html><body style="background-color: green"></body></html>%     

@robbevp robbevp added the chore Repository or build maintenance label May 12, 2024
@robbevp robbevp requested a review from chvp May 12, 2024 08:30
@robbevp robbevp self-assigned this May 12, 2024
@chvp chvp merged commit d753acc into main May 17, 2024
4 checks passed
@chvp chvp deleted the chore/enable-rails-health-check branch May 17, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Repository or build maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants