Moving Flows From One Instance To Another?

When moving flows from one instance of node-red to another? How do I avoid orphaning the UI elements, dashboard elements. I was doing exports and imports of flows, but I discovered the dashboard elements are orphaned. How can I avoid this?

Need to migrate flows and defined dashboard elements to about 10 Raspberry Pi devices, and then over time maintain said installations of node-red. Creation of a base image, cloning it to each device media is not an option, given the remote location of the devices, and the down time to update the media offline, something I want to avoid.

Thinking someone has a script, or even better, a flow? That does this? Under the hood, copying files from source to destination is most of it? Well, install of packages, withstanding of course.

There's a few posts on this topic that I've seen, but I've never done anything like this before. Try doing a forum search for "balena", deploying through it might allow to do what you're looking for.
An alternative is looking at Ansible for deploying it through a script, if you will.

Ah, yes, been a while since I have used Ansible, but that was in the back of my mind as well as a possible solution.

Can you explain what you mean by that? I find that if I export a UI node and import it elsewhere that it works ok.

On the broader question, is it the complete flows file that you want to deploy? If so then one solution is to have that and settings.js and anything else it needs in a git repository, then all you have to do is to checkout from the repository when a new version is available, and restart node-red. That can be handled via ansible or basic scripts if preferred.
If new nodes were added, or versions were updated then you would have to include package.json and package-lock.json in the repo and after checkout run npm install in the node red folder. That would ensure the outstations used the same node versions as the master.

I did some more testing just doing simple exports and imports, for flows that include ui elements... and they worked. So I had to have screwed something up when I did the initial exports and imports. The only odd thing was sometimes the layout formatting is odd... again, I think this has to be something I am doing. I don't think this a bug or such, if I implied that, oops.

The above said, I still have the need to deploy flows to remote locations. The idea of using a git server is cool. Feels like it might be easier than using Ansible. The question then how is, am I just going to do node-red content, or more than that? I have not decided. Exploring the use of a local git server is definitely on my to-do list now.

FYI - here's the link to Nicks post on using Balena https://knolleary.net/2018/09/27/deploying-node-red-applications-to-devices-using-balena/

1 Like

Excellent, thanks! Balena reminds me of Ansible.

Also consider private repositories on Github, which are free for non-commercial use. Since that is offsite it can also form part of the backup strategy.
Probably not suitable for any sensitive data however, I am not sure just how private a private repository is. The data is not encrypted so is at least visible to github admins one assumes. Don't include the credentials file (*_cred.json) or wherever your credential secret is stored. In fact those should probably not be stored in any repo.

Yes, that is the intended implementation. Just an opportunity to learn more about Balena along the way..