npm.io
1.1.0 • Published 2 years agoCLI

@nuskin/health-status-utils

Licence
MIT
Version
1.1.0
Deps
2
Size
9 kB
Vulns
1
Weekly
0

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:

Name Description
__mocks__ Contains jest mocks
__tests__ Contains jest tests
src Contains source code
.gitignore List of files and directories for Git to ignore
jest.config.js Configuration options for Jest
jest.util.js Configuration options for Jest
.eslintrc Configuration options for ES Lint
.prettierrc Configuration options for prettier
package.json Contains npm dependencies as well as build scripts
.prettierignore List of files and directories for prettier to ignore
cx.config File needed for common pipeline to pass
yarn.lock Yarn state snapshot
.gitlab-ci.yml CI pipeline configuration
application.yaml Configuration 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'])