oat-sa / bundle-health-check
Health Check Bundle
Installs: 25 939
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 42
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=7.2.0
- ext-json: *
- oat-sa/lib-health-check: ^1.1
- psr/log: ^1.1
- symfony/console: ^4.4 || ^5.0 || ^6.0
- symfony/framework-bundle: ^4.4 || ^5.0 || ^6.0
- symfony/yaml: ^4.4 || ^5.0 || ^6.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: 8.5.14
- symfony/browser-kit: ^4.4 || ^5.0
This package is auto-updated.
Last update: 2024-11-17 14:35:48 UTC
README
Symfony bundle for health checks automation, based on health check library
Table of Contents
Installation
$ composer require oat-sa/bundle-health-check
Note: the related flex recipe will enable and auto configure the bundle in your application.
Usage
Available endpoints
This bundle provides by default the following endpoints:
Notes:
- you can check the related openapi documentation for more details
- you can update / disable those routes in the
config/routes/health_check.yaml
file of your application (created by flex recipe)
Ping
The ping endpoint just returns a 200
response with the string pong
as body.
It is just here to ensure your application is correctly installed, up and running.
Health Checker
This bundle will automatically add the tag health_check.checker
to your application services if they implement the CheckerInterface
(they will be auto registered onto the HealthChecker service).
If you want to register a CheckerInterface implementation from 3rd party libraries, you can configure them as following:
# config/services.yaml services: My\Bundle\Checker\SomeChecker: tags: - { name: 'health_check.checker', priority: 2 } My\Bundle\Checker\OtherChecker: tags: - { name: 'health_check.checker', priority: 1 }
Note: you can use the priority
property of the health_check.checker
tag to order them.
Available command
If you prefer to run your checks in CLI mode, this bundle provides by default the following command:
$ bin/console health:check
Notes:
- it runs registered checkers as explained in section above
- it returns
0
in case of overall success, or1
if one (or more than one) checker failed - it displays a summary of all executed checkers and their result
Tests
To run provided tests:
$ vendor/bin/phpunit
Note: see phpunit file for available suites.