# Setting up a Live/Prod and a Development System

**URL:** <https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415>\
**Category:** General\
**Created:** [7 September 2022 04:13 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415 "2022-09-07T04:13:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 04:13 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/1 "2022-09-07T04:13:24Z")

</div>

I have two environments running on two seperate RPI's. RPI-14 and RPI-15.  
I have a very basic sprinkler system on 14 that uses an ESP32 to control the valves. (just on off for now).  
I setup a second esp32 for testing and I'm trying to connect to RPI-15. The flows from 14 where all exported then imported to 15. I changed all the Nodes to use RPI-15 as the broker.  
I hope there's and easier way to do this.  
The second esp32 will not connect to the second broker, the dashbaord for api-15 shows no connections.  
This is my first system that I have running, I am a newby with Node-red.  
Version 3.0.2  
Any thoughts are appreciated?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 06:12 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/2 "2022-09-07T06:12:39Z")

</div>

Welcome to the forum @DonRacz

How does the esp talk to the pi? MQTT for example?

Exactly what is it that shows not connected?

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 06:51 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/3 "2022-09-07T06:51:45Z")

</div>

Yes, It uses MQTT to connect from ESP32..  
On the DashBoard every MQTT In and MQTT out shows a little yellow box with the word "connecting". I can't send a picture because I'm a new user.  
On the debug terminal from the ESP32 it shows  
23:49:48.164 -\> Attempting MQTT connection...  
23:49:48.211 -\> failed, rc=-2 try again in 5 seconds

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 07:15 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/4 "2022-09-07T07:15:12Z")

</div>

Are you trying to connect to a broker on the same pi that is running node red? If so, have you installed a broker such as mosquito? If so, how did you install it?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 September 2022 08:17 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/5 "2022-09-07T08:17:03Z")

</div>

> [@Colin](#):
>
> such as mosquito

... which by default does not expose a public port unless you remember to configure it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 08:46 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/6 "2022-09-07T08:46:22Z")

</div>

> [@dceejay](#):
>
> does not expose a public port unless you remember to configure it.

But that would not stop node-red from connecting to a broker on localhost.  
Clarification is required from @DonRacz

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 September 2022 08:51 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/7 "2022-09-07T08:51:42Z")

</div>

I thought it blocked anonymous connections locally as well ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 09:12 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/8 "2022-09-07T09:12:07Z")

</div>

No, I have just tested it to check, with mosquitto 2.0.15. Local anonymous connections are allowed by default.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 09:27 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/9 "2022-09-07T09:27:24Z")

</div>

That confused me slightly as well, when I thought about it. With version 2 if you want to access it remotely then, as we know, it is necessary to configure it with  
listener 1883  
If that is not configured then it is only possible to connect locally (with or without user/pwd). However once the listener line is added then it is also necessary to specify  
allow\_anonymous true  
to access without user/pwd, even when accessing locally.

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 15:27 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/10 "2022-09-07T15:27:27Z")

</div>

Both RPI's have Mosquitto and NodeRed and the NodeRed Dashboard installed and running on them.

I have a list of commands that I use to install both so they are as Identical as I can make them.  
Is there a script or a program that can do the move. I'm guessing there must be something to move a the flows thru a "normal" development cycle.

Thx

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 16:15 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/12 "2022-09-07T16:15:08Z")

</div>

Once you work out what is not working then you will know what is missing.  
Are you using user names/pwds for mqtt? If so then check that has been setup correctly.  
Otherwise stop node red and start it again in a terminal and post the startup log here. Assuming that you installed using the recommended method you can see that by running  
`node-red-stop`  
`node-red-start`

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 17:42 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/13 "2022-09-07T17:42:09Z")

</div>

# Starting as a systemd service. 7 Sep 10:36:46 - [info] Welcome to Node-RED

## 7 Sep 10:36:46 - [info] Node-RED version: v3.0.2 7 Sep 10:36:46 - [info] Node.js version: v16.17.0 7 Sep 10:36:46 - [info] Linux 5.15.61-v8+ arm64 LE 7 Sep 10:36:47 - [info] Loading palette nodes 7 Sep 10:36:49 - [info] Dashboard version 3.1.7 started at /ui 7 Sep 10:36:49 - [info] Settings file : /home/pi/.node-red/settings.js 7 Sep 10:36:49 - [info] Context store : 'default' [module=memory] 7 Sep 10:36:49 - [info] User directory : /home/pi/.node-red 7 Sep 10:36:49 - [warn] Projects disabled : editorTheme.projects.enabled=false 7 Sep 10:36:49 - [info] Flows file : /home/pi/.node-red/flows.json 7 Sep 10:36:49 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/) 7 Sep 10:36:49 - [warn]

