stop using in-container mqtt, but use external one

This commit is contained in:
Dobromir Popov
2023-05-15 13:43:49 +03:00
parent 9d8c3d74c4
commit 3749143faf
2 changed files with 13 additions and 12 deletions

View File

@@ -10,13 +10,13 @@ services:
- DATABASE_PASS=mitko2021
- GARDEN_IP=0.0.0.0
# - GARDEN_IP=192.168.0.100
- MQTT_HOST=node-mqtt
- MQTT_HOST=192.168.0.10
- MQTT_PORT_HTTP=1883
- MQTT_PORT_HTTPS=8444
- MQTT_ESP_NAME=Garden
depends_on:
- node-mysql
- node-mqtt
#- node-mqtt
restart: always
ports:
- 2081:2080
@@ -32,13 +32,13 @@ services:
volumes:
- iotdbdata:/var/lib/mysql
# for mitko:mqtt
node-mqtt:
image: eclipse-mosquitto
command: mosquitto -c /mosquitto-no-auth.conf
hostname: node-mqtt
ports:
- 1885:1883
- 10883:1883
restart: always
# node-mqtt:
# image: eclipse-mosquitto
# command: mosquitto -c /mosquitto-no-auth.conf
# hostname: node-mqtt
# ports:
# - 1885:1883
# - 10883:1883
# restart: always
volumes:
iotdbdata:

View File

@@ -180,7 +180,7 @@ mqtt_client.on("message", function (topic, message) {
}
if (topic === EspDeviceName + "/ping") {
try {
console.log("MQTT> processing /ping message. Payload:" + context);
//console.log("MQTT> processing /ping message. Payload:" + context);
var data = context.replace(/^\{|\}$/g, '').split('|');
var ip = data[4].replace(/"/g, '');
if (ip != config.gardenIP) {
@@ -189,6 +189,7 @@ mqtt_client.on("message", function (topic, message) {
let newConfig = require(configPath);
newConfig[env].gardenIP = ip;
fs.writeFileSync(configPath, JSON.stringify(newConfig, null, 2));
handled = true;
console.log("Got NEW reporded garden controller IP: " + ip + ". new value stored in persistent settings storage");
}
} catch (e) {