owntracks / docker-recorder

Docker image for OwnTracks Recorder
151 stars 68 forks source link

owntracks + traefik reverse proxy: connecting to MQTT on owntracks-mosquitto:1883 as clientID ot-recorder-f731dce6c941-7 without TLS Error: Connection refused #79

Closed deimjons closed 6 months ago

deimjons commented 7 months ago

Hello. I trying to setup owntracks with docker-compose and traefik.

version: '3.9'
services:
  owntracks:
    image: owntracks/recorder:latest
    container_name: owntracks
    depends_on: 
      - owntracks-mosquitto
    labels:
      traefik.enable: true
      traefik.docker.network: traefik

      traefik.http.routers.owntracks-http.rule: Host(`owntracks.example.com`)
      traefik.http.routers.owntracks-http.entrypoints: web
      traefik.http.routers.owntracks-http.middlewares: https-redirect

      traefik.http.routers.owntracks-https.rule: Host(`owntracks.example.com`)
      traefik.http.routers.owntracks-https.entrypoints: websecure
      traefik.http.routers.owntracks-https.tls: true
      traefik.http.routers.owntracks-https.tls.certresolver: prod
    environment:
      OTR_HOST: owntracks-mosquitto
      OTR_PORT: 1883
    volumes:
      - store:/store
      - config:/config
    networks:
      - traefik
      - owntracks
    # ports:
    #   - 8083:8083

  owntracks-mosquitto:
    image: eclipse-mosquitto
    container_name: owntracks-mosquitto
    restart: unless-stopped
    volumes:
      - mosquitto-data:/mosquitto/data
      - mosquitto-logs:/mosquitto/logs
      - mosquitto-conf:/mosquitto/config
    networks:
      - owntracks
    # ports:
    #   - 1883:1883
    #   - 8883:8883

volumes:
  store:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: $VOLUMES_PATH_PREFIX/owntracks/volumes/store
  config:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: $VOLUMES_PATH_PREFIX/owntracks/volumes/config
  mosquitto-data:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: $VOLUMES_PATH_PREFIX/owntracks/volumes/mosquitto-data
  mosquitto-logs:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: $VOLUMES_PATH_PREFIX/owntracks/volumes/mosquitto-logs
  mosquitto-conf:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: $VOLUMES_PATH_PREFIX/owntracks/volumes/mosquitto-conf

networks:
  traefik:
    external: true
  owntracks:
    name: owntracks

When I run compose file container creates but fall after run and I got error in logs of container:

connecting to MQTT on owntracks-mosquitto:1883 as clientID ot-recorder-f731dce6c941-7 without TLS Error: Connection refused

I do not change any other settings.. what I doing wrong??

jpmens commented 7 months ago

I can't well comment on this as the traeffik/docker stuff is beyond me.

The only thing I notice is you configure Recorder to use "OTR_HOST: owntracks-mosquitto", but is that name actually the hostname of the mosquitto broker?

deimjons commented 6 months ago

I can't well comment on this as the traeffik/docker stuff is beyond me. The only thing I notice is you configure Recorder to use "OTR_HOST: owntracks-mosquitto", but is that name actually the hostname of the mosquitto broker?

yes, this hostname I use for mosquitto inside the internal docker network