CALC has an endpoint at /healthcheck/ which always
returns a 200 OK response of type application/json. The
returned object has the following keys:
-
versionis the version of CALC deployed, e.g.'2.5.1'. -
canonical_urlis the absolute, canonical URL of the/healthcheck/endpoint based on Django's defaultSiteobject. -
request_urlis the absolute URL of the/healthcheck/endpoint based on request headers. -
canonical_url_matches_request_urlis a boolean indicating whethercanonical_urlis equal torequest_url. If this isfalse, then the site is considered to be unhealthy. -
rq_jobsis the number of enqueued jobs waiting to be processed by the [redis queue (RQ)][rq]. -
is_database_synchronizedis a boolean indicating whether all migrations have been run on the database. If this isfalse, the site is considered to be unhealthy. -
postgres_versionis the version of Postgres being used by the database. -
is_everything_okis a boolean indicating whether the server as a whole is healthy. If any of the values described above indicate that the site is unhealthy, then the value ofis_everything_okwill befalse.
For more details on the /healthcheck/ endpoint, see
calc/healthcheck.py.
On production, we've also configured a [New Relic Synthetics][]
monitor to ping /healthcheck/ on a regular basis, so that
administrators are notified if CALC is ever unhealthy.
CALC has a suite of tests in production_tests for checking that the production site is properly configured.
These tests are run nightly as a workflow build in CircleCI.