From 2e11e82ac53d39f8ec64346e620b00ca30652706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Fri, 22 Aug 2025 18:01:42 +0300 Subject: [PATCH] docker compose example with included MQTT broker --- docker/docker-compose/README.md | 1 + .../single_transport_local_mqtt/README.md | 11 +++ .../docker-compose.yml | 75 +++++++++++++++++++ .../mosquitto_config/mosquitto.conf | 7 ++ 4 files changed, 94 insertions(+) create mode 100644 docker/docker-compose/single_transport_local_mqtt/README.md create mode 100644 docker/docker-compose/single_transport_local_mqtt/docker-compose.yml create mode 100644 docker/docker-compose/single_transport_local_mqtt/mosquitto_config/mosquitto.conf diff --git a/docker/docker-compose/README.md b/docker/docker-compose/README.md index c6bc21bc..2ae7ace0 100644 --- a/docker/docker-compose/README.md +++ b/docker/docker-compose/README.md @@ -10,6 +10,7 @@ We provide some gateway configuration examples. These are listed below: | Configuration | Purpose | Link | | ------------- | ---- | --- | |Single transport | A simple use case with a single sink and a single transport | [Single transport](./single_transport/docker-compose.yml) | +|Single transport with local MQTT | Single transport configuration with a local MQTT broker | [Single transport with local MQTT](./single_transport_local_mqtt/docker-compose.yml) | | Dual transport | Use case with two transports to route traffic from selected endpoints to two distinct backends. This can be used for instance to route traffic from an application to a customer backend and diagnostic traffic to WNT | [Dual transport](./dual_transport/docker-compose.yml) | All the example templates provided (docker-compose.yml) can be updated to fit your environment. diff --git a/docker/docker-compose/single_transport_local_mqtt/README.md b/docker/docker-compose/single_transport_local_mqtt/README.md new file mode 100644 index 00000000..13f51df9 --- /dev/null +++ b/docker/docker-compose/single_transport_local_mqtt/README.md @@ -0,0 +1,11 @@ +# Single transport with local MQTT broker example + +This example is based on the [single transport example](../single_transport/README.md). +The configuration instructions from single transport can be followed. In this +example, the MQTT broker is added to the docker compose file as a container, so +you don't have to set up and configure an MQTT broker separately. + +The MQTT broker is configured insecurely, therefore this example is mainly +intended for quickly setting up a gateway for development purposes. The broker +can be reached from TCP port 1883 and via websockets on port 9001. + diff --git a/docker/docker-compose/single_transport_local_mqtt/docker-compose.yml b/docker/docker-compose/single_transport_local_mqtt/docker-compose.yml new file mode 100644 index 00000000..c1b9f6eb --- /dev/null +++ b/docker/docker-compose/single_transport_local_mqtt/docker-compose.yml @@ -0,0 +1,75 @@ +volumes: + dbus-volume: + +services: + dbus-service: + image: wirepas/gateway_dbus_service:${GATEWAY_TAG:-latest} + container_name: dbus + restart: always + volumes: + - type: volume + source: dbus-volume + target: /var/run/dbus + logging: + driver: journald + + + transport-service: + image: wirepas/gateway_transport_service:${GATEWAY_TAG:-latest} + container_name: transport-service + environment: + WM_SERVICES_MQTT_HOSTNAME: "mqtt-broker" + WM_SERVICES_MQTT_PORT: "1883" + WM_SERVICES_MQTT_FORCE_UNSECURE: "True" + # To be modified + WM_GW_ID: + WM_GW_MODEL: + WM_GW_VERSION: + restart: always + depends_on: + - dbus-service + - mqtt-broker + volumes: + - type: volume + source: dbus-volume + target: /var/run/dbus + logging: + driver: journald + + + sink-service: + image: wirepas/gateway_sink_service:${GATEWAY_TAG:-latest} + container_name: sink-service + restart: on-failure + depends_on: + - dbus-service + devices: + # To be modified + - :/dev/mysink + environment: + WM_GW_SINK_BAUDRATE: + WM_GW_SINK_ID: + # Do not change (path of sink in container) + WM_GW_SINK_UART_PORT: /dev/mysink + volumes: + - type: volume + source: dbus-volume + target: /var/run/dbus + logging: + driver: journald + + + mqtt-broker: + image: eclipse-mosquitto:latest + container_name: mqtt-broker + restart: on-failure + volumes: + - type: bind + source: mosquitto_config/ + target: /mosquitto/config/ + ports: + - "1883:1883/tcp" + - "9001:9001/tcp" + logging: + driver: journald + diff --git a/docker/docker-compose/single_transport_local_mqtt/mosquitto_config/mosquitto.conf b/docker/docker-compose/single_transport_local_mqtt/mosquitto_config/mosquitto.conf new file mode 100644 index 00000000..d19fca8f --- /dev/null +++ b/docker/docker-compose/single_transport_local_mqtt/mosquitto_config/mosquitto.conf @@ -0,0 +1,7 @@ +listener 1883 + +listener 9001 +protocol websockets + +allow_anonymous true +