hey guys, got node-red on windows running sweet. want to transition it all to my linux box thats setup running rasbian. is there a easy way to transfer my flows and all that?
Have a look at the Projects feature:
I think this should work, if you are not using the projects feature:
First install node-red using the Pi install/upgrade script from the docs.
Then copy these files from your windows .node-red to the new .node-red
The flows file which is probably named flows_servername.json
The credentials file flows_servername_cred.json
package-lock.json (if present, it depends on which version of npm you have)
Look through settings.js and adjust any entries with paths in them (if you have set any up)
npm install which should install any extra nodes you have installed and are referenced in your package.json. If you were using an old version of npm then this may not install all of them, in which case you will have to manually install them.
Restart node-red and with luck you will be up and running. I am not certain whether copying the credentials file will allow any credentials that you have configured to work or whether you will have to re-enter them on the new system.
npm install must be run from the .node-red directory of course.
As long as you have set
credentialSecret in your settings file so you know what key was used to encrypt the credentials file, then you can move it around quite happily. If you haven't set credentialSecret then you've been ignoring a big warning we print on startup ...
@knolleary am I right in thinking that it is not necessary to copy .config.json across? I am not exactly sure what that does.
Awesome thank you
Being a newbie, I've taken a simpler approach and I don't care about re-entering credentials as they are usually different when I move a flow to a different system -- usually as a starting point for a "spin-off" project.
First I setup the new system to run node-red and install any extra nodes I need, like dashboard etc. Then I open the browser on my main system to the original flow and then open a new tab (or window) to the new system.
On the original system I select the entire flow and from the menu do: Export->Clipboard. Then in the tab for the new system, from the menu do: Import->Clipboard and Ctrl-c (paste) the copied nodes into the popup and then import into the new system flow and edit as necessary.
Its nice that I can do it all from my best browser even if neither system is running on it without having to setup Samba or copy files to USB sticks or whatever. Also works well for reusing sub-sections as new starting points.
I guess if its a true "clone" the aforementioned methods could be less trouble overall, especially if you have a lot of credentials to setup. My biggest trip-up in moving between Linux and Windows is filename differences (problem with Samba too) / vs. \ in paths and differences in allowed character sets, using : in timestamps embedded in filenames always gets me.
This is a lot less than it used to be. You can nearly always use "/" instead of "" in Windows. You can't use ":" it is true but things like path length issues have mainly gone away if you are using an up-to-date version of Windows 10 (or the server equivalent).
I always use ISO formatting for date/times and simply replace ":" with "-" if I want to use it in a file name. Or remove it altogether as ISO format date/times still make sense and sort correctly without the extra characters.
"/" is better to use in most programming anyway since you virtually always have to escape "" as "\". Avoid the issues altogether by using the appropriate functions in Node.JS.
One thing I have not seen in discussions of issues like this is the use of FTP (SFTP). It is available with little or no effort on most platforms and can make life easier, especially if you use a client with a gui. I do most development on a mac, with testing and deployment usually on a raspberry pi. I run Fetch on the mac, so remote directories just look like unix file listings and copying files is just drag and drop. I also use an editor on the mac (BBedit) that has a built-in FTP client, so files on the remote hosts can be edited locally. If you develop on Windows or linux, I would bet a similar arrangement could be put together.
There are a great many tools that can help with the transfer and/or sync and that work across platforms. Plenty of tools such as VScode support SCP (secure copy) for example which is available with any implementation of SSH.
SFTP or FTPS are also OK. RSYNC with SSH also good.
Exactly. Just keeping it simple.