.. _feature_healthcheck: Liveness and readiness - $liveness, $readiness ============================================== .. note:: The features described on this page are available in **all** :ref:`Firely Server editions `. Description ----------- It can be useful to check whether Firely Server is still up and running, and ready to handle requests. Either just for notification, or for automatic failover. A prominent use case is to start dependent services only after Firely Server is up and running, e.g. in a docker-compose or in a Helm chart. Firely Server provides two endpoints, each in the form a of a FHIR custom operation, for different purposes: * ``GET /$liveness`` * ``GET /$readiness`` These align - intentionally - with the use of liveness and readiness probes in Kubernetes. The major difference is in the ability to handle requests. Some operations on Firely Server can trigger a long running process during which the server cannot reliably handle requests, see the :ref:`Long running tasks plugin `. If this is the case, the ``$liveness`` operation will return a ``200 OK`` status regardless, indicating the server is up and should not be restarted (that would just delay the long running process). The ``$readiness`` operation however, would return ``423 Locked`` in this case. If no long running processes are active, both operations will have the same output, namely ``200 OK``. If you have assigned different endpoints to different FHIR versions (see :ref:`here `), you can also invoke it on each FHIR version. The result is always the same for all versions that are configured in the server. E.g: .. code-block:: GET /$liveness GET /R3/$liveness GET /R4/$liveness Results ------- The ``$liveness`` operation may return one of these http status codes: #. 200 OK: Firely Server is up and running (but may still be blocked by a long running process). #. 402 Payment Required: The license is expired or otherwise invalid. #. 500 or higher: An unexpected error happened, the server is not running or not reachable (in the latter case the error originates from a component in front of Firely Server). The ``$readiness`` operation may return one of these http status codes: #. 200 OK: Firely Server is up and running and ready to process requests. #. 423 Locked: Firely Server is busy with a long running operation and cannot process requests. This could among others be a :ref:`database migration ` or an :ref:`import of conformance resources `. The response will have an OperationOutcome with additional details. #. 402 Payment Required: The license is expired or otherwise invalid. #. 500 or higher: An unexpected error happened, the server is not running or not reachable (in the latter case the error originates from a component in front of Firely Server). Configuration ------------- Both operations should be configured in the pipeline, see the plugin reference for :ref:`$liveness ` and :ref:`$readiness `. In the default settings this is the case. Both plugins have no further configuration in the :ref:`appsettings `.