# Use 'Projects' on Mac / Docker with git to transfer to Prod without 'Projects' on RPi

**URL:** <https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583>\
**Category:** General\
**Created:** [3 March 2020 20:43 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583 "2020-03-03T20:43:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [3 March 2020 20:43 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/1 "2020-03-03T20:43:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [3 March 2020 20:45 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/2 "2020-03-03T20:45:53Z")

</div>

Ansible? [https://docs.ansible.com/ansible/latest/index.html](https://docs.ansible.com/ansible/latest/index.html)  
In the playbook, use Node-RED’s http admin API wherever you can.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 March 2020 20:49 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/3 "2020-03-03T20:49:17Z")

</div>

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/](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).

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [4 March 2020 15:09 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/4 "2020-03-04T15:09:37Z")

</div>

Thank you all, I will go play with these ideas.

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [9 March 2020 22:42 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/5 "2020-03-09T22:42:19Z")

</div>

Okay, I am doing something wrong.

1. I create the host folder for the docker instance. `\homedir\homedig2core\data\`
2. I Clone my repo here: `\homedir\homedig2core\data\cloned`
3. I copy the following files from location 2) to 1):

```auto
  - flow.json
  - flow_cred.json
  - package.json

```

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?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 March 2020 22:59 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/7 "2020-03-09T22:59:42Z")

</div>

By default docker uses a file called `flows.json`.... like yours but with an extra s 🙂

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [10 March 2020 04:34 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/8 "2020-03-10T04:34:24Z")

</div>

Ohh my.... let me go check

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [10 March 2020 06:15 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/9 "2020-03-10T06:15:56Z")

</div>

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.

Thank you.

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [11 March 2020 16:33 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/10 "2020-03-11T16:33:49Z")

</div>

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:

```auto
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:

```auto
 "_credentialSecret": "hashed-version-of-something-blablablabla....",
 "users": {
  "MyEditorUser": {
   "editor": {
    "view": {
     "view-show-grid": true,
     "view-snap-grid": true,
     "view-grid-size": 20,
     "view-node-status": true,
     "view-node-show-label": true,
     "view-show-tips": false
    }
   },
   "menu-menu-item-palette": false
  }
 }

```

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` ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 March 2020 16:49 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/11 "2020-03-11T16:49:42Z")

</div>

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 (`.config.json`) as `_credentialSecret`.

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [11 March 2020 17:48 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/12 "2020-03-11T17:48:05Z")

</div>

hmmm, my `credentialSecret` that I use in Projects was set in settings.js ...

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [11 March 2020 22:19 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/13 "2020-03-11T22:19:42Z")

</div>

I think its also related to my previous flow.json vs flows.json problem, busy checking.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 May 2020 22:19 UTC](https://discourse.nodered.org/t/use-projects-on-mac-docker-with-git-to-transfer-to-prod-without-projects-on-rpi/22583/14 "2020-05-10T22:19:46Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
