Pm2, Node-Red and the Rock

Well, this isn’t really about the Rock – but does this scenario mean anything to you? You’ve installed Node-Red on a new setup of Debian… and while it has always worked in the past, it just isn’t having it – you can run manually but attempts to run at powerup fail miserably?

The usual sequence of commands assuming you use PM2 to start up Node-Red is this…. and it is what I use in my scripts. I’m assuming ROOT user here.

cd /root
pm2 start /usr/local/bin/node-red -- -v
pm2 save
pm2 startup

It has worked a treat on countless installations so I’ve never thought twice about it.

So the first shock when installing Node-Red on not a Raspberry Pi but a ROCK – using Debian Jessie was that Node-Red wasn’t there.

which node-red

Well, that solved that – it is stored at /usr/bin/node-red

And that was fine – pm2 start /usr/bin/node-red would start up Node-Red (followed by “pm2 save”) but it STILL would not come up at power-on.

I scoured the web and just as when my Samsung S4 started to fail, I found all sorts of witchcraft out there until finally I came across an item specifically referring to JESSIE.

So here’s the solution that worked for me.

I went into /etc/init.d and DELETED the original pm2 file in there…

and did this..

pm2 startup systemd –u root

If not using root you might want to change that last bit.

And then started Node-Red as before…

pm2 start /usr/bin/node-red

pm2 save

I rebooted the Rock – and…. voila – one working Jessie Node-Red installation.

Why did I bother with all of this? Well, my Raspberry Pi installations are generally way over the top with databases and all sorts… and… it occurred to me that as I save variables in a JSON file, for the likes of my thermometer and control system – I really don’t need all that and I don’t want the worry of database systems wearing out my SD – so an absolute minimal system – Node-Red (without verbose logging), Node-Red-Contrib-UI and not a lot else – I want my Thermostat to work year in, year out, not just a few months!

Did I say UI there?  Until someone else comes up with a fix for the Blynk node being less than 100% reliable, it is going on the back boiler.

For Christmas I received a nice home weather centre, touted a “full colour”. Well, of course it isn’t – it’s just a clear LCD with black lettering and a nice set of coloured imagery in the background and that started me thinking – I wonder if it would be possible to put full-width backdrops into the DIVs in the UI. I’m about to drop Andrei an email Smile


One thought on “Pm2, Node-Red and the Rock

Comments are closed.