Included is an example script app.js that sends random data to a Streamr stream. Also included is package.json for dependency management and devops infastructure code (e.g. Dockerfile).
- Make sure you have node and npm installed.
node -v
should be v8.0.0 or greater.
- Login or register to Streamr
- Grab your user API key from here
- Export the API key with
export API_KEY=<YOUR_API_KEY_FROM_ABOVE>
git clone git@github.com:streamr-dev/data-integration-hackathon.git
npm install
- Open app.js in your IDE/editor of choice
- Edit constant
STREAM_NAME
(use your imagination, stream does not have to exist yet) npm start
- If everything works, you should see
Event sent: {...}
style logging in standard output. - Go to Streams list page, find your newly created Stream, and ensure data is flowing in by looking at the Recent Events tab, e.g.,
- Create a new repository on GitHub (do not initialize with README!)
git remote set-url origin <REPOSITORY_URL>
git push
- Customize
package.json
if needed - Make sure
npm start
runs your script - Make sure all dependencies are present in
package.json
(You can test this by removing node_modules, doingnpm install
and then making surenpm start
starts without errors) - Make sure you have configured the fields of your streams in Streamr.com (use autodetect for convenience).
Deployment requires only pushing into a docker registry 1 . Update travis_scripts/docker-build.sh
export OWNER=<your docker name>
export IMAGE_NAME=<the name of the image>
2 . Set up docker credentials
export DOCKER_USER=<your docker name>
export DOCKER_PASS=<docker password>
3 . Push to registry
./travis_scripts/docker_build.sh
4 . Send an email to mikhael.santos@streamr.com with:
- Docker owner/image_name
- Streamr Api key
- Stream Name
API key is wrong:
Error: Request to https://www.streamr.com/api/v1/streams?name=my-sweet-stream&public=false returned with error code 401: {"code":"NOT_AUTHENTICATED","message":"Not authenticated via token or cookie"}