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

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.

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.

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.

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

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).

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 )

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.

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

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

Hi
I have been using the resin node red project and it works great. I need to install a modbus node and this fails with the following error. Any advice would be appreciated

10.08.18 11:46:47 (+0100) npm WARN node-red-project@0.0.1 No repository field.
10.08.18 11:46:47 (+0100) npm WARN node-red-project@0.0.1 No license field.
10.08.18 11:46:47 (+0100) npm ERR! Linux 4.9.59
10.08.18 11:46:47 (+0100) npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “–save” “–save-prefix=~” “–production” “node-red-contrib-modbus@3.6.1”
10.08.18 11:46:47 (+0100) npm ERR! node v6.12.2
10.08.18 11:46:47 (+0100) npm ERR! npm v3.10.10
10.08.18 11:46:47 (+0100) npm ERR! code ELIFECYCLE
10.08.18 11:46:47 (+0100)
10.08.18 11:46:47 (+0100) npm ERR! serialport@6.1.1 install: prebuild-install || node-gyp rebuild
10.08.18 11:46:47 (+0100) npm ERR! Exit status 1
10.08.18 11:46:47 (+0100) npm ERR!
10.08.18 11:46:47 (+0100) npm ERR! Failed at the serialport@6.1.1 install script ‘prebuild-install || node-gyp rebuild’.
10.08.18 11:46:47 (+0100) npm ERR! Make sure you have the latest version of node.js andnpm installed.
10.08.18 11:46:47 (+0100) npm ERR! If you do, this is most likely a problem with the serialport package,
10.08.18 11:46:47 (+0100) npm ERR! not with npm itself.
10.08.18 11:46:47 (+0100) npm ERR! Tell the author that this fails on your system:
10.08.18 11:46:47 (+0100) npm ERR! prebuild-install || node-gyp rebuild
10.08.18 11:46:47 (+0100) npm ERR! You can get information on how to open an issue for this project with:
10.08.18 11:46:47 (+0100) npm ERR! npm bugs serialport
10.08.18 11:46:47 (+0100) npm ERR! Or if that isn’t available, you can get their info via:
10.08.18 11:46:47 (+0100) npm ERR! npm owner ls serialport
10.08.18 11:46:47 (+0100) npm ERR! There is likely additional logging output above.
10.08.18 11:46:47 (+0100)
10.08.18 11:46:47 (+0100) npm ERR! Please include the following file with any support request:
10.08.18 11:46:47 (+0100) npm ERR! /data/node-red/user/npm-debug.log
10.08.18 11:46:47 (+0100)
10.08.18 11:46:47 (+0100) 10 Aug 10:46:47 - [warn] ------------------------------------------
10.08.18 13:50:12 (+0100) 10 Aug 12:50:12 - [info] Installing module: node-red-contrib-modbus, version: 3.6.1
10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn] Installation of module node-red-contrib-modbus failed:
10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn] ------------------------------------------
10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn]
10.08.18 13:51:10 (+0100) > serialport@6.1.1 install /data/node-red/user/node_modules/serialport
10.08.18 13:51:10 (+0100) > prebuild-install || node-gyp rebuild
10.08.18 13:51:10 (+0100)
10.08.18 13:51:10 (+0100) prebuild-install WARN install No prebuilt binaries found (target=6.12.2 runtime=node arch=arm platform=linux)
10.08.18 13:51:10 (+0100) gyp ERR! configure error
10.08.18 13:51:10 (+0100) gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable.
10.08.18 13:51:10 (+0100) gyp ERR! stack at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14)
10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:353:11
10.08.18 13:51:10 (+0100) gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:69:16)
10.08.18 13:51:10 (+0100) gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:81:29)
10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:90:16
10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
10.08.18 13:51:10 (+0100) gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
10.08.18 13:51:10 (+0100) gyp ERR! System Linux 4.9.59
10.08.18 13:51:10 (+0100) gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
10.08.18 13:51:10 (+0100) gyp ERR! cwd /data/node-red/user/node_modules/serialport
10.08.18 13:51:10 (+0100) gyp ERR! node -v v6.12.2
10.08.18 13:51:10 (+0100) gyp ERR! node-gyp -v v3.4.0
10.08.18 13:51:10 (+0100) gyp ERR! not ok
10.08.18 13:51:10 (+0100) node-red-project@0.0.1 /data/node-red/user
10.08.18 13:51:10 (+0100) -- (empty) 10.08.18 13:51:10 (+0100) 10.08.18 13:51:10 (+0100) npm WARN node-red-project@0.0.1 No repository field. 10.08.18 13:51:10 (+0100) npm WARN node-red-project@0.0.1 No license field. 10.08.18 13:51:10 (+0100) npm ERR! Linux 4.9.59 10.08.18 13:51:10 (+0100) npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-prefix=~" "--production" "node-red-contrib-modbus@3.6.1" 10.08.18 13:51:10 (+0100) npm ERR! node v6.12.2 10.08.18 13:51:10 (+0100) npm ERR! npm v3.10.10 10.08.18 13:51:10 (+0100) npm ERR! code ELIFECYCLE 10.08.18 13:51:10 (+0100) 10.08.18 13:51:10 (+0100) npm ERR! serialport@6.1.1 install:prebuild-install || node-gyp rebuild10.08.18 13:51:10 (+0100) npm ERR! Exit status 1 10.08.18 13:51:10 (+0100) npm ERR! 10.08.18 13:51:10 (+0100) npm ERR! Failed at the serialport@6.1.1 install script 'prebuild-install || node-gyp rebuild'. 10.08.18 13:51:10 (+0100) npm ERR! Make sure you have the latest version of node.js andnpm installed. 10.08.18 13:51:10 (+0100) npm ERR! If you do, this is most likely a problem with the serialport package, 10.08.18 13:51:10 (+0100) npm ERR! not with npm itself. 10.08.18 13:51:10 (+0100) npm ERR! Tell the author that this fails on your system: 10.08.18 13:51:10 (+0100) npm ERR! prebuild-install || node-gyp rebuild 10.08.18 13:51:10 (+0100) npm ERR! You can get information on how to open an issue for this project with: 10.08.18 13:51:10 (+0100) npm ERR! npm bugs serialport 10.08.18 13:51:10 (+0100) npm ERR! Or if that isn't available, you can get their info via: 10.08.18 13:51:10 (+0100) npm ERR! npm owner ls serialport 10.08.18 13:51:10 (+0100) npm ERR! There is likely additional logging output above. 10.08.18 13:51:10 (+0100) 10.08.18 13:51:10 (+0100) npm ERR! Please include the following file with any support request: 10.08.18 13:51:10 (+0100) npm ERR! /data/node-red/user/npm-debug.log 10.08.18 13:51:10 (+0100) npm ERR! code 1 10.08.18 13:51:10 (+0100) 10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn] ------------------------------------------ 10.08.18 13:50:12 (+0100) 10 Aug 12:50:12 - [info] Installing module: node-red-contrib-modbus, version: 3.6.1 10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn] Installation of module node-red-contrib-modbus failed: 10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn] ------------------------------------------ 10.08.18 13:51:10 (+0100) 10 Aug 12:51:10 - [warn] 10.08.18 13:51:10 (+0100) > serialport@6.1.1 install /data/node-red/user/node_modules/serialport 10.08.18 13:51:10 (+0100) > prebuild-install || node-gyp rebuild 10.08.18 13:51:10 (+0100) 10.08.18 13:51:10 (+0100) prebuild-install WARN install No prebuilt binaries found (target=6.12.2 runtime=node arch=arm platform=linux) 10.08.18 13:51:10 (+0100) gyp ERR! configure error 10.08.18 13:51:10 (+0100) gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. 10.08.18 13:51:10 (+0100) gyp ERR! stack at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14) 10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:353:11 10.08.18 13:51:10 (+0100) gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:69:16) 10.08.18 13:51:10 (+0100) gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:81:29) 10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:90:16 10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5 10.08.18 13:51:10 (+0100) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5 10.08.18 13:51:10 (+0100) gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15) 10.08.18 13:51:10 (+0100) gyp ERR! System Linux 4.9.59 10.08.18 13:51:10 (+0100) gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 10.08.18 13:51:10 (+0100) gyp ERR! cwd /data/node-red/user/node_modules/serialport 10.08.18 13:51:10 (+0100) gyp ERR! node -v v6.12.2 10.08.18 13:51:10 (+0100) gyp ERR! node-gyp -v v3.4.0 10.08.18 13:51:10 (+0100) gyp ERR! not ok 10.08.18 13:51:10 (+0100) node-red-project@0.0.1 /data/node-red/user 10.08.18 13:51:10 (+0100)– (empty)
10.08.18 13:51:10 (+0100)
10.08.18 13:51:10 (+0100) npm WARN node-red-project@0.0.1 No repository field.
10.08.18 13:51:10 (+0100) npm WARN node-red-project@0.0.1 No license field.
10.08.18 13:51:10 (+0100) npm ERR! Linux 4.9.59
10.08.18 13:51:10 (+0100) npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “–save” “–save-prefix=~” “–production” “node-red-contrib-modbus@3.6.1”
10.08.18 13:51:10 (+0100) npm ERR! node v6.12.2
10.08.18 13:51:10 (+0100) npm ERR! npm v3.10.10
10.08.18 13:51:10 (+0100) npm ERR! code ELIFECYCLE
10.08.18 13:51:10 (+0100)
10.08.18 13:51:10 (+0100) npm ERR! serialport@6.1.1 install: prebuild-install || node-gyp rebuild
10.08.18 13:51:10 (+0100) npm ERR! Exit status 1
10.08.18 13:51:10 (+0100) npm ERR!
10.08.18 13:51:10 (+0100) npm ERR! Failed at the serialport@6.1.1 install script ‘prebuild-install || node-gyp rebuild’.
10.08.18 13:51:10 (+0100) npm ERR! Make sure you have the latest version of node.js andnpm installed.
10.08.18 13:51:10 (+0100) npm ERR! If you do, this is most likely a problem with the serialport package,