## Your flow credentials file is encrypted using a system-generated key. If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials. You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

7 Sep 10:36:49 - [info] Starting flows  
7 Sep 10:36:49 - [info] Started flows  
7 Sep 10:36:49 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883  
7 Sep 10:37:04 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883  
7 Sep 10:37:19 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883  
7 Sep 10:37:34 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883  
7 Sep 10:37:49 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883  
7 Sep 10:38:04 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883  
7 Sep 10:38:19 - [info] [mqtt-broker:c12152de73af6732] Connection failed to broker: mqtt://192.168.1.15:1883

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 17:54 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/14 "2022-09-07T17:54:31Z")

</div>

pi@RPI-15:~/.node-red $ sudo systemctl status mosquitto

- mosquitto.service - Mosquitto MQTT Broker  
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)  
Active: active (running) since Wed 2022-09-07 09:46:04 MST; 1h 6min ago  
Docs: man:mosquitto.conf(5)  
man:mosquitto(8)  
Main PID: 3105 (mosquitto)  
Tasks: 1 (limit: 8986)  
CPU: 1.997s  
CGroup: /system.slice/mosquitto.service  
`-3105 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Sep 07 09:46:04 RPI-15 systemd[1]: Starting Mosquitto MQTT Broker...  
Sep 07 09:46:04 RPI-15 systemd[1]: Started Mosquitto MQTT Broker.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 18:16 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/15 "2022-09-07T18:16:33Z")

</div>

What is the IP address of the pi?

In node red, change the broker address to localhost.

That may fix the node red issue, but not the esp connection.  
What version of mosquito are you using in the other pi?

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 18:27 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/16 "2022-09-07T18:27:56Z")

</div>

192.168.1.15  
I changed to localhost.

Still won't connect.

is there a command to find the version number of nodered and mosquitto?

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 18:37 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/17 "2022-09-07T18:37:33Z")

</div>

mosqitto on both machines is 2.0.11

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 18:42 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/18 "2022-09-07T18:42:00Z")

</div>

node-red is now showing connected to mosquitto on 15  
local host must have fixed that.

ESP32 still won't connect.

---

<div class="post-metadata">

**Author:** ![DonRacz](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@DonRacz](https://discourse.nodered.org/u/DonRacz)\
**Post date:** [7 September 2022 19:30 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/19 "2022-09-07T19:30:47Z")

</div>

There was a listener entry in the mosquitto.conf file on 14 so I added it to the conf file on 15.  
Both systems are now workng!

Colin, Thank you for your time. I learned alot working thru this with you.

Don

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2022 20:21 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/20 "2022-09-07T20:21:16Z")

</div>

> [@DonRacz](#):
>
> Starting as a systemd service.

If you add tripple backticks on separate lines before logs, code etc when posting it then it stops the forum from interpretting it as markdown which is why you have the strange effects in the node red startup log you posted.

> [@DonRacz](#):
>
> node-red is now showing connected to mosquitto on 15  
> local host must have fixed that.

The reason for that is that without the listener configuration you can't connect using an ip address, even if it is the ip of the same machine. It looks to mosquitto as if it is a remote connection so it blocks it.

> [@DonRacz](#):
>
> There was a listener entry in the mosquitto.conf file on 14 so I added it to the conf file on 15.

On Linux, rather than adding the line to main config it is arguably better to put it in a separate conf file in /etc/mosquitto/conf.d. Conf files in there add to or override the main settings, but doing that has the advantage that an upgrade or re-install of mosquitto is not going to undo your changes. I add a file `/etc/mosquitto/conf.d/mossy.conf` containing

```auto
listener 1883
allow_anonymous true
log_timestamp true
log_timestamp_format %Y-%m-%d %H:%M:%S

```

Which allows remote access and also configures the mosquitto log to have human readable timestamps.  
On systems where I have users/pwds then that setup goes in that file too.

---

<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:** [21 September 2022 20:21 UTC](https://discourse.nodered.org/t/setting-up-a-live-prod-and-a-development-system/67415/21 "2022-09-21T20:21:55Z")

</div>

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