Open ChocolateLoverRaj opened 3 days ago
can you show the content of config/mosquitto.conf
?
Note in particular:
mosquitto-1 | 1730655922: Create a configuration file which defines a listener to allow remote access.
mosquitto-1 | 1730655922: For more details see https://mosquitto.org/documentation/authentication-methods/
I think you are right in that the example doesn't work. This is what I've done to seemingly make it work:
$ mkdir config
$ cat | tee config/mosquitto.conf <<EOF
listener 1883
allow_anonymous true
EOF
Note the changed mounts in the docker compose file (docker-compose-mqtt.yml
)
services:
otrecorder:
image: owntracks/recorder
ports:
- 8083:8083
volumes:
- config:/config
- store:/store
restart: unless-stopped
environment:
OTR_HOST: mosquitto
mosquitto:
image: eclipse-mosquitto
ports:
- 1883:1883
- 8883:8883
volumes:
- ./config:/mosquitto/config/:rw
- ./data:/mosquitto/data:rw
- ./log:/mosquitto/log:rw
restart: unless-stopped
volumes:
store:
config:
$ docker compose -f docker-compose-mqtt.yml up
Attaching to mosquitto-1, otrecorder-1
mosquitto-1 | 1730723136: mosquitto version 2.0.20 starting
mosquitto-1 | 1730723136: Config loaded from /mosquitto/config/mosquitto.conf.
mosquitto-1 | 1730723136: Opening ipv4 listen socket on port 1883.
mosquitto-1 | 1730723136: Opening ipv6 listen socket on port 1883.
mosquitto-1 | 1730723136: mosquitto version 2.0.20 running
otrecorder-1 | + version 0.9.9 starting with STORAGEDIR=/store
otrecorder-1 | + connecting to MQTT on mosquitto:1883 as clientID ot-recorder-8db6593673cb-8 without TLS
mosquitto-1 | 1730723136: New connection from 172.22.0.2:60896 on port 1883.
mosquitto-1 | 1730723136: New client connected from 172.22.0.2:60896 as ot-recorder-8db6593673cb-8 (p2, c0, k60).
otrecorder-1 | + HTTP listener started on 0.0.0.0:8083, without browser-apikey
otrecorder-1 | + HTTP prefix is unset
otrecorder-1 | + Using storage at /store with precision 7
otrecorder-1 | + Configured with revgeo=true and geokey: nil
otrecorder-1 | + TZDATADB is at /config/timezone16.bin: R_OK
otrecorder-1 | + Subscribing to owntracks/# (qos=2)
This definitely needs checking by somebody who knows what they're doing with docker.
With your changes it worked for me. Ideally the mosquitto configuration should be able to be configured in docker-compose.yml
right?
The path to the file can. Its content cannot, I think.
Docker version 27.3.1, build v27.3.1 My
docker-compose.yml
:Then I ran
docker compose up
as root and this happens:and it keeps repeating the last 3 lines over and over.
Does the Docker with MQTT example need to be updated?