owntracks / docker-recorder

Docker image for OwnTracks Recorder
151 stars 68 forks source link

starting from docker compose doesnt recognize OTR_HOST and tries to connect to localhost anyway #77

Closed ozhound closed 8 months ago

ozhound commented 8 months ago

As the title says. I'm trying to set this up with the docker compose example that has the manual connection for an external mqtt broker (on the same LAN) but no matter how I format it, it appears to ignore the env entry and connect to localhost anyway.

i have the following compose file. I have checked a few times and i cant see anything wrong.

is this correct? Ive tried the ip and port with and without quotes and with and without http://

version: '3'

services:

  otrecorder:
    image: owntracks/recorder
    ports:
      - 8083:8083
    volumes:
#      - /mnt/configs/otrecorder/config:/config
      - /mnt/configs/otrecorder/storage:/store
    restart: unless-stopped
    environment:
      - OTR_HOST = "192.168.1.25"
      - OTR_PORT = "1883"
      - OTR_USER = "homeassistant"
      - OTR_PASS = "xxx"
volumes:
  store:
#  config:

this is the output


+ Skipping open defaults file /config/recorder.conf: No such file or directory
+ version 0.9.7 starting with STORAGEDIR=/store
+ connecting to MQTT on localhost:1883 as clientID ot-recorder-39bbc67f5c0e-7 without TLS
Error: Address not available
jpmens commented 8 months ago

(you'll want to change the password you're using, as it's still in the edit history of this ticket)

I'm not a docker specialist at all, but the only thing which I note is that your environment is a YAML list, whereas I sometimes see dicts as in this example. Maybe remove the leading dashes (-) on the values?

Just guessing!

ozhound commented 8 months ago

You were right!

I was just using the exact example from the readme.md on the github page, which, evidently is wrong

Thanks for your input

On Fri, 8 Mar 2024 at 16:02, Jan-Piet Mens @.***> wrote:

(you'll want to change the password you're using, as it's still in the edit history of this ticket)

I'm not a docker specialist at all, but the only thing which I note is that your environment is a YAML list, whereas I sometimes see dicts as in this example https://github.com/owntracks/docker-recorder/blob/master/docker-compose-mqtt.yml. Maybe remove the leading dashes (-) on the values?

Just guessing!

— Reply to this email directly, view it on GitHub https://github.com/owntracks/docker-recorder/issues/77#issuecomment-1985223017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA325VK266NC7D4A6ZTCYK3YXFWCTAVCNFSM6AAAAABEMIBXNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBVGIZDGMBRG4 . You are receiving this because you authored the thread.Message ID: @.***>

jpmens commented 8 months ago

Hmm, it doesn't seem to be wrong, at least by definition:

environment can use either an array or a map.

meaning either of the following ought to be valid (the first is the syntax you used):

environment:
   - OTR_HOST="192.168.1.25"
   - OTR_PORT=1883
environment:
   OTR_HOST: "192.168.1.25"
   OTR_PORT: "1883"

Is this some version-specific magic? I don't know ...

ckrey commented 8 months ago

seems to me there shouldn‘t be any white space around = in the array

jpmens commented 8 months ago

I could kick myself: I should have seen that because of my work with YAML in Ansible!

jpmens commented 8 months ago

Thanks @ckrey