Hi, I develop my flows on Docker for Mac - then push changes to Github.
To then bring the latest code onto my production RPi, I open Node-Red Admin, then do - open editor - Project History Tab > Commit History > Refresh Commit History > Pull
I would like to write a script to do this. Something like
git clone http://github/myfiles/ThePrjName.git /opt/myfiles/libraryName/data/Projects/master --depth 1 (/opt/myfiles/ is where I have my projects)
and then I assume some Node-RED command line function to refresh the flows? Whilst I am at it, I will set the edit in settings.js to disableEditor: true - this will give me more security & automate a CD/CI flow. Any guidance on this?
If you update the project files you should restart Node-RED to reload the project.
However, I'd suggest a slightly different approach. You don't need to enable the projects feature on your production raspberry pi if you don't plan to expose the editor.
You can manually git clone the repository somewhere and then run node-red using the command line args to point to your project directory (--userDir) as well as the name of the flow file to use.
This general model of using projects for your development environment but not in your production environment is outlined in this blog post - https://knolleary.net/2018/06/01/creating-a-node-red-deployment-pipeline-to-ibm-cloud/ (although in that instance I also setup an automatic deployment mechanism so whenever I push changes to the git repo they get deployed to an IBM Cloud instance. You don't need to do all that, but the basic principle is there).
That worked... these flows came from a project, now running them in āProductionā using just git clone to RPi host, but flows have been with me for many years, might come from there. Were working under Projects on Docker on Mac, have not trsttd if rename to flows.json will also work on Projects. Will report hack.
One more issue - if I use Projects on Mac, and git clone to get the Project to Production - where do I enter my Credentials?
I now have this message on Node-RED:
Credentials could not be decrypted
The flow credential file is encrypted, but the project's encryption key is missing or invalid.
The flow credential file will be reset on the next deployment. Any existing flow credentials will be cleared.
I see my .config.json - at the bottom has the below section, I do not know where it got the credentialSecret, but it's clearly not working:
Which hashed value is stored here? I checked, it is not the hashed password I added to the settings.js file for the setting adminAuth for the MyEditorUser, neither is it the Project's flow_cred.json hash.
Or should I edit the .config.json file - and make "hashed-version-of-something-blablablabla...." the same as what lives in Projects (on the Mac & in GitHub) under flow_cred.json ?