From d587921eda84c58378e8551b669dbdc3e23db853 Mon Sep 17 00:00:00 2001 From: Drasko DRASKOVIC Date: Thu, 5 Mar 2020 13:34:07 +0100 Subject: [PATCH] Merged MQTT docker compose in core composition file (#1060) Signed-off-by: Nikola Marcetic --- Makefile | 4 +-- README.md | 2 +- docker/docker-compose.yml | 43 ++++++++++++++++++++++++++++++++ docker/mqtt.yml | 52 --------------------------------------- scripts/run.sh | 4 +-- 5 files changed, 48 insertions(+), 57 deletions(-) delete mode 100644 docker/mqtt.yml diff --git a/Makefile b/Makefile index cae7addf..df31f4ca 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ rundev: cd scripts && ./run.sh run: - docker-compose -f docker/docker-compose.yml -f docker/mproxy.yml up + docker-compose -f docker/docker-compose.yml up runlora: docker-compose \ @@ -120,4 +120,4 @@ runlora: # Run all Mainflux core services except distributed tracing system - Jaeger. Recommended on gateways: rungw: - MF_JAEGER_URL= docker-compose -f docker/docker-compose.yml -f docker/mproxy.yml up --scale jaeger=0 + MF_JAEGER_URL= docker-compose -f docker/docker-compose.yml up --scale jaeger=0 diff --git a/README.md b/README.md index e81832e4..9957d8e2 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Developing Mainflux will also require: Once the prerequisites are installed, execute the following commands from the project's root: ```bash -docker-compose -f docker/docker-compose.yml -f docker/mproxy.yml up +docker-compose -f docker/docker-compose.yml up ``` This will bring up the Mainflux docker services and interconnect them. This command can also be executed using the project's included Makefile: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 1a9b7e17..f49a3b03 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -13,6 +13,7 @@ volumes: mainflux-things-db-volume: mainflux-things-redis-volume: mainflux-es-redis-volume: + mainflux-mqtt-broker-volume: services: nginx: @@ -41,6 +42,7 @@ services: depends_on: - things - users + - mqtt-adapter - http-adapter - ws-adapter @@ -200,6 +202,47 @@ services: networks: - mainflux-base-net + vernemq: + image: mainflux/vernemq:1.10.1-alpine + container_name: mainflux-vernemq + restart: on-failure + environment: + DOCKER_VERNEMQ_ALLOW_ANONYMOUS: "on" + DOCKER_VERNEMQ_LOG__CONSOLE__LEVEL: info + ports: + - 18831:${MF_MQTT_BROKER_PORT} + - 8881:${MF_MQTT_BROKER_WS_PORT} + - 7777:8888 + networks: + - mainflux-base-net + volumes: + - mainflux-mqtt-broker-volume:/var/lib/vernemq + + mqtt-adapter: + image: mainflux/mqtt:latest + container_name: mainflux-mqtt + depends_on: + - vernemq + - things + - nats + restart: on-failure + environment: + MF_MQTT_ADAPTER_LOG_LEVEL: ${MF_MQTT_ADAPTER_LOG_LEVEL} + MF_MQTT_ADAPTER_PORT: ${MF_MQTT_ADAPTER_PORT} + MF_MQTT_ADAPTER_WS_PORT: ${MF_MQTT_ADAPTER_WS_PORT} + MF_MQTT_ADAPTER_ES_URL: es-redis:${MF_REDIS_TCP_PORT} + MF_NATS_URL: ${MF_NATS_URL} + MF_THINGS_URL: things:${MF_THINGS_AUTH_GRPC_PORT} + MF_JAEGER_URL: ${MF_JAEGER_URL} + MF_MQTT_ADAPTER_MQTT_TARGET_HOST: vernemq + MF_MQTT_ADAPTER_MQTT_TARGET_PORT: ${MF_MQTT_BROKER_PORT} + ports: + - 18832:${MF_MQTT_ADAPTER_PORT} + - 8882:${MF_MQTT_ADAPTER_WS_PORT} + networks: + - mainflux-base-net + + ws-adapter: image: mainflux/ws:latest container_name: mainflux-ws diff --git a/docker/mqtt.yml b/docker/mqtt.yml deleted file mode 100644 index 87f73e2d..00000000 --- a/docker/mqtt.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) Mainflux -# SPDX-License-Identifier: Apache-2.0 - -version: "3.7" - -volumes: - mainflux-mqtt-broker-volume: - -services: - nginx: - depends_on: - - mqtt-adapter - - vernemq: - image: mainflux/vernemq:1.10.1-alpine - container_name: mainflux-vernemq - restart: on-failure - environment: - DOCKER_VERNEMQ_ALLOW_ANONYMOUS: "on" - DOCKER_VERNEMQ_LOG__CONSOLE__LEVEL: info - ports: - - 18831:${MF_MQTT_BROKER_PORT} - - 8881:${MF_MQTT_BROKER_WS_PORT} - - 7777:8888 - networks: - - mainflux-base-net - volumes: - - mainflux-mqtt-broker-volume:/var/lib/vernemq - - mqtt-adapter: - image: mainflux/mqtt:latest - container_name: mainflux-mqtt - depends_on: - - vernemq - - things - - nats - restart: on-failure - environment: - MF_MQTT_ADAPTER_LOG_LEVEL: ${MF_MQTT_ADAPTER_LOG_LEVEL} - MF_MQTT_ADAPTER_PORT: ${MF_MQTT_ADAPTER_PORT} - MF_MQTT_ADAPTER_WS_PORT: ${MF_MQTT_ADAPTER_WS_PORT} - MF_MQTT_ADAPTER_ES_URL: es-redis:${MF_REDIS_TCP_PORT} - MF_NATS_URL: ${MF_NATS_URL} - MF_THINGS_URL: things:${MF_THINGS_AUTH_GRPC_PORT} - MF_JAEGER_URL: ${MF_JAEGER_URL} - MF_MQTT_ADAPTER_MQTT_TARGET_HOST: vernemq - MF_MQTT_ADAPTER_MQTT_TARGET_PORT: ${MF_MQTT_BROKER_PORT} - ports: - - 18832:${MF_MQTT_ADAPTER_PORT} - - 8882:${MF_MQTT_ADAPTER_WS_PORT} - networks: - - mainflux-base-net diff --git a/scripts/run.sh b/scripts/run.sh index 8ac6f372..0e40e5e0 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -56,9 +56,9 @@ MF_HTTP_ADAPTER_LOG_LEVEL=info MF_HTTP_ADAPTER_PORT=8185 MF_THINGS_URL=localhost MF_WS_ADAPTER_LOG_LEVEL=info MF_WS_ADAPTER_PORT=8186 MF_THINGS_URL=localhost:8183 $BUILD_DIR/mainflux-ws & ### -# MQTT mproxy +# MQTT ### -MF_MQTT_ADAPTER_LOG_LEVEL=info MF_THINGS_URL=localhost:8183 $BUILD_DIR/mainflux-mproxy & +MF_MQTT_ADAPTER_LOG_LEVEL=info MF_THINGS_URL=localhost:8183 $BUILD_DIR/mainflux-mqtt & ### # CoAP