Skip to content

Read this if your Mosquitto is broken #265

@Paraphraser

Description

@Paraphraser

Mosquitto quick fix

If you have just upgraded Mosquitto by doing:

$ cd ~/IOTstack
$ docker-compose pull
$ docker-compose up -d

and find that Mosquitto is no longer working, you have two options for getting your IOTstack working again:

  1. Pin to version 1.6.12 (quickest)
  2. Edit the configuration file (needs more thought)

Pin to version 1.6.12

  1. Edit the mosquitto service definition in docker-compose.yml to pin to version 1.6.12. Something like this will get the job done:

      mosquitto:
        container_name: mosquitto
        image: eclipse-mosquitto:1.6.12
    #   image: eclipse-mosquitto
    
  2. Repeat the upgrade process:

    $ docker-compose pull
    $ docker-compose up -d
    

    Mosquitto will downgrade to the previous version and resume its previous behaviour.

Edit the configuration file

The default configuration file for Mosquitto looks like this:

persistence true
persistence_location /mosquitto/data/
#log_dest file /mosquitto/log/mosquitto.log
# To avoid flash wearing
log_dest stdout

#Uncomment to enable passwords
#password_file /mosquitto/pwfile/pwfile
#allow_anonymous false

#Uncomment to enable filters
#acl_file /mosquitto/config/filter.acl

log_timestamp_format %Y-%m-%dT%H:%M:%S

The active version of the configuration file is at the path:

~/IOTstack/services/mosquitto/mosquitto.conf

You need to make the following changes to the active file:

  1. Add this line (anywhere in the file):

    listener 1883
    
  2. If and only if you have not implemented a password scheme for Mosquitto then allow_anonymous will still be commented-out. You need to change it to look like this:

    allow_anonymous true
    

    If you have previously implemented a password scheme for Mosquitto then allow_anonymous will be active and false, and should be left that way.

After you have edited the configuration file, apply the changes by doing:

$ docker-compose restart mosquitto

Mix-and-match

The configuration file changes described above are compatible with 1.6.12 so you can apply them while 1.6.12 is running, and take the decision to upgrade to version 2.x later.

Known issue with IOTstack Mosquitto configuration file

Under new menu (master branch), there is a known issue 258 where the active version of the Mosquitto configuration file can be overwritten by a menu run. Keep this in mind and make a backup.

Reference

See Migrating to Mosquitto 2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions