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?
Anybody done something like this?
In the playbook, use Node-RED’s http admin API wherever you can.
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).
Thank you all, I will go play with these ideas.
Okay, I am doing something wrong.
- I create the host folder for the docker instance.
- I Clone my repo here:
- I copy the following files from location 2) to 1):
I start the Node-RED container:
docker run -p 1880:1880 -v /opt/iotplay/homedig2core/data:/data --detach --name homedig2core nodered/node-red:latest
It opens an empty Node-RED editor. What am I missing?
By default docker uses a file called
flows.json.... like yours but with an extra s
Ohh my.... let me go check
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
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
When projects are not enabled, Node-RED will use the
credentialSecret value in your settings.js file.
If it doesn't find a value in the settings file, it generates it own one and stores it in the runtime config file (
credentialSecret that I use in Projects was set in settings.js ...
I think its also related to my previous flow.json vs flows.json problem, busy checking.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.