As I'm rebuilding my Node-RED flows using FlexDash I'm wondering whether there isn't a way to modularize stuff into "applications". Some of what I'm doing is relatively generic, so I could publish it for others to use & contribute, but I'm not sure how that would work.
A few years back, when I first read about the projects feature I was pretty excited, until I found out that the run-time only runs one project. I had already imagined being able to put the weather stuff into one project to isolate it from all the network management stuff, and then have home control separate too, etc. But I can't just put them into separate projects 'cause they all need to run!
So I'm wondering what would a "Node-RED app" look like? I think what I would like is:
- separate "codebases", i.e. separate flow files, like projects, so packaging an app as a project sounds good to me.
- run in a somewhat isolated run-time, if it's all in the same node process I'm OK with it, but the reality is mostly likely one process per running project/app.
- one single "admin" app, i.e., I don't really want to have N separate installs of Node-RED, I want one that has several containers/sandboxes/runtimes; now the admin could perhaps be a wrapper around the current flow-editor, dunno
- one single FlexDash dashboard to visualize everything, although, thinking of it, some little tweaks could make it pretty seamless to switch dashboards when clicking on a tab (i.e., add the functionality to nav to a different page when opening a tab and that other page happens to be another dashboard...)
- in terms of communication I'd glue everything together via MQTT, so that part is easy
As I'm writing this, maybe the easiest way to go is to launch multiple Node-RED installs each in their own docker container and to have multiple flow editor tabs open... I almost did that a couple of years ago, but then realized that as-is the gain would be minimal for a lot of admin overhead.
The above musings are all really about running multiple apps that are somewhat isolated from one-another. There's another aspect, which is around publishing apps. I know I can easily publish a project (=app) into the flow library. But I have the feeling that the "easy" stops there.
- For someone to try the app out they either have to spin up a Node-RED instance or load all my junk into their instance and then "figure it out", especially if they don't like it and want to remove it
- If I then make some improvements, how do they upgrade their install? Especially taking persistent data into account? And configuration they've done to make the app work in their environment?
- If they make some changes and tinker with the app, how do they merge changes I'm making?
- If they make improvements, how can they make a pull request or equiv against my version so I can incorporate it? I mean, if the flow is checked into git then they can of course produce a diff, but how does anyone review such a thing?
- I remember someone posting recently about using timestamps for node-ids instead of the current random value so they could better review diffs, hmmm...
Am I making up issues and not seeing the obvious existing solutions? Is all of this at all interesting to anyone else?
It seems to me that while there may be workarounds to everything I mentioned somehow the sum of these issues prevent the bigger picture of "Node-RED apps" from appearing....