summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compose.yaml8
-rw-r--r--mqtt_client/main.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/compose.yaml b/compose.yaml
index 4e4def4..db32d4c 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -17,12 +17,18 @@ services:
- type: bind
source: ./mosquitto-config/
target: /mosquitto/config/
+ networks:
+ - mosquitto
mqtt-client:
environment:
MQTT_CLIENT_USER: ${MQTT_CLIENT_USER}
MQTT_CLIENT_PASSWORD: ${MQTT_CLIENT_PASSWORD}
build:
context: ./mqtt_client/
- network_mode: "service:mosquitto"
+ networks:
+ - mosquitto
depends_on:
- mosquitto
+
+networks:
+ mosquitto:
diff --git a/mqtt_client/main.py b/mqtt_client/main.py
index 80b4da9..dad09b5 100644
--- a/mqtt_client/main.py
+++ b/mqtt_client/main.py
@@ -34,7 +34,7 @@ connected = False
while(not connected):
try:
- mqttc.connect("127.0.0.1", 1883, 60, '', 0, True)
+ mqttc.connect("mosquitto", 1883, 60, '', 0, True)
connected = True
except ConnectionRefusedError:
print("Failed to connect. Retrying...")