1
0
mirror of https://github.com/daniviga/bite.git synced 2024-11-24 22:06:13 +01:00

Compare commits

..

No commits in common. "2e0da9513d6d0b46af8a022689947b8b48b953cd" and "c020d2c9ad28734cfc450c72d539f599c84eac96" have entirely different histories.

7 changed files with 55 additions and 23 deletions

View File

@ -52,7 +52,7 @@ safe configuration (see https://github.com/docker/compose/issues/2999).
```bash ```bash
docker-compose -f docker/docker-compose.yml build docker-compose -f docker/docker-compose.yml build
docker-compose -f docker/docker-compose.yml up -d [--scale {bite,dispatcher)=N] docker-compose -f docker/docker-compose.yml up -d [--scale {bite,mqtt-to-db)=N]
``` ```
It exposes: It exposes:
@ -72,10 +72,8 @@ It exposes:
- `http://localhost:80` (HTTP and MQTT over Websockets) - `http://localhost:80` (HTTP and MQTT over Websockets)
- `http://localhost:8080` (Django's `runserver`) - `http://localhost:8080` (Django's `runserver`)
- `tcp://localhost:1883` (MQTT via Nginx streams) - `tcp://localhost:1883` (MQTT)
- `tcp://localhost:18883` (MQTT via Mosquitto) - `tcp://localhost:9001` (MQTT over Websockets)
- `tcp://localhost:9001` (MQTT over Websockets via Mosquitto)
- `tcp://localhost:29092` (Kafka)
- `udp://localhost:123` (NTP) - `udp://localhost:123` (NTP)
- `tcp://localhost:5432` (PostgreSQL/Timescale) - `tcp://localhost:5432` (PostgreSQL/Timescale)
@ -98,6 +96,13 @@ Django runs with `DEBUG = False` and `SKIP_WHITELIST = False`
The project provides multiple modules that can be combined with the fore-mentioned configurations. 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 ### VerneMQ
A ~8x memory usage can be expected compared to Mosquitto. A ~8x memory usage can be expected compared to Mosquitto.

View File

@ -26,7 +26,7 @@ services:
broker: broker:
ports: ports:
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:18883:1883" - "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883"
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:9001:9001" - "${CUSTOM_DOCKER_IP:-0.0.0.0}:9001:9001"
bite: bite:

View File

@ -59,6 +59,8 @@ services:
- "./mqtt/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf" - "./mqtt/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf"
networks: networks:
- net - net
ports:
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883"
zookeeper: zookeeper:
image: confluentinc/cp-zookeeper:latest image: confluentinc/cp-zookeeper:latest
@ -89,7 +91,6 @@ services:
NGINX_ENTRYPOINT_QUIET_LOGS: 1 NGINX_ENTRYPOINT_QUIET_LOGS: 1
ports: ports:
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:80:80" - "${CUSTOM_DOCKER_IP:-0.0.0.0}:80:80"
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883"
networks: networks:
- net - net
volumes: volumes:

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# vim: tabstop=2 shiftwidth=2 softtabstop=2
#
# BITE - A Basic/IoT/Example
# Copyright (C) 2020-2021 Daniele Viganò <daniele@vigano.me>
#
# 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 <http://www.gnu.org/licenses/>.
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(`/`)"

View File

@ -54,8 +54,7 @@ http {
server bite:8000; server bite:8000;
} }
upstream mqtt {
upstream mqtt-ws {
# We point to the Docker 'service' instead of directly to the container # We point to the Docker 'service' instead of directly to the container
# Docker does then a DNS round-robin internally # Docker does then a DNS round-robin internally
server broker:9001; server broker:9001;
@ -86,7 +85,7 @@ http {
} }
location /mqtt { location /mqtt {
proxy_pass http://mqtt-ws; proxy_pass http://mqtt;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
@ -102,16 +101,3 @@ http {
} }
} }
} }
stream {
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;
}
server {
listen 1883;
proxy_pass mqtt;
}
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 122 KiB