diff --git a/README.md b/README.md index 5be5026..f72af79 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ safe configuration (see https://github.com/docker/compose/issues/2999). ```bash docker-compose -f docker/docker-compose.yml build -docker-compose -f docker/docker-compose.yml up -d [--scale {bite,mqtt-to-db)=N] +docker-compose -f docker/docker-compose.yml up -d [--scale {bite,dispatcher)=N] ``` It exposes: @@ -72,8 +72,10 @@ It exposes: - `http://localhost:80` (HTTP and MQTT over Websockets) - `http://localhost:8080` (Django's `runserver`) -- `tcp://localhost:1883` (MQTT) -- `tcp://localhost:9001` (MQTT over Websockets) +- `tcp://localhost:1883` (MQTT via Nginx streams) +- `tcp://localhost:18883` (MQTT via Mosquitto) +- `tcp://localhost:9001` (MQTT over Websockets via Mosquitto) +- `tcp://localhost:29092` (Kafka) - `udp://localhost:123` (NTP) - `tcp://localhost:5432` (PostgreSQL/Timescale) @@ -96,13 +98,6 @@ Django runs with `DEBUG = False` and `SKIP_WHITELIST = False` The project provides multiple modules that can be combined with the fore-mentioned configurations. -### Traefik - -To use [Traefik](https://containo.us/traefik/) instead of Nginx use: -```bash -docker-compose -f docker/docker-compose.yml up -f docker/ingress/docker-compose.traefik.yml -d -``` - ### VerneMQ A ~8x memory usage can be expected compared to Mosquitto. diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index 7b75d4a..5ac48e6 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -26,7 +26,7 @@ services: broker: ports: - - "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883" + - "${CUSTOM_DOCKER_IP:-0.0.0.0}:18883:1883" - "${CUSTOM_DOCKER_IP:-0.0.0.0}:9001:9001" bite: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index ad9fc50..892eccd 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -59,8 +59,6 @@ services: - "./mqtt/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf" networks: - net - ports: - - "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883" zookeeper: image: confluentinc/cp-zookeeper:latest @@ -91,6 +89,7 @@ services: NGINX_ENTRYPOINT_QUIET_LOGS: 1 ports: - "${CUSTOM_DOCKER_IP:-0.0.0.0}:80:80" + - "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883" networks: - net volumes: diff --git a/docker/ingress/docker-compose.traefik.yml b/docker/ingress/docker-compose.traefik.yml deleted file mode 100644 index 5cb51ad..0000000 --- a/docker/ingress/docker-compose.traefik.yml +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: tabstop=2 shiftwidth=2 softtabstop=2 -# -# BITE - A Basic/IoT/Example -# Copyright (C) 2020-2021 Daniele ViganĂ² -# -# BITE is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BITE is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -version: "3.7" - -services: - ingress: - <<: *service_default - image: traefik:v2.2 - command: --api.insecure=true --providers.docker - ports: - - "8000:80" - - "8080:8080" - networks: - - net - volumes: - # So that Traefik can listen to the Docker events - - /var/run/docker.sock:/var/run/docker.sock - restart: always - init: true - - bite: - labels: - - "traefik.http.routers.bite.rule=PathPrefix(`/`)" diff --git a/docker/ingress/nginx.conf b/docker/ingress/nginx.conf index 71b7cfb..8ec19b6 100644 --- a/docker/ingress/nginx.conf +++ b/docker/ingress/nginx.conf @@ -55,6 +55,12 @@ http { } upstream mqtt { + # We point to the Docker 'service' instead of directly to the container + # Docker does then a DNS round-robin internally + server broker:1883; + } + + upstream mqtt-ws { # We point to the Docker 'service' instead of directly to the container # Docker does then a DNS round-robin internally server broker:9001; @@ -85,7 +91,7 @@ http { } location /mqtt { - proxy_pass http://mqtt; + proxy_pass http://mqtt-ws; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; @@ -101,3 +107,10 @@ http { } } } + +stream { + server { + listen 1883; + proxy_pass mqtt; + } +} diff --git a/docs/application_chart.odg b/docs/application_chart.odg index e7ca904..a5c7255 100644 Binary files a/docs/application_chart.odg and b/docs/application_chart.odg differ diff --git a/docs/application_chart.png b/docs/application_chart.png index 1d02671..8cf981c 100644 Binary files a/docs/application_chart.png and b/docs/application_chart.png differ