Database-aware /healthz with opt-in DB connectivity check

About two weeks ago I ran into an issue where my self-hosted Atuin instance was reporting healthy in my Uptime Kuma hitting the /healthz endpoint. But come to find out my atuin sync was failing because my Postgres container had some how been removed from the docker network. So, the Postgres container was running, but the Atuin container couldn’t reach it. I sent a curl -s https://atuin.domain.dev/healthz request and it returned a 200 {"status":"healthy"}. Come to find out the health check only checks to see if the HTTP server is running and routing traffic and does not check to see if the database is reachable.

I’ve started the conversation here and opened a PR here.