承接 redmarker/doctor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

redmarker/doctor

Composer 安装命令:

composer require redmarker/doctor

包简介

Red Marker Health Check package

README 文档

README

This is a php-based package for performing health status checks that follow the format found at https://tools.ietf.org/id/draft-inadarei-api-health-check-01.html

"I need a doctor" - Dr. Dre

Just like Dre, you might need a Doctor too.

Installation

composer require redmarker/doctor

Doctor Usage

Create an instance of a Doctor class using a new Examination().

Passing RedMarker\Doctor\Checks\CheckInterface objects to the Doctor will add them to the Doctors examination attribute.

Both the releaseId and serviceId must be set on the RedMarker\Doctor\Doctor() .

The releaseId should be the current git commit hash.

The serviceId should be the containers id.

use ZendDiagnostics\Runner\Runner as Examination;

$doctor = new RedMarker\Doctor\Doctor(Examination $examination);
$doctor->setReleaseId($releaseId);
$doctor->setServiceId($serviceId);

Adding Checks to the Doctor

Pass each Check in an array to the Doctor.

$doctor->addChecks([ 
    new Doctor\Checks\Database()
]);

return $doctor->diagnose();

Output:

{
    "status": "pass",
    "releaseID": "5113e3d0ad8fe3f1ac8393e17432353b194a060f",
    "serviceID": "34ebdffa9cba",
    "details": [
        {
            "database:connection": {
                "componentId": "api",
                "componentType": "datastore",
                "time": "2019-10-01T06:23:35.817073Z",
                "status": "pass"
            }
        }
    ]
}

Laravel Usage

For Laravel usage the below service provider should be registered in config/app.php

RedMarker\Doctor\Providers\Laravel\HealthProvider::class

Setup configuration for Laravel Checks:

/*
|--------------------------------------------------------------------------
| Service Id
|--------------------------------------------------------------------------
|
| Here you may specify the service_id that should be used
| by the health check. The service_id should be the containers id.
|
*/
'service_id' => env('CONTAINER_ID', 'container-id not found'),

/*
|--------------------------------------------------------------------------
| Release Id
|--------------------------------------------------------------------------
|
| Here you may specify the release_id that should be used
| by the health check. The release_id should be the current git hash.
|
*/
'release_id' => env('RELEASE_ID', 'release-id not found'),

/*
|--------------------------------------------------------------------------
| Vendor Folder Location
|--------------------------------------------------------------------------
|
| Here you may specify the location of that vendor folder that.
| This location is only used by the VendorFolder Check.
|
*/
'vendor_folder' => env('APP_ROOT') . '/vendor',

/*
|--------------------------------------------------------------------------
| .Env File Location
|--------------------------------------------------------------------------
|
| Here you may specify the location of the .env file.
| This location is used by the EnvFile Check.
|
*/
'env_file' => env('APP_ROOT') . '/.env',

/*
|--------------------------------------------------------------------------
| HttpResponse Check configurations
|--------------------------------------------------------------------------
|
*/
'services' => [
    'component_name' => [
        'endpoint' => env('API_URL'),
        'jwt' => env('API_JWT'),
        'see_in_response' => [
            'success'
        ]
    ],
]

统计信息

  • 总下载量: 4.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-10-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固