In a previous post we discussed how cool Node-RED was and how to use its visual programming to map out scriptr.io scripts. Now we want to take it further:  adding scriptr.io scripting to IBM Bluemix® Node-RED.

Step by step process to install a new node on Node-RED in IBM Bluemix®

A wizard will walk you through the quick and easy process.

Let’s start by creating a Node-RED app on Bluemix

  1. Assuming you’ve already registered and are logged in to Bluemix, head to the console and create a new CloudFoundry App. bluemix-create-new
  2. Bluemix will now walk you through a step by step wizard where you will select the application type (web in our case). bluemix-create-web
  3. This provides you with the option to start from scratch or use one of the provided boilerplates (we suggest you start there, there’s a lot of interesting boilerplates that will help you get started and setup quickly). bluemix-browse-boilerplates
  4. Node-RED is one of the popular existing boilerplates. bluemix-select-node-red
  5. Now give your app a nice name and you’re almost ready to go (you still have to wait for the app to be deployed). bluemix-name-your-app
  6. Once deployed and marked as ready, you will be able to click on the provided url (demo-red.eu-gb.mybluemix.net in this case) and see the node-red workspace ready with a new empty flow. You can refer to our previous blog if you’re new to node-red.

Connect it to Git and setup auto-deploy

This sounds like a hassle, but it is as easy as clicking on a few buttons:
bluemix-git-auto
Remember to select “Populate the repo with the starter app package and enable Build & Deploy pipeline”.
This will create a new Git repo on https://hub.jazz.net/docs/git/ (which requires that you register there first if you don’t already have an account), populate it with the boilerplate code for node-red and enable auto-deploy on commit.

This means that every time you push a new resource to your repo, it will be deployed to your app and your app will be reloaded to use the latest code.

Deploy your custom nodes

In our case the custom node is the node-red-contrib-script. To deploy it, go to the Orion repo editor (by clicking on “Edit Code”) and create the new files under the nodes folder: bluemix-orion-explorer

Of course, you have other less GUI-centric options to upload these files. You can checkout your repo using your favorite Git client, modify the file system local and then push back, triggering the auto-deploy.

Or, if you’re proficient enough in cloudfoundry, you can drop all those steps, and create the app from scratch using the cloudfoundry tools to upload your whole node-red project (with all the required extra nodes). But cloudfoundry will be the subject of another post.