Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

oslokommune/king-kong-ping-pong

Repository files navigation

King Kong Ping Pong

What

A small service to continously ping itself through an API gateway and notifies a Slack webhook if ping fails after numerous attempts.

Why

A need to test a full integration of Kong arose

Usage

Configuration

The following environment variables can be configured

KONG_API_KEY || required
An API key generated for a consumer in the API gateway.

SLACK_WEBHOOK_URL || required
A Slack webhook URL.

UPSTREAM_URL || required
The URL the service can reach itself on through the API gateway.

AT_CHANNEL || optional FALSE If TRUE, king-kong-ping-pong will notify the channel with @channel on errors

INITIAL_PING_DELAY_MS || optional, default 10000
The delay until the first request to /pong is sent.

PING_TIMEOUT_MS || optional, default 10000
How long to wait for a response from /pong. A timeout accounts for one error.

LOG_LEVEL || optional, default "info"
How noisy the log should be

PING_INTERVAL_MS || optional, default 5000
How often the service should poll itself.

PORT || optional, default 3000
The port the service should be listening on

LOG_PRETTY_PRINT || optional, default FALSE
Decides if the log output should be pretty printed

LOG_SIMPLE_LOGGING || optional, default FALSE
Decides if the log output should be a simpler version of production log. Useful for developing.

ERRORS_BEFORE_NOTIFY || optional, default 3
How many errors can happen before a Slack notification is sent. If value is 3, then if three consecutive requests fail (three errors with no successes in between), the fourth consecutive error will result in a failure report to the Slack webhook.

Docker

  1. make build-image
  2. make run-image

Standalone

  1. make run

Deployment

Deployment is done via the Charts repo