Free n easy healthchecks

Many of us consider the following statements true:

  1. Healthchecks / uptime monitors are mandatory for production apps.
  2. Building and maintaining your own infrastructure for this is tedious and time-draining.
  3. Services like New Relic and Pingdom solve this problem well, but charge money.
  4. For individuals and small organizations, paying money every month, even a small amount, is lame

I have found a low-code solution to this problem: spin up free-forever health checks, of arbitrary complexity (deeply inspecting HTML DOM, for example, not just checking for a HTTP 200 response), by the doing following:

  1. Create a free Slack account
  2. Set up a Slack Workspace you control
  3. Create a (free) Slack app that pushes an alert to your new Slack Workspace when triggered by webhook.
  4. Create a free Cloudflare account.
  5. Write a Cloudflare worker, triggered by a cron, that hits your desired healthcheck endpoint and triggers the Slack app’s webhook when a failures is detected. Example worker script.
  6. Enable the appropriate Slack channel notifications on your mobile device, so that you are alerted according to your preference.

The core of this hack is the fact that you get 100,000 worker (lambda) executions per day on Cloudflare’s free tier. Thank you, Cloudflare!

* I do not benefit from mentioning the above companies; I just like using them