[Feature Request] Set git Configuration and Active Project Using node-red admin

I'm deploying Node-RED using Ansible (standard install). I'm also cloning my project from GitHub to the projects folder. Unfortunately, I have to log in to every Pi in the fleet to manually set my git username and email and also open the project. That isn't ideal. A way to perform these tasks using node-red admin would be very beneficial.

(Possible to Configure Git Settings and Open Project Using CLI?)
I've attempted to modify .config.projects.json and .config.users.json with Ansible and and have even made copies of those files from a working system and deploy them to a new system using Ansible, but Node-RED still asks for my git username and email and asks if I want to create or open a project.

Have you considered using a platform designed specifically for this?

There are several around that specialise in managing node-red at scale for example FlowFuse offers fleet management, snapshots, pipeline deployments to one or hundreds, central UI management, secure by default (including SSO), and much more.

For full disclosure, I (proudly) work for FlowFuse.

I may have heard of FlowFuse but never knew what it was until now. I like it!

The self hosted version would probably work fine at this time, but if this project grows beyond just the facility I'm based out of, that would mean trying to sell someone on spending $25/month/instance and that's not going to happen, especially with the other red tape involved ($2 million certificate of insurance from the vendor and a list of other things). I wouldn't be able to justify even $10/month/instance, even to myself, when git integration works perfectly for our needs with the exception of having to do the initial git setup manually. The flows I have for this project already handle provisioning and updating themselves.

Do you need to use Projects for this application? It makes deployment more complex.

Using Projects would be preferable. It significantly simplifies the process of fixing something on one node and deploying it to the rest. The application I developed can't be easily debugged and tested outside of the machines they monitor. While the NR application is the same, it self-configures in the field for the particular machine it's connected to.

Everything is working well except for being able to set my git username and email and the active project automatically. If I have to do it manually, I will. I was just hoping the developers might be open to implementing a new feature that, for me anyways, would be a TREMENDOUS help.

Not a direct answer to your request.... But, using docker, you could create your own docker container and through ansible, when a change to the container is made, deploy via a docker-compose file the new version of the container.
I am guessing that you have one place to update and many place to run (and not change the flows).
If that is the case, then, this approach might be an answer be to your problem.

In what way?

If I'm logged in to NR on one particular machine and find a problem in my flow, I can fix it, commit and the changes, and push them to Github from that machine. That's all I have to do. The rest of the fleet takes care of itself. My flows have a small group of nodes that compare the local copy of the flow to the copy on Github and, when there's a difference, pulls the update and restarts NR.

That does not require the projects feature, it just needs you to manually create the github repo for the .node-red folder. This is the .gitignore that I use so it commits the bits that are necessary.

*.backup
node_modules
context
.config.users.json

The initial deploy is easily done using ansible by cloning the repo into .node-red and running npm install

I'm not sure I completely follow so bear with me. :grinning:

Instead of the repo I currently have that contains only flows.json, flows_cread.json, and package.json, I need to recreate the repo with everything but the files and folders you specified in .gitignore? Once I clone the repo, run npm install and everything should be good.

Then whenever I make changes, I just need to drop into cli to commit the changes and push them to Github?

Yes, though initially I suggest creating a new repo rather than burning your bridges by deleting the old one.

If you have something a bit unusual in your system there may be other folders/files that you need to ignore (possibly a dist folder for example), but that is unusual.

If you update nodes or install any extra nodes you will have to do that separately. I assume that is the same if you were using projects.

Correct. I use Ansible to make sure all the required nodes are installed so I'm good there. While it would be nice to use Projects to handle the commit and push from within the editor, I guess this will have to do. Thank you, Colin!

In fact, since package.json and package-lock.json are in the repo then for new/updated nodes you should just need to run npm install again to pick them up after pulling the changes from the repo so you shouldn't need to do that via Ansible. I don't manage nodes in ansible.

1 Like

Further to that you won't need to use ansible to install additional nodes at the initial deploy. The npm install (run in the .node-red folder) will do that for you based on the package json files.

1 Like