Node Red deployable file

i’ve followed the official tutorial here

https://nodered.org/docs/platforms/docker
and it worked for me on raspi

Some clarification regarding your instructions,
if i run a local NR installation i understand that every NR needed file is in the created subfolder. the same i guess also for any additional node installed. What about potential dependencies with other libraries?

therefore i could make a NR remote upgrade/sync just copyng those folders to the remote unit.
likely i need to make a NPM rebuild?
in same cases we have systems that could not access internet, so updating requires an off-line procedure.

is there also a full list of all NR standard installation used dir? say to use in a backup procedure with rsync?
and finally, how to make a full NR uninstall? i could not find clear indications on this.

M

You have a choice. If installing via the admin ui, both installed nodes and all of their dependencies will be installed into userDir/node_modules but you can also install nodes using npm into the same folder that Node-RED itself is installed to (e.g. one folder higher up in my case since the userDir is a sub-folder of the node-red project itself).

To upgrade, you may need to run npm update in BOTH folders.

I think that the easiest update approach would be to simply sync the node-red project folder since everything else is already encapsulated by that. This would take care of your devices that don't have direct Internet access. You may have to adjust some excludes to allow for anything that is device specific of course.

The downside of using Node.JS based systems is that they run to a LOT of files and folders - 10's or 100's of thousands. So initial sync can be a bit hair raising.

There are some common dependencies that do need to be typically built on update, at least on some platforms (including Windows and Raspberry Pi). This does mean that it is better to have your source platform the same as the ones you are syncing to.

I'm not aware of a list for a standard installation. The best thing (assuming the use of Linux) would be to look at Dave's Raspberry Pi update script since that digs into all of the corners and is very comprehensive.

There are a number of threads both in Discourse and the old Google Group that detail how to do backups of Node-RED systems.

A full Node-RED uninstall will be clear from Dave's script but you can simply delete the folders. The only thing this wouldn't cover would be a systemd startup script if you use one. Personally, my systemd script resides in the Node-RED project folder as well so that everything is always in one place. The entry in \etc\systemd is just a soft link.

Ok thanks, pretty clear..
the only way ahead now is to run a full system installation cycle and see if everything works as expected... at least in our configuration...
ill give feedback about it..

Hi,
i could not install node-red with npm init, getting this error..
Node is 10.11.0
Npm is 6.4.1.

hs@HS-Stretch-IT-ZW-Kiosk-r1:~/local_NR $ npm init node-red
npm ERR! code E404
npm ERR! 404 Not Found: create-node-red@latest

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-24T11_28_11_882Z-debug.log
Install for create-node-red@latest failed with code 1

which could be the problem?

The log file will tell you more but it is possible that npm init doesn't like the name node-red. As you are already inside a folder (local_NR), you can simply do npm init.

In fact, you can see that npm is trying to find a package called create-node-red in its repository. Just leave the name off.

ok got it
then i run a “npm init -y”
in the local_NR dir and a package.json has been created
then when i run
“npm install --save node-red”
by default a new dir .node-red is created under the user dir and all nodes files with flows are stored there rather than in the local dir i have created
this is confusing, i would expect the .node-red and node folders being created locally

Yes, that's the default. Easy for beginners. This initial complexity is why the default is as it is.

You simply need to adjust your startup. Here, for example is the package.json in my master Node-RED folder:

{
  "name": "node-red-master",
  "version": "0.19.0",
  "description": "Test environment for developing Node-RED flows",
  "main": "index.js",
  "scripts": {
    "start": "node node_modules/node-red/red.js --userDir ./data",
    "update": "npm install --unsafe-perm node-red",
    "check": "npm outdated",
    "check-data": "cd data && npm outdated",
    "update-data": "cd data && npm update",
    "check-master": "npm outdated",
    "update-master": "npm update",
    "log": "sudo journalctl -u nrlive -f -n 0 -o cat"
  },
  "keywords": [
    "node-red"
  ],
  "author": "Julian Knight",
  "license": "MIT",
  "dependencies": {
    "node-red": "^0.19.4"
  }
}

With that, you can start Node-RED manually simply by typing npm start on the command line when in that folder. Note that Node-RED itself is the only package installed in that folder.

Also note that my userDir folder is called data and it sits inside that master folder.