riverqueue / riverui

A web interface for River, fast and reliable background jobs in Go.
https://ui.riverqueue.com/
Mozilla Public License 2.0
43 stars 3 forks source link

Add more elaborate health check endpoint that optionally hits the database #72

Closed brandur closed 4 days ago

brandur commented 4 days ago

An alternative to #68 that adds a pair of health check endpoints:

The minimal endpoint just returns an OK response regardless of anything else so it'll return 200 as long as the Go process is up. The complete endpoint runs the additional check of pinging the database, verifying its liveliness as well. This is useful because if the database is totally down then River UI will be totally non-functional, but the minimal endpoint would still return OK, and it's nice to have an alternative that'll return an unhealthy status. Based on something I wrote about last year here [1].

Fixes #67.

[1] https://brandur.org/fragments/database-health-check

bgentry commented 4 days ago

I had the same thoughts when seeing the health check PR so I love that you just went for it, thank you!

brandur commented 4 days ago

Wicked. Thanks!