Skip to content

Commit

Permalink
Add readme for MQTT broker
Browse files Browse the repository at this point in the history
  • Loading branch information
aeshub committed Feb 2, 2022
1 parent 0b989be commit dd6e408
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 6 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Flotilla

Flotilla is the main point of access for operators to interact with multiple robots in a facility. The application consists of a [frontend](frontend/README.md) in React and a [backend](backend/README.md) in Python using the FastAPI framework.
Flotilla is the main point of access for operators to interact with multiple robots in a facility. The application
consists of a [frontend](frontend/README.md) in React, a [backend](backend/README.md) in Python using the FastAPI
framework and a Mosquitto MQTT Broker.

## Setup

Expand All @@ -15,20 +17,26 @@ git clone https://github.com/equinor/flotilla
Install docker using the [official documentation](https://docs.docker.com/engine/install/ubuntu/).

Install docker compose:

```
sudo apt update
sudo apt install docker-compose
```

Build the docker container:

```
sudo docker-compose build
```

Start Flotilla by running:

```
sudo docker-compose up
```

or

```
sudo docker-compose up --build
```
6 changes: 3 additions & 3 deletions broker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM eclipse-mosquitto:latest

COPY mosquitto.conf mosquitto/config/mosquitto.conf
COPY passwd_file mosquitto/config/passwd_file
COPY mosquitto/config/mosquitto.conf mosquitto/config/mosquitto.conf
COPY mosquitto/config/passwd_file mosquitto/config/passwd_file

EXPOSE 1883 9001

CMD ["mosquitto", "-p", "1883", "-c", "mosquitto/config/mosquitto.conf"]
CMD ["mosquitto", "-p", "1883", "-c", "mosquitto/config/mosquitto.conf"]
46 changes: 46 additions & 0 deletions broker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Mosquitto MQTT Broker

## Running the broker

Start by building the docker image

```
docker build -t flotilla-broker .
```

The broker may be started as

```
docker run -it -p 1883:1883 -p 9001:9001 flotilla-broker:latest
```

## Authentication

The broker has been setup with a default configuration where the username and password is

```
username = mosquitto
password = default
```

To change the password replace the [password file](./passwd_file) with a new file containing a username and password.
See [this guide](https://mosquitto.org/documentation/authentication-methods/) on how to manage the password file.

## Using broker locally

### Installation

To install the Mosquitto broker run the following commands

```
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudo apt-get install mosquitto
sudo apt-get install mosquitto-clients
```

The broker may be started with

```
mosquitto -p 1883 -c mosquitto/config/mosquitto.conf
```
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ persistence_location /mosquitto/data/
# Use "log_dest none" if you wish to disable logging.
log_dest stderr
log_dest topic
log_dest file mosquitto/mosquitto.log
log_dest file mosquitto/log/mosquitto.log
log_dest stdout


Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions broker/mosquitto/log/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mosquitto.log
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ services:
build: broker
ports:
- '1883:1883'
- '9001:9001'
network_mode: host

0 comments on commit dd6e408

Please sign in to comment.