amazeeio/healthz-php
Composer 安装命令:
composer create-project amazeeio/healthz-php
包简介
README 文档
README
This is a simple PHP app used to determine the overall health of a site hosted on Lagoon.
As it stands, it relies on Lagoon conventions to determine which services are available and then checks if the services are up.
Configuration
This script should reside in a directory separate from the application that is being hosted.
For instance, the convention is that a webapp is stored in /app - you could store Healthz-php
in /healthz.
location /lagoonhealthz {
root /lagoonhealthz;
rewrite ^/lagoonhealthz$ /lagoonhealthz/index.php;
location ~* \.php(/|$) {
include /etc/nginx/fastcgi.conf;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME /lagoonhealthz/index.php;
fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000;
}
}
Adding this to your nginx configuration will reroute all incoming traffic on /healthz
to our current script.
Setting failure response code
By default, we return an http 500 response code for any failed checks. This can be a potential problem for setups that involve negative caching of errors.
If you would like to have the system return something other than a 500, you can set the environment variable HEALTHZ_PHP_HTTP_FAIL_CODE with the return code.
Extending checks
Checks can be created by implementing AmazeeIO\Health\Check\CheckInterface
which principally does two things.
First, it checks whether the check is actually applicable in the present environment.
For example, to know whether it should be checking the status of the Solr service, the CheckSolr class
will first check whether the environment variable SOLR_PORT is available.
If the CheckInterface::appliesInEnvironment call to any particular check returns true
that check will be registered to run.
Second, all applicable checks are required to return both a result and a status.
The status returns one of STATUS_PASS STATUS_FAIL and STATUS_WARN - These three statuses
really determine the health of the service under test. They're used to determine health of the overall system.
The status of the check as a whole is determined by the most negative applicable check's result.
That is, if any one of the checks return a STATUS_FAIL, the entire check is considered to have failed.
If any one check returns a STATUS_WARN, the entire system check is considered to be in a warning state.
When you have created your checks you register them in the checks.conf.php file.
amazeeio/healthz-php 适用场景与选型建议
amazeeio/healthz-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.14k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 06 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 amazeeio/healthz-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amazeeio/healthz-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2020-06-18