# Deploy vs. restart Node-RED

**URL:** <https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227>\
**Category:** General\
**Created:** [26 August 2021 19:08 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227 "2021-08-26T19:08:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [26 August 2021 19:08 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/1 "2021-08-26T19:08:22Z")

</div>

Not sure if this came up before. We have a small problem because a restart of Node-RED does not behave the same way as a deploy when it comes to ui elements.

Restart: `msg` will pass through `node-red-dashboard : ui_slider` after startup.  
Full deploy: `msg` will not pass through `ui_slider` after deploy.

Is there a way to force some sort of a restart if the deploy button is pressed? Or am I missing something?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [26 August 2021 19:19 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/2 "2021-08-26T19:19:51Z")

</div>

Most common solution is to use the `ui_control` node.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f83e3fe4726dd692a2f45ad248c298912bd9c32c.png)

If you do deploy - the dashboard will (re)connect and the `ui_control` will fire `msg`. No matter the msg content, you can take it as event. the flow downstream from this node should be able to collect latest state what is needed to be sent to the dashboard nodes.

It works also when you see the dashboard from some other device - new connections is made and the ui\_control again fires the msg. Dashboard elements will always have up to date state at the moment you open the page (or switch the dashboard tabs or refresh the page)

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [26 August 2021 19:26 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/3 "2021-08-26T19:26:48Z")

</div>

Thanks @hotNipi. I should have been more clear about what we're trying to do.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c31b6132995e55b034195cba6eb59b25a2166705.png)

On startup, the `msg` is being passed through the slider node (dashboard does not have to be open). However, if I do a re-deploy, the `msg` is not being passed through the slider. The additional message or the different behaviour caused a bug which we only recently discovered because the behaviour is not the same.

Btw, can you explain your username hotNipi? 😉

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [26 August 2021 19:37 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/4 "2021-08-26T19:37:34Z")

</div>

Ok. It is not best practice to have dashboard nodes in between of logical flows.  
Also - the deploy procedure should not be taken as trigger. The inject node triggers at the startup because you have configured it to do so. (I can see small number 1)

The story of my username is as long as boring so I leave it for days filled with nothing ..

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [26 August 2021 19:44 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/5 "2021-08-26T19:44:27Z")

</div>

> [@hotNipi](#):
>
> Ok. It is not best practice to have dashboard nodes in between of logical flows.

Yes, it looks like we have to redesign this but there are so many ui elements 😑

> [@hotNipi](#):
>
> Also - the deploy procedure should not be taken as trigger. The inject node triggers at the startup because you have configured it to do so. (I can see small number 1)

Well, that's how we develop atm and we made some wrong assumptions I guess. A restart after each change did not seem necessary. The `inject` triggers after deploy as well btw.

> [@hotNipi](#):
>
> The story of my username is as long as boring so I leave it for days filled with nothing

I cannot ask more questions atm .. because I am busy bending wires.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [26 August 2021 19:49 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/6 "2021-08-26T19:49:22Z")

</div>

> [@rko](#):
>
> The `inject` triggers after deploy as well btw.

True for full deploy, if you do partial deploy and the inject node is not "dirty" there will be silence.  
And when project size goes up, you just don't wont to do full deploy every time. Which means \_ deploy is not trigger.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [26 August 2021 19:58 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/7 "2021-08-26T19:58:56Z")

</div>

In my defence, we are not using a deploy as trigger but expect same behaviour during a startup. ~~Ironically, the problem we have right now is because the slider triggers something but should not.~~

As you mentioned, we have to isolate the slider, which makes things more complicated.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [26 August 2021 20:17 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/8 "2021-08-26T20:17:22Z")

</div>

> [@hotNipi](#):
>
> Ok. It is not best practice to have dashboard nodes in between of logical flows.

I am curious, how would you design this?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [26 August 2021 20:20 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/9 "2021-08-26T20:20:34Z")

</div>

Well, I said it is not best practice but in many cases it is necessary to do that way. By knowing nothing about the thing you are working on, cant say much more.

I don't think the slider is the main source of the issue. Dashboard nodes may get replay messages when you deploy - that may introduce undesired triggers. It depends on many things which are not under your control directly.  
But you definitely need to figure out some sort of solid trigger to initialize the flow at the time you'll need to be started.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [27 August 2021 08:45 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/10 "2021-08-27T08:45:09Z")

</div>

> [@hotNipi](#):
>
> Dashboard nodes may get replay messages when you deploy - that may introduce undesired triggers.

So far I have not experienced this and it would not be a problem. But during startup there were now two triggers. The one from inject passing through the slider node and the "real" [`startup-trigger`](https://flows.nodered.org/node/node-red-contrib-startup-trigger) to initialize everything, whereas after a deploy the message is not being passed through the slider node (as explained in the initial post).

And I am probably not the only one who expects a full or even partial deploy to behave like a full restart. The fact that this is not the case, makes developing more difficult and the slider problem seems like a bug (slider state is not being reset after a deploy). But maybe I don't get the concept of `deploy` here.

As for the problem I am facing, it was rather easy to fix it. I just need to disable passing messages:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6ace4b3a2fb5f3e6ed0e0cc33b8fb102715ecb21.png)

IMHO the description above should be "If `msg` arrives on input, pass through to output (only if the value of payload is not the same as the value stored in the slider node).

Problem solved.

---

<div class="post-metadata">

**Author:** ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)\
**Post date:** [27 August 2021 09:19 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/11 "2021-08-27T09:19:31Z")

</div>

Hehe @dceejay are you running a bot which marks everything as "Solution" if a post contains "Problem solved"? Can I borrow your flow? Happy weekend btw.

---

<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:** [10 September 2021 09:20 UTC](https://discourse.nodered.org/t/deploy-vs-restart-node-red/50227/12 "2021-09-10T09:20:15Z")

</div>

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