Launching MQTT broker

Unable to get an MQTT broker launched onto fly. Tried following the appkata example from 2020 but it doesn’t seem to work any longer, and I’m not sure what needs to be done to fix it. Following the guide to a tee works until testing stages, where I run mosquitto_sub -L mqtts://<username>:<password> --cafile certs/rootCA.pem, and get back Error: Protocol error. Anyone successfully deployed a MQTT broker to Fly and wanna share?


I am having same issues. Tried with no SSL as well, different ports to no avail. I also made sure it is listening on all interfaces. Deploying the Dockerfile locally and exposing the ports work just as expected – it seems something is blocking the connection midway.

The relevant fly.toml parts is

  internal_port = 1883
  protocol = "tcp"
    handlers = []
    port = "1883"

As mentioned, I tried exposing the service port to 10000 as well but it made no difference. Mosquitto logs tell

1671948107: Opening ipv6 listen socket on port 1883.
1671948107: Opening ipv4 listen socket on port 1883.

so it should be listening on both interfaces ( and ::)

Make sure that you either exclusively use IPv6 (free) or allocate a IPv4 ($2/mo) for the MQTT Fly app: Announcement: Shared Anycast IPv4 - #3 by kurt

Other than that, I’m not sure if something else has fundamentally changed. What’s the error you see?