54 lines
1.1 KiB
Markdown
54 lines
1.1 KiB
Markdown
|
# docker-mqtt
|
||
|
|
||
|
[![Build Status](https://drone.asperti.com/api/badges/paspo/docker-mqtt/status.svg)](https://drone.asperti.com/paspo/docker-mqtt)
|
||
|
|
||
|
Simple container for my online mqtt server
|
||
|
|
||
|
## build
|
||
|
|
||
|
```bash
|
||
|
docker build . -t docker.asperti.com/paspo/mqtt
|
||
|
```
|
||
|
|
||
|
## docker-compose
|
||
|
|
||
|
```yaml
|
||
|
version: "3"
|
||
|
services:
|
||
|
|
||
|
server:
|
||
|
image: docker.asperti.com/paspo/mqtt
|
||
|
volumes:
|
||
|
- /srv/mqtt/config:/etc/mosquitto
|
||
|
- /etc/letsencrypt/live/mqtt.mydomain.com/:/data/live/domain
|
||
|
- /etc/letsencrypt/archive/mqtt.mydomain.com/:/data/archive/mqtt.mydomain.com
|
||
|
ports:
|
||
|
- "8883:8883"
|
||
|
- "8983:8983"
|
||
|
restart: always
|
||
|
|
||
|
```
|
||
|
|
||
|
This is the configuration (mosquitto.conf):
|
||
|
```
|
||
|
listener 8883
|
||
|
certfile /data/live/domain/cert.pem
|
||
|
cafile /data/live/domain/chain.pem
|
||
|
keyfile /data/live/domain/privkey.pem
|
||
|
log_dest syslog
|
||
|
allow_anonymous false
|
||
|
password_file /etc/mosquitto/passwd
|
||
|
|
||
|
listener 8983
|
||
|
psk_hint go away
|
||
|
psk_file /etc/mosquitto/pskfile
|
||
|
```
|
||
|
|
||
|
The first port is used with a passwd file, that you can create in the usual way.
|
||
|
|
||
|
You also need to create a file named "pskfile" to access the "secondary" port, with this syntax:
|
||
|
```
|
||
|
user1:password1
|
||
|
user2:password2
|
||
|
```
|