Discourse-health-check: one-shot CLI overview of your Discourse server

A small bash script I created for my own forum that gives a one-shot health overview of Discourse server. Sharing for anyone who finds this type of quick overview useful.

Checks system resources: Docker, Discourse services (Postgres, Redis, Nginx, Unicorn, Sidekiq), backup freshness, TLS, and security basics. Ends with a pass / warning / critical summary and an exit code suitable for cron.

Install

curl -O https://raw.githubusercontent.com/haydenjames/discourse-health-check/main/discourse-health-check.sh
chmod +x discourse-health-check.sh
sudo ./discourse-health-check.sh

Source, options, and a cron example in the README:

7 likes

Discourse doesn’t run Puma.

3 likes

Unicorn. Fixed thank you.

1 like

Pitchfork nowadays!!

2 likes

Nice offering, thanks!

For backups, I’d suggest checking the latest backup to see if it has been read since it was written. That’s a proxy, for checking if it has been copied offsite. (Or, if not checking the latest, perhaps check all.)

If no backup has been copied offsite for a week, that’s worth warning about.

(I think you can subtract stat -c %Y from stat -c %X or perhaps just compare them. They will be different if the backup file has been read since it was written.)

1 like