Esecuzione di Node-RED su IBM Cloud

Node-RED is available on the IBM Cloud platform as one of the Starter Kit applications in the catalog. We also offer repositories with Deploy to IBM Cloud enabled.Starter Kit Applications Log in or register for an account at cloud.ibm.com

Navigate to the directory and search for ‘Node-RED’. This will give you the Node-RED Starter. This gives you a Node-RED instance running as a Cloud Foundry application. It also provides a Cloudant database instance and a set of nodes for easy access to various IBM Cloud services.

Click the starter app you want to use, name it and click Create.
After a few minutes, you will be able to access your Node-RED instance: https:// .mybluemix.net Custom Node-RED Application To start customizing a Node-RED instance, you can download the application locally or enable the continuous delivery integration option through the application’s IBM Cloud dashboard page. This will create a git repository on GitHub or IBM DevOps services where you can customize Node-RED, save changes, and automatically update applications in IBM Cloud. Protecting the Editor When you run a Node-RED instance for the first time, you’ll see some options for protecting the editor.To change these options, you can set some environment variables from the IBM Cloud console or the cf command line In the IBM Cloud dashboard, select the Environment Variables page for your application

Add the required user-defined variables:
NODE_RED_USERNAME – Protect the editor’s username
NODE_RED_PASSWORD – password to protect the editor
NODE_RED_GUEST_ACCESS – Set to true to allow anonymous users read-only access to the editor

Click Save.
Adding Nodes You can add nodes from the editor. Select the manage palette option from the editor’s drop-down menu. Alternatively, you can edit your application’s package.json file and add the required node module dependencies in that section. The format is: “node-red-node-package-name”:”xxx” where xxx is the desired version number. Upgrading the version of Node-RED Your application’s package.json is set to get the latest stable version of Node-RED. To trigger an upgrade once a new version is available:
Applications running in IBM Cloud’s Cloud Foundry space maintain a cache directory for each node application to store resolved dependencies so that they are not downloaded and installed each time the application is redeployed. To update dependencies, including versions of node-RED, this cache must be disabled. Set the NODE_MODULES_CACHE environment variable to false. You can do this on your application’s IBM Cloud console page (Runtime -> Environment Variables) or by using the cf command line:
cf set-env [APPLICATION_NAME] NODE_MODULES_CACHE false

Trigger a restart of your application. This cannot be done using the IBM Cloud console, so the cf command line should be used:
cf restage [APPLICATION_NAME]

If you are upgrading to Node-RED 0.20 or higher, you must ensure that your application is running on Node.js 10 or higher. To do this, edit your application package.json file – see below to learn how to edit the file. If the engines property is not currently set, update it to be. 10.x
In order to edit this file, you must enable the continuous delivery integration option through the application’s IBM Cloud dashboard page. This will create a git repository on GitHub or IBM DevOps services where you can edit files, save changes, and automatically update applications in IBM Cloud. Changing Static Web Content Your instance’s login page is served by the application’s static content. This can be replaced with whatever you want in the public directory. If you want to remove static web content and serve the flow editor from the root path, delete the httpStatic and httpAdminRoot entries in the file bluemix-settings.js. Deploy to IBM Cloud Deploy To IBM Cloud enabled repositories allow you to create your own custom Node-RED applications and then deploy them to IBM Cloud with just a few clicks. You can try it out now by clicking here: When you click the button, you’ll be taken to the IBM Cloud where you can choose a name for your application, at which point the platform takes over, fetching the code from that repository and Deploy. It will automatically create an instance of the Cloudant service, call it sample-node-red-cloudantNoSQLDB and bind it to your application. This is where your Node-RED instance will store its data. If you deploy multiple Node-RED instances from this repository, they will share a Cloudant instance. It includes a set of default flows that are automatically deployed when Node-RED is first run. Custom Node-RED repository This repository can be cloned, modified, and reused to allow anyone to create their own Node-RED-based applications that can be quickly deployed to the IBM Cloud. The default flow is stored in defaults named flow.json. The web content obtained when accessing the application URL is stored in the public directory. Additional nodes can be added to the package.json file, and all other Node-RED configuration settings can be found in bluemix-settings.js. If you do clone the repository, make sure to update the README.md file to Deploy to IBM Cloud button points to your repository. If you want to change the name of the Cloudant instance you create, the memory allocated to your application, or other deployment-time options, review the manifest.yml.

Parole chiave: Gateway LoRa

Contatto