1.0.1 • Published 1 year ago

@nuskin/health-status-utils v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Health Status Library

Purpose

This package provides a series of options for the SREs to monitor the health of our K8s apps:

Install

yarn add @nuskin/health-status-utils

Pre-requisites

Install

yarn add @nuskin/health-status-utils

Project Structure

The folder structure of this app is explained below:

NameDescription
__mocks__Contains jest mocks
__tests__Contains jest tests
srcContains source code
.gitignoreList of files and directories for Git to ignore
jest.config.jsConfiguration options for Jest
jest.util.jsConfiguration options for Jest
.eslintrcConfiguration options for ES Lint
.prettierrcConfiguration options for prettier
package.jsonContains npm dependencies as well as build scripts
.prettierignoreList of files and directories for prettier to ignore
cx.configFile needed for common pipeline to pass
yarn.lockYarn state snapshot
.gitlab-ci.ymlCI pipeline configuration
application.yamlConfiguration file

Running tests using yarn Scripts

yarn test

ESLint

ESLint is a code linter that helps catch minor code quality and style issues.

ESLint rules

All rules are configured through .eslintrc.

Running ESLint

To run ESLint you can call the ESLint task.

yarn lint  // runs only ES lint

Usage

General

When deployed via a Kubernetes (k8s) container your app will also includes k8s probes for liveness and readiness. If you initiate the healthchecks then once your container has spun up it'll automatically start performing liveness checks. Once your app is up and running it is #YOUR JOB# to let the health check know that you are ready using reportReadiness(true) Example 1:

    initHealthCheckSystems(healthCheckOnSig, healthCheckOnShutdown, readinessCallback, livenessCallback)

    reportReadiness(true)
    reportReadiness(false, ['mockErrorReason'])
1.0.1

1 year ago

1.0.0

1 year ago