Deploying Node-Red Flows

When you come to deploying a flow you have four (node-red v0.2)options as shown below:deploying-flows

Although the choices appear obvious the effect of the options isn’t and can cause some confusion.



In this tutorial I will concentrate of the effects of the deploy options on.

  • Inject nodes
  • Context,Flow and Global Variables
  • Other Flows in the Workspace

 

What is Modified?

Firstly we need to look at how node-red decides that a node or flow has been modified?

You should notice that when you edit a node then the deploy button goes red which means you can do a deploy.

However you can get the same effect by dragging a node across the screen.

In this case the node position has been modified but not the node.

Inject Nodes And Storage Variables

Inject nodes are typically used in a flow to initialise it.

Therefore it is important to understand if the deploy type you are using will do that.

In addition most flows will use node red storage variables (context,flow,global) for storing flow data.

What happens to these variables when you do a deploy?

Full Deploy

This will re-deploy all flows in the workspace regardless of whether or not they have been modified.

This means that currently running flows are interrupted and restarted.

Result

  • Inject nodes will fire.
  • Context variables reset
  • Flow and Global Variables are not reset

Modified Flows

Only flows that contain modified nodes will be redeployed.

Flows that haven’t been modified will continue to run without interruption.

Result

  • Inject nodes in that flow will fire.
  • Context variables reset
  • Flow and Global Variables are not reset

Modified Nodes

Only nodes that have been modified will be redeployed.

Nodes that haven’t been modified will continue to run without interruption.

Result

  • Inject nodes in that flow will only fire if they have been modified.
  • Context variables not reset
  • Flow and Global Variables are not reset

Restart Flows

All deployed flows will be redeployed.

This means that currently running flows are interrupted and restarted.

Result

  • Inject nodes will fire.
  • Context variables reset
  • Flow and Global Variables are not reset

Video -Deploying Node-Red Flows- (Quick Notes)

Overcoming Flow Problems

If for some reason when you deploy a flow node-red stalls or crashes then restarting node-red will usually result in a stall or crash as there is something in the deployed flow that is causing it.

In this case you can start node-red using the safe option which starts node-red but doesn’t deploy the flows.

node-red --safe

<===== Creating Flows- Node-Red Admin Basics

=====>How to Export and Import Nodes and Flows



Related Tutorials and Resources

Click to rate this post!
[Total: 1 Average: 4]

7 comments

  1. How can I change icon img in deployment type menu ( full , nodes , flows, restart).
    I want to use our own icon.

    It seems we can do something in inside “editorTheme” in “setting.js”.
    But I have no idea how I can implement for “default” deployment button.

    Please adivice

  2. Hi I want to change the design and layout of deploy-button & drop-down to simplyfy the appearance.
    so I need to access to html of deploy button and dropdownlist
    As far as I see DOM, I must get element to edit as we want,
    however this element and children can not be identified by “getElementById”.

    What I can identify from getElementById is only which is the top parent element of node-red page.

    What I assume is that some setting is already mounted to prevent XXS or any html change.

    so I would like to know that if I can change the DOM contents on myown, and how.

    Thank you!!

  3. Thank for your always readable explanations. Also for non english speaking it’s mostly understandable.

    In this article, I miss at the end “How to reset Flow and Global variables”. Because in all cases they are not reseted.

    1. to reset a flow or global variable create a function node and an inject node. In the function node use
      flow.set(“data”,{}); or flow.set(“data”,[]);
      depending on whether the variable is an object or an array and data is the variable name.
      Does that make sense?
      Rgds
      Steve

Leave a Reply

Your email address will not be published.