Coder Social home page Coder Social logo

noflo-nodejs's Introduction

NoFlo Node.js runtime environment Build Status

This tool is designed to be used together with the Flowhub development environment for running NoFlo networks on Node.js.

Prepare a project folder

Start by setting up a local NoFlo Node.js project. For example:

$ mkdir my-project
$ cd my-project
$ npm init
$ npm install noflo --save
$ npm install noflo-nodejs --save

Continue by installing whatever NoFlo component libraries you need, for example:

$ npm install noflo-core --save

If you want, this is a great time to push your project to GitHub.

Starting the runtime

Once you have installed the runtime, it is time to start it:

$ node node_modules/.bin/noflo-nodejs --secret some-password

This will start a WebSocket-based NoFlo Runtime server. When started, it will

Copy paste this URL into the browser. The Flowhub IDE will open, and automatically connect to your runtime. To make changes hit 'Edit as Project'. You should be able to see available components and build up your system.

Starting an existing graph

If you want to run an existing graph, you can use the --graph option.

noflo-nodejs --graph graphs/MyMainGraph.json

If you want the process to exit when the network stops, you can pass --batch.

Debugging

noflo-nodejs supports flowtrace allows to trace & store the execution of the FBP program, so you can debug any issues that would occur. Specify --trace to enable tracing.

noflo-nodejs --graph graphs/MyMainGraph.json --trace

If you are running in --batch mode, the file will be dumped to disk when the program terminates. Otherwise you can send the SIGUSR2 to trigger dumping the file to disk.

kill -SIGUSR2 $PID_OF_PROCESS
... Wrote flowtrace to: /tmp/1151020-12063-ami5vq.json

You can now use various flowtrace tools to introspect the data. For instance, you can get a human readable log using flowtrace-show

flowtrace-show /tmp/1151020-12063-ami5vq.json

-> IN repeat CONN
-> IN repeat DATA hello world
-> IN stdout CONN
-> IN stdout DATA hello world
-> IN repeat DISC
-> IN stdout DISC

Host address autodetection

By default noflo-nodejs will attempt to autodetect the public hostname/IP of your system. If this fails, you can specify --host myhostname manually.

Signalling aliveness

noflo-nodejs can optionally ping Flowhub registry periodically to signal aliveness. Enable by specifying --ping true on commandline, or set the envvar NOFLO_RUNTIME_PING=true

Persistent runtime configuration

Settings can also be loaded from a flowhub.json file. By default the configuration will be read from the current working directory, but you can change this by setting the PROJECT_HOME environment variable.

Environment variables and command-line options will override settings specified in config file.

Since the values are often machine and/or user specific, you usually don't want to add this file to version control.

You can either create the file by hand, or by the provided noflo-nodejs-init tool. See the included help information:

$ node node_modules/.bin/noflo-nodejs-init --help

$ node node_modules/.bin/noflo-nodejs-init will initialize flowhub.json with the id of the runtime. The user id comes from Flowhub > User > User Identifier.

You'll need some more info to make the registration useful:

{
  "id": "runtime-id-...",
  "user": "user-id-...",
  "host": "autodetect",
  "port": 3569,
  "label": "my-runtime"
}

To generate this file, you could run:

$ node node_modules/.bin/noflo-nodejs-init --host autodetect --port 3569 --user user-id --label "my-runtime"

In this case the UUID for the runtime (shown as runtime-id in the JSON above) would be autogenerated.

noflo-nodejs's People

Contributors

bergie avatar djdeath avatar ensonic avatar greenkeeper[bot] avatar greenkeeperio-bot avatar jonnor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.