Following on from a previous issue I had with node red earlier this week, it was suggested that I upgrade from version 3.0.0 to the latest which seems to be 3.0.2. My current node red instance is running on my raspberry pi 4 and controls my central heating. It has quite a few additional nodes installed, uses MQTT broker and is working pretty well. If I upgrade to the latest version will I have to install all the special nodes again and will I have to re-enter all the topic information into my MQTT in and out nodes of which I have many? Of course I can save the flows and import them again but if I have to manually install and re-enter all the configuration info into loads of nodes I think I'll wait till summer!
So to be clear, you can assure me with reasonable confidence that I just need to run the bash install script and after a while when the latest version of Node red is installed and running I will have to do very little if anything to get my flows running the way they were?
Yes. BUT, always do a backup of your userDir folder first!
I think that I've twice (in >a decade) had an upgrade that caused an issue that meant I used my backup. Though even then I could have recovered with some faffing. So it isn't entirely unheard of. But very rare. In any case, a simple copy of ~/.node-red is all you need. Will take a bit of time to finish on a Pi but it is only 1 cp command: cp /home/pi/.node-red /home/pi/.node-red-copy should do it.
But a move from 3.0.0 to 3.0.2 is only a minor upgrade anyway so virtually no chance of anything untoward happening.
To do the upgrade (after making sure your backup is up to date) then all you need to do is to open a command window and run sudo npm install -g --unsafe-perm node-red
Then do node-red-stop node-red-start
which stops and restarts it.
If you do ever need to restore from a backup, restore everything back to the .node-red directory except the node_modules directory (in fact you don't need to back that up), then go into that directory and run npm install
that will install all the additional nodes that you had before. It knows what they are from information in package.json and package-lock.json.
An alternative Linux command to backup everything in .node-red except for the node_modules directory:
cd ~ tar --exclude="node_modules" -cvf nodered.bak.tar .node-red
This will create a single backup archive nodered.bak.tar.
To see what it contains: tar tvf nodered.bak.tar (-t lists archive contents)
To extract everything, ovewriting files currently in .node-red: tar xvf nodered.bak.tar (-x extracts fom archive)
To extract a single file eg settings.js: tar xvf nodered.bak.tar .node-red/settings.js