Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gjbianco/node-long-load
A simple node.js app that mocks up an application with a long start time
https://github.com/gjbianco/node-long-load
Last synced: about 1 month ago
JSON representation
A simple node.js app that mocks up an application with a long start time
- Host: GitHub
- URL: https://github.com/gjbianco/node-long-load
- Owner: gjbianco
- Created: 2023-02-15T21:54:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-08T18:39:13.000Z (over 1 year ago)
- Last Synced: 2024-12-09T12:57:40.365Z (about 1 month ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# long-load
A simple node.js app that mocks up an application with a long start time.
Starts up the server after a configurable amount of time by waiting `START_DELAY` milliseconds.## Usage
Intended to build with Podman (though Docker should work fine):
```sh
$ podman build . -t long-load
```Start the container by binding to port 3000 in the container.
```sh
$ podman run --name long-load -p 3000:3000 long-load
```## Options
`long-load` responds to the following environment variables:
* `START_DELAY`: How long to wait (in ms) before "starting".
Defaults to `1000`.* `SHOW_HOST`: Whether to prefix replies with the hostname.
Set to `"true"` to enable (quotes required).
Must have hostname located in UTF-8 encoded file `/etc/hostname`.## Routes
Note that all routes are of type GET for simplicity, even if they really should be something else.
### `/ping`
Replies with 'pong'.
### `/health`
Used as a health probe.
Replies with appropriate error if the app is either sick or still starting.### `/togglesick`
Toggles whether the app is currently healthy or sick.
### `/hiccup?time=10`
Sets the app as sick for `time` seconds.
Defaults to 10 seconds if `time` is not provided.
Overrides any previously toggled health status.### `/destruct`
Kills the process with an error code.
Helps for simulating process crashes.### `/leak`
USE WITH CAUTION.
Consumes a fixed amount of memory (~480MB).### `/unleak`
Releases memory consumed with `/leak`.
Might not work on all systems, as it tries to force a full garbage collection cycle.