I want to set up an MQTT broker on my QNAP NAS (TS-230) so I’ve installed the ContainerStation and created an eclipse-mosquitto container. However, it starts in local mode only so I need to modify the config file. It says its loaded from /mosquitto/config/mosquitto.conf but I can’t find where this is located anywhere on the NAS. Has anyone done this kind of setup before?
I’ve made some progress. When eclipse-mosquitto is running there is a terminal option and running a shell allows the config file to be accessed and modified. I now have eclipse-mosquitto up and running with anonymous access but can’t find out how to access it. I’m using port 1883 but this is not open on the NAS. Running a docker inspect command shows no network information.
Finally figured it out. Just in case anyone else is struggling with this, here’s what I did:
- Install ContainerStation and open it
- Click Create and search for eclipse-mosquitto
- Leave everything at default except the command. Change the -c option to -c mosquito-no-auth.conf
- In Overview click on the eclipse-mosquitto-1 container
- Click Settings
- Click Advanced Settings
- Click Network and change Network Mode from NAT to Host
- Click Apply - mosquitto should restart and you’re good to go.
Hi, maybe a silly question, but how do you edit that config file? I can’t find that config file
?
That is the easiest way to setup Mosquitto MQTT to work in the QNAP
- Create mosquitto config file in text editor with name: mosquitto.conf
File content:
"
persistence true
persistence_location /mosquitto/data
listener 1883
log_dest file /mosquitto/log/mosquitto.log
log_timestamp_format %Y-%m-%dT%H:%M:%S
allow_anonymous true
" - Create a share folder: YOURFOLDERNAME on NAS or use existing one, then create subfolder name: mosquitto
- Upload the previously prepared file:‘‘mosquitto.conf’’ to folder : mosquitto
- In Container Station application click on ‘‘Create’’ - Then search for “eclipse mosquitto” in the list of available images , selecting “Docker Hub” as the source.
- Go to Advanced Settings →
Network - Network Mode - NAT
Host ->1883 Container ->1883 Protocol ->TCP
Shared Folders → Add
Volume from host → choose folder with mosquitto.conf file: YOURFOLDERNAME/mosquitto
Mount point : “/mosquitto/config” - Click on Create
MQTT should work now
If you want to setup an user.
- Open Mosquittto → Terminal → type ‘‘sh’’ and Enter
type: ''mosquitto_passwd -c /mosquitto/config/pwfile YOURUSERNAME ‘’ → hit Enter
Type twice YOURPASSWORD
Exit terminal
update file “mosquitto.conf”
‘’
persistence true
persistence_location /mosquitto/data
listener 1883
log_dest file /mosquitto/log/mosquitto.log
log_timestamp_format %Y-%m-%dT%H:%M:%S
allow_anonymous false
password_file /mosquitto/config/pwfile
‘’
Restart Mosquitto container
Well done!
It took me some time, but there is a typo: mosquito must be mosquitto ![]()
So the total command must be:
“/usr/sbin/mosquitto -c mosquitto-no-auth.conf”