NOTICE! This repository has been moved under network monorepo
Main executable for running a broker node in Streamr Network.
The broker node extends the minimal network node provided by the streamr-network library with
- client-facing support for foreign protocols (e.g. HTTP, MQTT) via adapters
- support for long-term persistence of data using Apache Cassandra.
Prerequisites are Node.js 14.x
and npm version >=6.14
.
To install streamr-broker:
npm install streamr-broker --global
It is convenient to run a broker node as part of the full Streamr stack. Check out the streamr-docker-dev tool that can be used to run the full Streamr stack.
If instead you want to run a broker node by itself without Docker, follow the steps below.
First install the package
npm install streamr-broker --global
Then run the command broker with the desired configuration file
broker <configFile>
See folder "configs" for example configurations. To run a simple local broker
broker configs/development-1.env.json
Then run the command tracker with default values
tracker
To delete expired data from storage node run
broker <configFile> --deleteExpired
or
node app.js <configFile> --deleteExpired
Install dependencies:
npm ci
Run the tests:
npm run test
We use eslint for code formatting:
npm run eslint
Code coverage:
npm run coverage
To get all debug messages:
LOG_LEVEL=debug
... or adjust debugging to desired level:
LOG_LEVEL=[debug|info|warn|error]
To disable all logs
NOLOG=true
To regenerate self-signed certificate in ./test/fixtures
run:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 36500 -nodes -subj "/CN=localhost"
Publishing to NPM is automated via GitHub Actions. Follow the steps below to publish.
git checkout master && git pull
- Update version with either
npm version patch
,npm version minor
, ornpm version major
. Use semantic versioning https://semver.org/. Files package.json and package-lock.json will be automatically updated, and an appropriate git commit and tag created. git push --follow-tags
- Wait for GitHub Actions to run tests
- If tests passed, GitHub Actions will publish the new version to NPM
For production version of the Streamr API refer to API Explorer.
- For authentication put private key in the password connection field
- MQTT clients can send plain text, but their payload will be transformed to a JSON object accordingly:
{"mqttPayload":"ORIGINAL_PLAINTEXT_PAYLOAD}
- If private key is not correct, client will receive "Connection refused, bad user name or password" (returnCode: 4)
- If stream is not found, client will receive "Connection refused, not authorized" (returnCode: 5)