Setup Node-Red and Using ACS HTTP Proxy on IBM i

This is part three of my open source posts. In this post I want to cover installing the open source node, Node-Red. As part of this demonstration I will also be highlighting how to use the ACS HTTP Proxy (for IBM i systems that do not have direct access to the Internet). I hope this opens up some possibilities and options for those of you that want to get open source installed on the IBM i but have some hoops to jump through.

Step 1: Connect to the System using SSH

Open IBM i Access Client Solutions (ACS), select your system and click SSH Terminal or open your terminal of choice and type ssh -t username@system. If you need help installing ACS or configuring bash on IBM i please review my previous 2 open source posts.

Step 2: Install Node-Red

In the SSH terminal change your path to the version of Node.js you want to use (if you haven’t installed Node.js you can do this from the Open Source Package Manager in ACS under Available Packages – in my first Open Source post I cover this). I am going to use Node.js 14 in this example.

opnsrcpgmr@IBMIROCKS:~$ cd /QOpenSys/pkgs/lib/nodejs14/bin

Now let’s install Node-Red.

opnsrcpgmr@IBMIROCKS:bin$ npm install -g node-red

When I ran this I received this error:

I received this error because the IBM i I am connected to does not have direct access to the Internet. If your system does have Internet, it would have installed automatically.

Running ACS HTTP Proxy

I first heard about this feature in a webinar from Jesse Gorzinski and Tim Rowe. Since I had a system that didn’t have direct access to the Internet I was excited to hear about this feature. As long as the PC you are using to run ACS has Internet access and your account has enough privileges to run this feature you are good to go (I am still working on what requirements, profile wise, are needed to run it). There is an option in WRKFCNUSG named QIBM_ACS_HTTP_PROXY but since I am running 7.2 of the OS a PTF has not been released yet for this (but I hear that it is coming soon). I found out how to execute this by going to the download files for ACS -> Documentation -> GettingStarted.html (i.e. IBMiAccess_v1r1/Documentation/GettingStarted.html)

This was extracted from the GettingStarted.html document:
9.1.39 HTTPPROXYUI
/PLUGIN=httpproxyui

HTTPPROXYUI will launch a secured HTTP proxy that enables connectivity from an IBM i to the internet via the computer running this proxy. Access to the internet will be enabled from any SSH Terminal session that enters the commands provided by the HTTPPROXYUI plugin.
Note: The SSH Terminal session must be running on the same computer as this proxy.

I took these two slides from Jesse and Tim’s presentation to better illustrate how this works and what governs it.

This is the command that I ran:

--Run the command below and replace user profile with the user profile name of where ACS is installed
** I ran this command in Windows from the Run dialog **
C:\Users\%userprofile%\IBM\ClientSolutions\acsbundle.jar /PLUGIN=httpproxyui

I hit Start, selected the system, and entered credentials and this is what it returns. Proxy information that we can use to connect our SSH session to the Internet.

Now we want to select the proxy info and paste it into our SSH terminal window.

Once we get a $ again we can move forward with the Node-Red install command.

opnsrcpgmr@IBMIROCKS:bin$ npm install -g node-red

If your proxy worked correctly Node-Red should have installed and finished with something that looks like this.

The proxy window looks like this, showing you all of the sites that are being accessed during the install.

Step 3: Launch Node-Red

From your SSH terminal enter the following commands.

** here we can see that the node-red directory has been created
opnsrcpgmr@IBMIROCKS:bin$ ls -al

** this launches Node-Red
opnsrcpgmr@IBMIROCKS:bin$ node-red

Now if we go to a browser and replace 127.0.0.1 with the IP or hostname of the IBM i (in my case: http://10.0.1.50:1880) we will be presented with the Node-Red flow screen.

….and now the possibilities are endless.

I plan to write another post about creating flows and working with Node-Red but that will be for another time. These two nodes are worth checking out and will help you get started if you are wanting to create a dashboard or just to get familiar with Node-Red; node-red-contrib-db2-for-i and node-red-dashboard. The node-red-contrib-db2-for-i node is used to connect to the DB 2 database on IBM i and the node-red-dashboard gives you dashlets to pipe your data to. Check out IBM’s example on Git Hub here.

NOTE: If you had to use the ACS HTTP Proxy feature to install Node-Red you will need to add it before running node-red to installing nodes from the Manage Palette section.

Here I installed the node-red-dashboard node as an example of what you will see (both with and without using the proxy). In the proxy window you will see it making the calls to the registry.npmjs.org site.

An example of a Node-Red Dashboard I am working on to monitor the IBM i:

I started out using IBM’s example to get me started.