Skip to content

Commit a448e86

Browse files
authored
Merge pull request #80 from Paraphraser/20200621-mosquitto-port9001
Mosquitto - remove port 9001 from template
2 parents 516b4dc + af34fb4 commit a448e86

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

.templates/mosquitto/service.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
restart: unless-stopped
55
user: "1883"
66
ports:
7-
- 1883:1883
8-
- 9001:9001
7+
- "1883:1883"
98
volumes:
109
- ./volumes/mosquitto/data:/mosquitto/data
1110
- ./volumes/mosquitto/log:/mosquitto/log

docs/Mosquitto.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- `docker-compose.yml`~/IOTstack/docker-compose.yml
1212
- `mosquitto.conf`~/IOTstack/services/mosquitto/mosquitto.conf
1313
- `mosquitto.log`~/IOTstack/volumes/mosquitto/log/mosquitto.log
14+
- `service.yml`~/IOTstack/.templates/mosquitto/service.yml
1415
- `volumes/mosquitto`~/IOTstack/volumes/mosquitto/
1516

1617
## Logging
@@ -166,3 +167,46 @@ If you have a use-case that needs Mosquitto to run with root privileges:
166167
```
167168

168169
> <small>A clean install of Mosquitto via the IOTstack menu sets everything in `volumes/mosquitto` to user and group 1883. That permission structure will still work if you change Mosquitto to run with root privileges. However, running as root **may** have the side effect of changing privilege levels within `volumes/mosquitto`. Keep this in mind if you decide to switch back to running Mosquitto as user 1883 because it is less likely to work.</small>
170+
171+
## Port 9001
172+
173+
In earlier versions of IOTstack, `service.yml` included two port mappings which were included in `docker-compose.yml` when Mosquitto was chosen in the menu:
174+
175+
```
176+
ports:
177+
- "1883:1883"
178+
- "9001:9001"
179+
```
180+
181+
[Issue 67](https://github.com/SensorsIot/IOTstack/issues/67) explored the topic of port 9001 and showed that:
182+
183+
* The base image for mosquitto did not expose port 9001; and
184+
* The running container was not listening to port 9001.
185+
186+
On that basis, the mapping for port 9001 was removed from `service.yml`.
187+
188+
If you have a use-case that needs port 9001, you can re-enable support by:
189+
190+
1. Inserting the port mapping under the `mosquitto` definition in `docker-compose.yml`:
191+
192+
```
193+
- "9001:9001"
194+
```
195+
196+
2. Inserting the following lines in `mosquitto.conf`:
197+
198+
```
199+
listener 1883
200+
listener 9001
201+
```
202+
203+
You need **both** lines. If you omit 1883 then mosquitto will stop listening to port 1883 and will only listen to port 9001.
204+
205+
3. Restarting the container:
206+
207+
```
208+
$ cd ~/IOTstack
209+
$ docker-compose up -d
210+
```
211+
212+
Please consider raising an issue to document your use-case. If you think your use-case has general application then please also consider creating a pull request to make the changes permanent.

0 commit comments

Comments
 (0)