owntracks / talk

Questions, talk about OwnTracks
32 stars 4 forks source link

Docker compose support #147

Closed techtimo closed 2 years ago

techtimo commented 2 years ago

Hi all, I need some support becasue I'm not able to get further for a few days here. I have a docker compose file running the MQTT broker and the owntracks recorder similar to the solution described here: https://github.com/owntracks/docker-recorder#all-in-one-solution-with-reverse-proxy-and-lets-encrypt

I have created the passwd file with the following command: sudo docker run -it -v ..../mosquitto/conf/:/opt/mosquitto/config eclipse-mosquitto mosquitto_passwd -c /opt/mosquitto/config/passwd user Looking at the file content it looks like it has been created properly. but the otrecroder container complains about

If I start the docker compose I get the following logs:

Recreating owntracks_otrecorder_1 ... done
Starting mqtt                     ... done
Attaching to owntracks_otrecorder_1, mqtt
mqtt          | 1659564922: mosquitto version 2.0.14 starting
mqtt          | 1659564922: Config loaded from /mosquitto/config/mosquitto.conf.
mqtt          | 1659564922: Opening ipv4 listen socket on port 8883.
mqtt          | 1659564922: Opening ipv6 listen socket on port 8883.
mqtt          | 1659564922: Opening websockets listen socket on port 8083.
otrecorder_1  | ot-recorder[12]: version 0.8.8 starting with STORAGEDIR=/store
otrecorder_1  | ot-recorder[12]: connecting to MQTT on mqtt.no-cloud.eu:8883 as clientID ot-recorder-dd7ec61f8262-12 with TLS
otrecorder_1  | ot-recorder[12]: HTTP listener started on 0.0.0.0:8083
otrecorder_1  | ot-recorder[12]: Using storage at /store with precision 7
mqtt          | 1659564922: mosquitto version 2.0.14 running
mqtt          | 1659564923: New connection from 172.20.0.1:44116 on port 8883.
mqtt          | 1659564923: Client ot-recorder-dd7ec61f8262-12 disconnected, not authorised.
otrecorder_1  | ot-recorder[12]: Subscribing to owntracks/# (qos=2)
otrecorder_1  | ot-recorder[12]: Disconnected. Reason: 0x5 [Connection refused: bad username or password]
otrecorder_1  | ot-recorder[12]: MQTT connection: rc=5 [The connection was refused.] (errno=2; No such file or directory). Sleeping...

I can see that the passwd file is changed depending on the password I provide in the stdin. Then I update the env variables for the otrecorder:

      - OTR_USER="user"
      - OTR_PASS="new-password"

But I continue to get the same issue.

I cannot find anything about how the password should be created for the broker in the booklet nor on github - I hope you can shed some light into my issue. Thanks

PS I think for OTR_CAFILE it should be enough to specify the bundle file from let's encrypt instead of creating this file with the 6 intermediate certs.

jpmens commented 2 years ago

Judging by the log you show, the Recorder is attempting to connect to MQTT on mqtt.no-cloud.eu:8883 which I don't think is actually what you're trying to accomplish.

For your own MQTT broker the password is indeed created with the mosquitto_passwd program, so that is fine. On the Recorder side, the user and password are specified in the OTR_USER and OTR_PASS environment variables (or in config file, etc.), and this combination (given in clear text) must match the combination you specified when creating the Mosquitto password file entry.

techtimo commented 2 years ago

Hi Jan Piet,

thanks for your prompt help! The I somewhat suppose that the port is also in the readme of the docker image.

Now the recorder is connected to the MQTT Server and I can see that the DB is still empty yet.

Best Greetings from Germany, Timo