eclipse-mosquitto / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
9.08k stars 2.4k forks source link

Can't get out of local only mode #2970

Open CZonin opened 11 months ago

CZonin commented 11 months ago

I've had mosquitto (2.0.18) running and working for services on the host machine for awhile now without any issues. Recently, I've been trying to get it to be reached by other devices on my network, but no matter what I do, it starts in local only mode.

Here's my docker-compose:

version: "3"
services:
  mosquitto:
    image: eclipse-mosquitto
    container_name: mosquitto
    restart: unless-stopped
    # network_mode: host
    ports:
      - "1883:1883" #default mqtt port
      - "9001:9001" #default mqtt port for websockets
    volumes:
      - /home/czonin/mosquitto/conf:/mosquitto/conf
      - /home/czonin/mosquitto/data:/mosquitto/data
      - /home/czonin/mosquitto/log:/mosquitto/log
    environment:
        - TZ=America/New_York
        - PUID=1000
        - PGID=1000

mosquitto.conf

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
protocol websockets
## Authentication ##
allow_anonymous true
password_file /mosquitto/conf/mosquitto.conf

I've checked the config file within the container to make sure it's mapping to my local file which it is. I've tried with listener 9001 and without protocol websockets in the config, but no luck.

Any ideas?

SebWo87 commented 10 months ago

Hi, I recently had the same issue, but was due to missing 'listener 1883' entry. What is the output of the log files? As far as I know, 'allow_anonymous true' is in conflict with the presents of a password file. If you want to use a username and password, remove 'allow_anonymous' or change its value to false.