# Node red project with git and docker

**URL:** <https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674>\
**Category:** General\
**Tags:** docker, nr-project-nodes\
**Created:** [3 September 2024 08:56 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674 "2024-09-03T08:56:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)\
**Post date:** [3 September 2024 08:56 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/1 "2024-09-03T08:56:02Z")

</div>

Have tried out the 'project' feature now in node-red. The integrated git gui seems like an easy way to onboard team members with less experience with git. However, I struggle to see how this can be combined with also incorporating the parent node red environment? Ie. docker, npm and everything else. When using projects, you get a subfolder (per project) where the code stuff goes (flow.json and package.json). But the parent folder will have all the surrounding stuff (dockerfile, build script, other scripts, node\_modules folder etc). Easily summarized as follows:

1. Parent folder: Project environment
2. Sub folder: Node red code

The docker setup I use is a slightly modified version of the official custom node red docker: [node-red-docker/docker-custom at master · node-red/node-red-docker · GitHub](https://github.com/node-red/node-red-docker/tree/master/docker-custom)

So how to combine these in git? Not only the code is useful to have in git, but also the docker setup for version control and easily sharing and deployment. Normally, when having a git sub-project inside another git project, you'd use submodules. But does node red projects support git submodules? Otherwise how can node red project be useful?

This is as far as I understand at this point, let me know if I missed something or other tips to setup this the best way.

---

<div class="post-metadata">

**Author:** ![JoW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jow/32/108217_2.png) [@JoW](https://discourse.nodered.org/u/JoW)\
**Post date:** [3 September 2024 14:13 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/2 "2024-09-03T14:13:40Z")

</div>

I make symbolic links for any file that is not in the project directory and that I want in the repository, and move the original file in the project directory. (sometimes need to rename the physical file, like package.json, because they exist both in /data, and in the project directory.

I keep the docker-compose.yml, a customized settings.js, .config.projects.json and the /data/packages.json (which contains the references to installed nodes, need to rename the physica file for this one) in the project directory like this.

kr,  
Jo.

---

<div class="post-metadata">

**Author:** ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)\
**Post date:** [4 September 2024 11:07 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/3 "2024-09-04T11:07:06Z")

</div>

That makes sense. I figured it was possible to use submodule here, so each node-red project is a git submodule. Works nice so far, but haven't ran it in docker yet so need to experiment more.

---

<div class="post-metadata">

**Author:** ![JoW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jow/32/108217_2.png) [@JoW](https://discourse.nodered.org/u/JoW)\
**Post date:** [4 September 2024 12:28 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/4 "2024-09-04T12:28:35Z")

</div>

The nodes you install with the palette manager and use in a project are not registered in the /data/projects/project/package.json but in the /data/package.json.  
So maintaining multiple projects in one nodered instance is not as 'clean' as I would like. (possible module version conflicts, and a change in one project would also cause a change in another project)  
I keep to one project per nodered instance (what's another container, right?).

Also switching to another project, stops the flows of the project you're leaving.  
So I don't really see the need for multiple projects in one instance.

---

<div class="post-metadata">

**Author:** ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)\
**Post date:** [5 September 2024 06:58 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/5 "2024-09-05T06:58:49Z")

</div>

Thanks, great to hear about your experience and I agree completely. Sticking to single project for the foreseeable future. Node-red project is a group of features, and I was mostly interested in the git integration for now.

---

<div class="post-metadata">

**Author:** ![ThingsTinkerer](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@ThingsTinkerer](https://discourse.nodered.org/u/ThingsTinkerer)\
**Post date:** [5 September 2024 07:26 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/6 "2024-09-05T07:26:31Z")

</div>

I don't have it up and running at the moment, but I thought you'd get a package.json per project? Which version are you using? I tried 4.0.2 (latest).

---

<div class="post-metadata">

**Author:** ![JoW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jow/32/108217_2.png) [@JoW](https://discourse.nodered.org/u/JoW)\
**Post date:** [6 September 2024 13:54 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/7 "2024-09-06T13:54:48Z")

</div>

> [@ThingsTinkerer](#):
>
> e it up and running at the moment, but I thought you'd get a package.json per project

you do, but they contain project name etc.  
But nodes installed through the palette mgr are registered in /data/package.json which to me is unlogical, but I can see the problem with registering them in the project's package.json.

nodejs does not stop running when switching projects, so how do you unload nodes from the project you are switching from, and load the new project's nodes?

So having 2 projects with different versions of the same node seems impossible (and also very unlikely).

---

<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:** [5 December 2024 13:55 UTC](https://discourse.nodered.org/t/node-red-project-with-git-and-docker/90674/8 "2024-12-05T13:55:42Z")

</div>

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