Watchdog
Heptapod cannot tell you when Heptapod itself is down. A watchdog is a service outside your server that alerts you when the heartbeat stops or the health URL fails.
What Heptapod reports itself
Section titled “What Heptapod reports itself”Heptapod opens the system issue “No check has finished for more than ten minutes” when checks are due but no result arrives. Owners receive it, and Admins who turned on system mail.
- The scheduler evaluates system issues every five minutes and sends this mail from your server. When the scheduler stops, the dispatcher evaluates instead.
- When the server, the database or the mail connection is down, this mail cannot leave.
- A watchdog covers the server and the database, because it alerts when a signal stops arriving.
- A watchdog does not see a failing mail connection: the heartbeat and
/upstay healthy.
Signals
Section titled “Signals”Heptapod gives a watchdog two signals: a heartbeat it sends and a health URL the watchdog polls.
Heartbeat
Section titled “Heartbeat”Set INSTANCE_HEARTBEAT_URL in the server environment, then recreate the scheduler and app containers. The scheduler then sends a GET request to that URL every minute.
- The request adds one query parameter,
check_age_seconds. Keep a secret token in the path or query of the URL. - The URL must use
https://. Plainhttp://works only for a host that the instance Owner lists inHEPTAPOD_DELIVERY_PRIVATE_HOSTS, because the URL itself is the secret. - The request goes only to a public address, unless
HEPTAPOD_DELIVERY_PRIVATE_HOSTSlists the host: a watchdog on a private network needs that entry, also withhttps://. - The request goes directly to the watchdog, not through an
HTTP_PROXY/HTTPS_PROXYegress proxy. - The request does not follow redirects and times out after 10 seconds. A response other than 2xx, including a redirect, counts as a failed heartbeat.
- An empty value turns the heartbeat off.
- Heptapod needs its database to build the request. When the database is down, no heartbeat is sent.
- During an upgrade or a rollback, the scheduler stops and sends no heartbeat. Expect a watchdog alert when the upgrade takes longer than the watchdog’s grace time.
- Settings → General shows under Watch the watcher whether the heartbeat is configured and when it last succeeded.
A missing heartbeat points to the server, the scheduler, the database or the network between Heptapod and the watchdog.
Check age
Section titled “Check age”check_age_seconds says how long checks have been due without a finished result. Its value is one of:
- An integer: the seconds since the later of the last finished check run and the moment the oldest outstanding check became due. A check is outstanding while it is due or a worker still holds it.
- The literal
null: no result is expected. No enabled check on an active site is due or held, or Heptapod is down for an upgrade (php artisan down).
Checks of a type that is not available on this server, for example Lighthouse without a browser, do not count.
A heartbeat with a growing integer means the scheduler runs, but checks do not finish. A typical cause is a stopped queue worker. Heptapod opens its own system issue above 600 seconds.
Health URL
Section titled “Health URL”/up on your Heptapod address answers with status 200 while the web application serves requests. Any other answer, a timeout or a refused connection is a failure.
/updoes not test the database, the queue worker or the scheduler./upkeeps answering 200 while Heptapod is down for an upgrade, as long as the web container runs.- Settings → General shows the exact URL under Health URL for polling.
A failing /up means the watchdog cannot reach Heptapod’s web application. Visitors on other networks may still reach it. The heartbeat and the health URL fail independently, so watch both.
Choose a watchdog
Section titled “Choose a watchdog”Pick one option. Each one needs an alert channel that does not depend on your Heptapod server.
A dead-man service and an uptime monitor
Section titled “A dead-man service and an uptime monitor”Use two hosted services. A dead-man service alerts when expected pings stop, for example Healthchecks.io.
- Create a check with a period of one minute and a grace time of a few minutes.
- Set its ping URL as
INSTANCE_HEARTBEAT_URL. - Add an uptime monitor for
https://<your Heptapod address>/upin any uptime service.
Result: you get an alert when the heartbeat stops or /up fails. A generic dead-man service ignores check_age_seconds, so it does not alert when checks stop finishing.
Heptapod Sentinel
Section titled “Heptapod Sentinel”Heptapod Sentinel is a ready-made watchdog for one Heptapod instance. It runs on the Cloudflare Workers free tier and understands all three signals.
- It alerts when no heartbeat arrives for five minutes.
- It alerts when
check_age_secondsstays above 900 for two heartbeats in a row. - It polls
/upevery five minutes and alerts after two failures in a row. - It sends alerts to a webhook, ntfy, Brevo or Cloudflare email.
Its README describes the setup and its limits. It is a reference implementation with best-effort support.
Build your own
Section titled “Build your own”Any service outside your server can be a watchdog. It needs to:
- Accept a
GETrequest every minute at a secret URL and answer with 2xx. - Alert when no request arrives for a few minutes.
- Read
check_age_secondsand alert when the integer stays high. Treatnullas healthy. - Request
/upevery few minutes and alert when it fails repeatedly. Treat a redirect as a failure.