Long story short, I've been trying to deploy a mosquitto mqtt broker to heroku. After several days and a lot of browsing, reading docs and other SO questions I just can't get it to work. The broker image does work locally but whenever I upload it to heroku, the log shows an R10 and H20 error (the "app boot timeout" one) which is my only clue to as to why this isn't working. I used docker to create an image of the mosquitto broker with this docker-compose.yml config file:
version: '3'
services:
mqtt:
container_name: mqtt
image: eclipse-mosquitto:latest
restart: unless-stopped
ports:
- 1883:1883
- 9001:9001
volumes:
- /MYPATH/mosquitto/config:/mosquitto/config
- /MYPATH/mosquitto/data:/mosquitto/data
- /MYPATH/mosquitto/log:/mosquitto/log
volumes:
config:
data:
log:
Here I've tried removing the ports and adding network_mode: "host"
as seen in another question but to no avail.
My mosquitto.conf is like this:
listener 1883 0.0.0.0
protocol websockets
persistence true
persistence_location /mosquitto/data
allow_anonymous true
I'm only trying the basics here, not even password or anything until I can get this to work. To deploy I go with
heroku login heroku container:login docker tag APPNAME registry.heroku.com/APPNAME/web docker registry.heroku.com/APPNAME/web heroku container:release --app APPNAME web
- Is it enough with this but some params are off?
- Do I need to create an app for the broker to run in? If so, What kind of app?
Please I'd appreciate any input on this, as anything I've seen similar to this hasn't worked.
Similar questions I've tried to adapt to my "solution":