Node red project with git and docker

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

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.

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.

1 Like

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.

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.

1 Like

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.

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).

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).

1 Like

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