Informing the IBM Community

Node-red on i – 5733OPS not required

0
(0)

Inspired by Andy Youens series of articles on Node and Open Source on IBMi,  I decided to try setting up Node-red on one of my servers. I’ve also got to give credit to a post on the IBM developer site: https://developer.ibm.com/tutorials/i-running-node-red/

The main difference is that where the walk-through uses licensed program 5733OPS I decided to jump in the deep end and try to do without it, ACS has set me up with node.js and the general open source environment so how hard could this be?

One of the main differences to get used to is the folder locations, where the guide points you to:
/QOpenSys/QIBM/ProdData/OPS/NodeX/bin

You’ll now end up in (for example):
/QOpenSys/pkgs/lib/NodeX/bin

When you get to using bcrypt to create a hashed password you’ll also want to point at the alternate location as well.

Another little trick, maybe one that makes perfect sense to those of you more used to IBM i SSH environments, is to make sure you have your path set correctly. Credit to Profound for this tip:

PATH=/QOpenSys/pkgs/bin:$PATH

export PATH

Makes it a lot easier to run the npm command to install node-red, also handy in the script that I’ve taken from the developer article to handle the batch submission of the node-red instance starting:

#!/usr/bin/sh
PATH=/QOpenSys/pkgs/bin:$PATH
export PATH
cd /QOpenSys/pkgs/lib/nodejs10/bin
node-red                         

Not sure I care to admit quite how long I spent banging my head against the wall before I found that article, I was trying to download new nodes and update them and getting nowhere fast.

Once I had this installed and setup I figured I’ll double down on learning new tricks and make use of the IBM Cloud Translator, I have a French customer and je ne comprends pas Francais 🙂

To do this I’ve taken advantage of the node-red-node-watson package that you can download through the “Manage Palette” option:

 

I’ve setup two different flows, one purely for translating their emails to me and another for translating my response back. Just to try and be clever I’m also translating IBMs translation back into English to see if my text still means the same, with mixed results occasionally. In this example my input text is “The order is now unlocked”:

Using these nodes is also really handy for a first-timer like me, in that all of the detailed stuff is in the background and you can just plug & play:

So there you have it, using the knowledge already out there and tweaking it a little to my use-case you have a new convert to node.js on the platform. Sure experts in the field can correct me / point out much simpler ways I could’ve done this, but I figure failing is part of the learning experience!

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *