Under the menu item “Node-RED” you will find links to a Node-RED instance if instances have been created for your account or its sub-accounts. This link will take you to the IoT Service Builder. The IoT Service Builder uses Node-RED as a flow-based development tool for visual programming. Node-RED provides a browser-based flow editor that can be used to create JavaScript functions. Elements of applications can be saved or shared for reuse. The runtime environment is based on Node.js. Flows created in Node-RED are stored using JSON. Since its latest release, MQTT nodes can establish properly configured TLS connections.
Node-RED is a powerful visual editor studio that lets you create dashboards and client applications yourself and configure services. This simply involves adding new nodes to its palette.
Embedding your own Node Red instances
You can authenticate and mount your own Node Red instances via niotix if you have the appropriate permissions. The SSL secured NodeRed instance is done using oAuth2. Here’s how to create a new instance:
- Add an IoT Service Builder URL to the account you want the instance to run through, followed by an instance name: https://
DESTINATION/INSTANCE-NAME. In this tutorial, we will use the following example:
https://yourdomain.com/node-red-1 - Click the “Save” button () and add an appropriate service to the Docker Compose file, as in the example below.
- Copy the “OAUTH settings” that appear into the newly added service. These will only appear if you have the appropriate admin permission.
- Adjust the timezone:
node-red-1: image: registry.gitlab.com/digimondo-samples/niotix-node-red/docker-niotix-node-red:oauth
volumes:
* ./data/node-red-1:/data
restart: always
user: "0"
environment:
* TZ=Europe/Berlin
* VIRTUAL_HOST=yourdomain.com
* VIRTUAL_PATH=/node-red-1
* LETSENCRYPT_HOST=yourdomain.com
* LETSENCRYPT_EMAIL=support@yourdomain.com
* OAUTH_CLIENT_ID=xxxxxxxx-477c-4b34-yyyy-2ecdca47bb02
* OAUTH_CLIENT_SECRET=xxxxxxxx-8ef8-451f-yyyy-65feaebc8ee8
* OAUTH_AUTH_URL=[https://api.niota.io/api/v1/oauth2/authorize](https://api.niota.io/api/v1/oauth2/authorize "https://api.niota.io/api/v1/oauth2/authorize")
* OAUTH_TOKEN_URL=[https://api.niota.io/api/v1/oauth2/token](https://api.niota.io/api/v1/oauth2/token "https://api.niota.io/api/v1/oauth2/token")
* OAUTH_CALLBACK_URL=[https://yourdomain.com/node-red-1/auth/strategy/callback](https://yourdomain.com/node-red-1/auth/strategy/callback "https://yourdomain.com/node-red-1/auth/strategy/callback")
- Create a folder in data named with your instance name, e.g. “node-red-1”.
- Copy settings.js there and don’t change it anymore.
Important: To use the single sign on functionality it is needed to clear your cookies before logging in. Chrome: Open “Developer Tools” and choose tab “Application”. In the section “Storage” choose “Cookies” and do a right click on the corresponding cookie (e.g. “https://flow.niota.io/“ - depends on domain setup of your instance). Select “clear” and sign in with niota again. Firefox: Open “Web developer tools” and choose tab “Storage”. Choose “Cookies” and do a right click on the corresponding cookie (e.g. “https://flow.niota.io/“ - depends on domain setup of your instance). Select “Delete all” and sign in with niota again.