Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Setup MQTT integration #77

Open
TiannV opened this issue Mar 15, 2023 · 6 comments
Open

Error: Setup MQTT integration #77

TiannV opened this issue Mar 15, 2023 · 6 comments

Comments

@TiannV
Copy link

TiannV commented Mar 15, 2023

git clone from master, and run with docker-compose up,chirpstack connect to MQTT broker failed

chirpstack-docker-chirpstack-1                       | 2023-03-15T03:02:23.580980Z  INFO chirpstack::integration::mqtt: Connecting to MQTT broker server_uri=tcp://mosquitto:1883/ client_id=9281b01d204c43f2 clean_session=false
chirpstack-docker-chirpstack-1                       | Error: Setup MQTT integration
chirpstack-docker-chirpstack-1                       | 
chirpstack-docker-chirpstack-1                       | Caused by:
chirpstack-docker-chirpstack-1                       |     0: Connect to MQTT broker
chirpstack-docker-chirpstack-1                       |     1: [-1] TCP/TLS connect failure
@TiannV
Copy link
Author

TiannV commented Mar 15, 2023

image

@curio77
Copy link

curio77 commented Aug 4, 2023

Same here, on a Raspberry Pi with the docker-compose setup. Everything appears to be in order, the broker is running and reachable from the bare machine, also logs a connection (presumably by the chirpstack service), but the chirpstack service keeps restarting with this error.

Did you manage to solve this in the meantime?

@mskram
Copy link

mskram commented Aug 4, 2023

I've had this issue both times setting up Chirpstack in Docker.

I'm not 100% on what actually fixed it, but hopefully I can point you in the right direction.

I think the issue was either caused by firewall, docker networking or hostname lookup.

You should be able to test the connection using:

docker run --network="container:mosquitto" -it --rm efrecon/mqtt-client sub -h mosquitto -p 1883 -t "$SYS" -v

If you get "Connection refused" then check the IP of the mosquitto container and try replacing it in the test command.

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mosquitto
#192.168.176.2
docker run --network="container:mosquitto" -it --rm efrecon/mqtt-client sub -h 192.168.176.2 -p 1883 -t "$SYS" -v

If you use port mapping for the mosquitto container like

ports:
      - 1883:2883

then you have to point to the internal port in the .toml files and in the above test command.

@curio77
Copy link

curio77 commented Aug 4, 2023

Thank you for your helpful response. I'd already tried to rule out issues relating to the host by trying the machine's external IP (but can't say 100% that it wasn't an issue in this regard after all).

Meanwhile, I've had the most peculiar thing happen in that, ever since intermittently downgrading Mosquitto to v1.6 in the compose (without resolving the issue), then reinstating v2, it just works (and does so reliably, also across restarts of the compose).

@brocaar
Copy link
Collaborator

brocaar commented Aug 7, 2023

Meanwhile, I've had the most peculiar thing happen in that, ever since intermittently downgrading Mosquitto to v1.6 in the compose (without resolving the issue), then reinstating v2, it just works (and does so reliably, also across restarts of the compose).

Not sure if that is peculiar at all. Since Mosquitto v2, you must explicitly set allow_anonymous true:

https://github.com/chirpstack/chirpstack-docker/blob/master/configuration/mosquitto/mosquitto.conf

Could it be that this configuration was not (correctly) loaded?

@curio77
Copy link

curio77 commented Aug 7, 2023

I'm aware of that change (I use Mosquitto in quite a lot of contexts) and did check MQTT communications via (anonymous) mosquitto_{pub,sub} in the course of looking for the cause of the ChirpStack issue.

Still, the ChirpStack error reoccurred until that switch down to Mosquitto v1.6 and back up. I have no idea what else that may have changed that may have had that resolving effect. The Mosquitto config file at least has not changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants