https://github.com/flowbased/fbp-protocol-healthcheck
Utility for checking that a FBP runtime is responding
https://github.com/flowbased/fbp-protocol-healthcheck
fbp-protocol health-check
Last synced: 9 months ago
JSON representation
Utility for checking that a FBP runtime is responding
- Host: GitHub
- URL: https://github.com/flowbased/fbp-protocol-healthcheck
- Owner: flowbased
- Created: 2017-10-04T11:38:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-16T21:04:46.000Z (about 3 years ago)
- Last Synced: 2025-04-12T10:41:29.862Z (10 months ago)
- Topics: fbp-protocol, health-check
- Language: JavaScript
- Homepage:
- Size: 85.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
fbp-protocol-healthcheck
========================
Tool for checking whether a [FBP protocol](https://flowbased.github.io/fbp-protocol/) runtime is available and responding. Performs the following actions:
* Connects to the runtime
* Requests runtime capabilities
## Command-line usage
The fbp-protocol-healthcheck tool can be used on the command-line:
```bash
$ fbp-protocol-healthcheck ws://localhost:3569
```
The tool will exit with code 1 if the runtime is not available. This makes the tool usable for example as a [Docker HEALTHCHECK command](https://docs.docker.com/compose/compose-file/#healthcheck):
```dockerfile
HEALTHCHECK --interval=5m --timeout=3s \
CMD ./node_modules/.bin/fbp-protocol-healthcheck ws://127.0.0.1:3569
```
You can also use the command to wait for runtime availability in shell scripts like Travis builds:
```bash
until ./node_modules/.bin/fbp-protocol-healthcheck ws://localhost:3569 || (( count++ >= 10 )); do echo "Waiting for runtime to be ready"; sleep 10; done
```
## Programmatic usage
Install this library, and then:
```javascript
const healthcheck = require('fbp-protocol-healthcheck');
healthcheck('ws://localhost:3569')
.then(() => {
console.log('Runtime is available');
})
.catch((e) => {
console.log(`Runtime not available: ${e.message}`);
});
```