How to use Node-RED deployed with resin.io on a device?


#1

Hi,

after a few (successful) tests with deploying java on a Raspberry using resin.io and an external binary repository, I wanted to try “Node-RED”, the visual programming editor and runner you propose here : https://github.com/resin-io-projects/resin-node-red/

I have a few questions :

  • Why are u using a “node” image instead of the “alpine-node” ? I get it that the “slim” one is not ok, but why not alpine ? Currently, the image is 500 Mo and takes 25 min to download, while my java on alpine was 100 Mo and took about 6 min.

  • After enabling the public resin.io URL on my raspberry, I try to create some simple flow and deploy it, but it keeps saying : “Deploy failed: Not authorized”. I can see a login button in the upper right corner, but the doc says : “username : none, password : none”, so I’d think you don’t have to login by default.

  • Let’s say I define some USERNAME and PASSWORD var, do I have to crypt myself the PASSWORD var ? What would be the accepted crypting method ? (I’ve tried with plain text environment variables defined at application level in resion.io web console, but with no success.)

  • And now Let’s say I just want node-red to be deployed and run a pre-designed flow copied by Dockerfile, is this use case ok ? Do I need to hard code login/password somewhere to enable the flows to start ?

  • And a last one, because I know you do like questions : when Node-RED is loading, it says “Cannot find Pi RPi.GPIO python library” (I’m on Raspberry 2), is there a way to fix this or should it be fixed in ResinOS ?

Thanks for your lights.


Node-Red on BeagleBone
#2

Hey @Tristan107

About your questions:

  1. The current Dockerfile uses “node” image which is Debian based so it won’t work for “alpine-node”. If you want to use Alpine Linux then you need to port the dockerfile template to that distribution.
  2. You shouldn’t define the env var from web console, env vars should be set on resin dashboard or the SDK https://docs.resin.io/management/env-vars/.

For other questions, I think my colleague @curcuz (project maintainer) will be able to help you.


#3

Hi, thanks for your answers, but I’m not sure I understand them :

  1. I have no problem adapting a Dockerfile from debian to alpine, my question is about “why” has it been done this way, are they known incompatibilities who would have led to chose the heavy debian instead of alpine ?

  2. What I call “web console” is what u call “dashboard”, I don’t know what u call “web console” ;), and I don’t really know which question you are trying to answer.

I’m looking forward to @curcuz answers.


#4

Hi @Tristan107 - as we already discussed on the issue you opened on that repo, you need to set both USERNAME and PASSWORD and instructions are provided on how to generate the PASSWORD hash via node-red-admin . Thanks to your suggestions in https://github.com/resin-io-projects/resin-node-red/pull/2 that gor later polished by @lucian in https://github.com/resin-io-projects/resin-node-red/pull/3 this is now better described in the README.

regarding the debian vs alpine version, I will try to create an alpine branch soon and ping you there


#5

Ok, thanks !

Yes I had figured this password thing out, but please feel free to rephrase my pull request since my english is not so good.

Could u give me a few more answers about these ?

  • Was debian node image a default choice or did u meet problems with alpine like with slim ?

  • When Node-RED is loading inside the debian container, it says “Cannot find Pi RPi.GPIO python library” (I’m on Raspberry 2), is there a way to fix this or should it be fixed in ResinOS ? I’ve read sometimes the required depency is there but the error is still present (https://github.com/node-red/node-red/issues/945). Would it be the reason to pick debian instead of alpine ? If there is no problem to add it on alpine, you should really do so, because it’s one of the main use case u will have with Node-RED (interacting with the GPIO).


#6

I can’t recall correctly but I think I had problems with libc and some deps of node-RED. Will give it a go soon and report back details.

Regarding RPI.GPIO: that it’s Raspberry Pi specific, while this project is meant to be generic. You can easily add that dependency on Debian ( python-rpi.gpio ) or Alpine ( py-rpigpio ). You can also install it via pip ( pip install RPi.GPIO )


#7

Hi,

I’m coming back 3 weeks later to hear about this :slight_smile:

I know I could do experiments by myself, but I wouldn’t be the best candidate to solve problems if I meet some low-lever issues. And I’m not even sure which log messages are warnings or actual errors.


#8

@Tristan107 I think I got it in a nice ~100MB image, please see https://github.com/resin-io-projects/resin-node-red/pull/4


#9

Nice ! l’ll check this as soon as I get back to work on monday