Skip to content

Commit 30c8afa

Browse files
luiscoutinhbestlong
authored andcommitted
Add mosquitto broker (laradock#1914)
* Add mosquitto broker * Add documetation to mosquitto
1 parent 3e771db commit 30c8afa

5 files changed

Lines changed: 885 additions & 0 deletions

File tree

DOCUMENTATION/content/documentation/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,30 @@ docker-compose up -d grafana
11211121

11221122

11231123

1124+
<br>
1125+
<a name="Use-Mosquitto"></a>
1126+
## Use Mosquitto (MQTT Broker)
1127+
1128+
1 - Configure Mosquitto: Change Port using `MOSQUITTO_PORT` if you wish to. Default is port 9001.
1129+
1130+
2 - Run the Mosquitto Container (`mosquitto`) with the `docker-compose up`command:
1131+
1132+
```bash
1133+
docker-compose up -d mosquitto
1134+
```
1135+
1136+
3 - Open your command line and use a MQTT Client (Eg. https://github.com/mqttjs/MQTT.js) to subscribe a topic and publish a message.
1137+
1138+
4 - Subscribe: `mqtt sub -t 'test' -h localhost -p 9001 -C 'ws' -v`
1139+
1140+
5 - Publish: `mqtt pub -t 'test' -h localhost -p 9001 -C 'ws' -m 'Hello!'`
1141+
1142+
1143+
1144+
1145+
1146+
1147+
11241148
<br>
11251149
<a name="CodeIgniter"></a>
11261150

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ volumes:
3939
driver: ${VOLUMES_DRIVER}
4040
elasticsearch:
4141
driver: ${VOLUMES_DRIVER}
42+
mosquitto:
43+
driver: ${VOLUMES_DRIVER}
4244

4345
services:
4446

@@ -1304,3 +1306,15 @@ services:
13041306
backend:
13051307
aliases:
13061308
- fetchmail
1309+
1310+
### MOSQUITTO Broker #########################################
1311+
mosquitto:
1312+
build:
1313+
context: ./mosquitto
1314+
volumes:
1315+
- ${DATA_PATH_HOST}/mosquitto/data:/mosquitto/data
1316+
ports:
1317+
- "${MOSQUITTO_PORT}:9001"
1318+
networks:
1319+
- frontend
1320+
- backend

env-example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,3 +619,7 @@ MAILU_ADMIN=true
619619
MAILU_WEBMAIL=rainloop
620620
# Dav server implementation (value: radicale, none)
621621
MAILU_WEBDAV=radicale
622+
623+
### MOSQUITTO #################################################
624+
625+
MOSQUITTO_PORT=9001

mosquitto/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM eclipse-mosquitto:latest
2+
3+
LABEL maintainer="Luis Coutinho <luis@luiscoutinho.pt>"
4+
5+
COPY mosquitto.conf /mosquitto/config/

0 commit comments

Comments
 (0)