Deploy to multiple node-red runtime

To achieve horizontal scalability, I created a cluster using Node.js cluster module + express and it generally worked well. But when I click on "deploy" button after editing a flow, I don't know where my change was deployed to. It seems the changes are active only after I restart the runtime process. Is there a way to deploy changes from editor to multiple node-red runtime?

No. If you've created a cluster of runtimes you need to figure out how to update them all when the editor deploys changes.

For example, a custom storage plugin that notifies all your instances when it receives new flows.

Thanks a lot for the immediate advice.
So, after I receive the new flow, is there a API to add the new flow into the runtime or I should just restart myself to apply the new flow?
How can I make sure my current messages get processed completely when I restart my process? Will my message dead in the middle of the flow?

Hi Fangzhu, Were you able to fix this issue ?

@divyanshverma I couldn't find a straightforward way. Instead I let the flow to be deployed first, save the JSON on disk, then restart all processed using the JSON.
We are still doing evaluation to deploy to multiple processes under a express cluster without restarting process. I am thinking to let the cluster master to pend request to processes one by one then send deploy request and resume.

Thanks for getting back, so here what I have done so far. I was not sure if this is the best way :slightly_smiling_face:

  1. Emit an event when the flow is saved to the database (Using mongodb)
  2. Broadcast the event to the other processes via pm2 messaging
  3. On the other process, recieve the event and then call the red api "/flow" to reload/restart the changed flow only.