I know there is a "Projects" feature in Node-Red for linking and cloning repositories from Github. My question is: Is it possible to automate cloning process via standard commands used in terminal to do those operations and can I just use it on directory craeted by node-red projects feature?
My goal is to have "one button" solution Where I just call out scripts on machines and they will clone/deploy changed node-red code from respository. So I don't have to do it manually via Node-red Editor.
Thank you for your time and answers!
I don't personally use the project feature. But I seem to remember that @knolleary has previously said that you should not try to mess with the project other than via the internal Node-RED controls? You might try searching for previous threads on the forum.
In theory you could issue git commands easily enough using an exec node but what impact that might have on a project I wouldn't like to guess.
That's only the case on the instance you're actively editing and developing the flow on.
Remotely deploying the git repo and using it as a way to distributing updates to other devices is a perfect use of projects.
There are a few different ways of approaching it. Can't elaborate right now, but will reply later (ping me if I've clearly forgotten to get back to you).
Thanks for the ping
It depends how you want to work with the 'remote' instances.
If you don't plan to use the editor on the remote instances directly, then you can run those as 'headless' instances - without the projects feature enabled and with the editor disabled.
You can then develop the flows on your local instance using a Project, and by adding a settings.js file and a couple updates to the its package.json file, the repo can then easily be deployed and run.
I wrote a blog post a while ago that outlines the basic principle - although in that instance it talks about deploying to a cloud environment which isn't so relevant here: Creating a Node-RED deployment pipeline to IBM Cloud · knolleary
If you follow what that post says for the settings and package files, on a remote machine you can then do:
git clone <your-project-repo>
to run the code.
If you already have Node-RED installed and setup to run automatically on those devices then you won't need to add
node-red as a dependency to the package.json and you won't need the
start command. You will have to make sure that your node-red instance picks up the settings and flows file from your project directory. So to update the flows, you'd run
git pull to get the latest changes and then restart Node-RED.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.