Running Node-Red snap as service

#1

I have a Orange Pi Zero. I loaded Ubuntu Core and then snapped in Mosquitto and Node-Red.

Mosquitto runs automatically as a service but the Node-Red snap is not set up with a service it seems.

How can I set up the Node-Red snap to run as a service that survives Core update mechanism and reboots?

I have done this on raw linux but I am just taking those first steps with snap.

Is there any reason why the Node-Red snap is not setup to run as a service?

Cheers,
A

#2

No idea. How do you make a snap run as a service ?

#3

Looking at the snapcraft.yaml file is already has daemon: simple - so should be enabled as a service already.
Any further clues appreciated.

#4

Ah. Interesting. What port number has it been set to run on please? I was expecting it on the default port.

#5

It uses 1880 by default but will pick up the environment variable PORT if set

#6

Yep, thanks.

I just tried it on my debian laptop with no problems.

I am having problems with the Orange Pi Zero running Ubuntu Core, including it dropping off the network, trouble connecting to store and a range of other nuisances.

I can't even get it to stay connected now to the store to re-snap node-red onto it grrrrrrrrrrrrrr.

When I had node-red loaded previously on the OPiZ, and what led me to ask about services and ports, was I appeared to have to snap run node-red to get an editor on port 1880.

I re-burnt Ubuntu Core image to go through the process again. Once I battle through and get node-red on the OPiZ again I will see if the problem persists.

I am half expecting a problem with the OPiZ at the moment. I have a second one I am going to try. I have previously threw an OPiZ into the bin. I confirmed was fragged after I inserted the expansion board.

If I find anything useful I will report back but I think its less about node-red snap and more about the OPiZ.

Cheers and thanks,

A

#7

Yep.

Confirmed node-red does not auto-start as a service using --beta snap when snapped onto Orange Pi Zero (OPiZ) running Ubuntu Core 16.

I have only snapped in mosquitto and node-red.

After snapping in mosquitto and then node-red, the command "snap services" shows only the mosquitto service running.

Mosquitto snapped in and auto-started and is present running after manual reboot of OPiZ.

"sudo snap start node-red" reports node-red has no services.

"sudo snap run node-red" reports node-red starting up in foreground, after which I can get into editor on x.x.x.x:1880.

"snap get node-red" reports node-red "has no configuration".

"snap try node-red" reports "/home/xxxx/node-red/" not a snap directory.

I will bomb my SD card with debian server (assuming I can snapd that sucker) to try to discount the Ubuntu Core.

Cheers,

A

#8

why -beta ? should be in stable I think

#12

You mean the --stable version dropped into snapcraft.io 3 and only 3 hours ago?

You are welcome, by the way, for my reporting your error 4 days ago.

I assume you reported the problem up the chain to have a stable release put into snapcraft.io 3 hours ago?

If not, thanks if and only if stable fixes the problem.

I will let you know.

#13

Hi - I thought a version was already in stable - I have refreshed it manually with latest version today after finding their build system wasn't working since July (and still isn't). But I can only build the amd64 version - I suspect odroid will need arm instead which indeed they haven't been building either - so yeah no idea what version that is in beta - may indeed not have daemon set on...

Hopefully when they sort out their build system it'll all start working.

So yeah - thanks...

#14

Yep. Now I am stuck with the southern hemisphere doldrums (night time). That is, I cannot connect to servers in northern hemisphere because it's awake (day time) and the servers are being throttled.

I tried armf debian server version for OPiZ but snapd failed to install. So back on Ubuntu CORE 16.

I managed to get mosquitto snapped onto a fresh SD card after 12 attempts to connect. I cannot get a connection to hold for node-red (since it is larger and times out).

Not a node-red problem.

So I am likely not going to test node-red --stable on Ubuntu CORE 16 on OPiZ for 12 hours when I have that first coffee for the day.

Fingers cross.

As mentioned though, --beta installed and ran services fine on snapd installed on amd64 debian 9 stretch so there is likely something funky about the armf/Ubuntu CORE 16 mix.

#15

WHAT THE FRACK?

I have spent 2 days sorting my device since the core update fragged the device, putting it into an endless config loop.

Sorted that, I think.

Went to snap in armf version of node-red to find you have removed the stable AND the edge version, leaving me we the beta version that I reported as not starting its services.

Wouldn't you be better removing the beta as well and not support armf? Or is this behaviour I am reporting only occurring on Orange Pi Zero?

#16

The edge and stable arm versions were even older than the beta and neither included the service so I tidied them up. As soon as Canonical fix their build system I'll rebuild them all, or you can build them locally if you wish.

Generally its much easier to run the default Debian install on an orsngepi

#17

Yep. But snapd utterly does not install on that. Of course snapd installs on Ubuntu server but does not start. I am chasing that down now.

I have installed mqtt ( erlang based emqttd ) and node-red but was keen to try these new containerised approaches. I heard they were hassle free lol.

#18

So, fun fact.

I found that snapd installs and runs on Armbian Bionic (Ubuntu clone) for OPiZ. To that end I was able to snap in mosquitto which set itself up as a service.

And, not surprisingly, a snap of node-red onto Armbian BIonic has the same behaviour on Armbian Bionic as on Ubuntu Core 16 for the OPiZ.

At least I can opt out of the Ubuntu CORE 16 for the OPiZ.