Skip to content

Health check API

Alex Sherman edited this page Jan 2, 2020 · 2 revisions

Application healthcheck API is available at the /healthcheck base endpoint and responds in plain text and json formats. There is no auth on this endpoint at the moment, but BasicAuth support can be plugged in if needed. This API uses 3 new Setting entries, to create them, execute data migration: rake data_migrations:create_healthcheck_endpoint_settings.

Supported checks are following:

  • Default check, checks if application is running. Text output via healthcheck/default, JSON via healthcheck/default.json. JSON Example: { "default":{ "message":"Application is running", "success":true, "time":2.00001522898674e-06 } }

  • DB check, checks if there is a ActiveRecord database connection. Text output via healthcheck/database, JSON via healthcheck/database.json. JSON example: {"database":{"message":"Schema version: 20191025092912","success":true,"time":0.005994000006467104}} Sets JSON 'success' field to false if DB connection is down.

  • Registry integration check. Text output via healthcheck/registry, JSON output via healthcheck/registry.json. JSON example: {"registry":{"message":"Registry integration is up and running","success":true,"time":1.0232160000596195}} Sets JSON 'success' field to false if registry integration disabled, if no registry URL set or if registry URL esponds with anything other than 200 OK. Possible values for JSON 'message' field:

    • Registry integration disabled
    • No Registry url set
    • Cannot connect to Registry API
    • Registry integration is up and running
  • TARA integration check, checks if GET-request to the TARA url (which is set by Setting key check_tara_url) returns HTTP-status 200 OK. Text output via healthcheck/tara, JSON output via healthcheck/tara.json. JSON example: {"tara":{"message":"Tara check URL is not set","success":false,"time":0.0063569999765604734}} Sets JSON 'success' field to false if there is no TARA URL set or if TARA responds with anything other than 200 OK. Possible values for JSON 'message' field:

    • Tara check URL is not set
    • Tara API is down
    • Tara API is OK and running.
  • Email check, checks if port open on email smtp-server. Host and port are set via Rails config in Rails.application.config.action_mailer.smtp_settings[:address] and Rails.application.config.action_mailer.smtp_settings[:port] respectively. Text output via healthcheck/email, JSON output via healthcheck/email.json. JSON example: {"email":{"message":"Mail server host or port not set","success":false,"time":3.300001844763756e-05}} Sets JSON 'success' field to false if there is no email host or port set or if server does not respond on given port in one second timeout. Possible values for JSON 'message' field:

    • Mail server host or port not set
    • Mail is offline
    • Mail is up and running.
  • SMS integration check, checks if GET-request to the Messente check url (which is set by Setting key check_sms_url) returns HTTP-status 200 OK. Text output via healthcheck/sms, JSON output via healthcheck/sms.json. JSON example: {"sms":{"message":"SMS API is OK","success":true,"time":1.2187489999923855}} Sets JSON 'success' field to false if there is no Messente url set or if this url responds with anything other than 200 OK. Possible values for JSON 'message' field:

    • No SMS check url set
    • SMS API is down
    • SMS API is OK.
  • All checks in one page. Text output via endpoint /healthcheck/all , JSON output via /healthcheck/all.json. Returns combined responses for all checks.
Clone this wiki locally