I am using Chirpstack Gateway OS on Raspberry Pi Compute Module 4. It works fine when I use “tcp://localhost:1883” in Chirpstack/MQTT Forwarder/MQTT configuration/Server. But I need to get data in my application using remote MQTT broker with IP in global net. If I change this field from localhost to 195.161.X.X, I see in Chirpstack dashboard red circle instead of green and I don’t receive any “up” data.
I tried to send data directly from Raspberry Pi using the string
mosquitto_pub -h 195.161.X.X -p 1883 -t “test” -m “hello” -u root -P “mypassword” and its works.
I also can receive data into Raspberry Pi with Gateway OS from that MQTT broker sending data from my developer machine, so remote MQTT broker is fully working. But I cannot get data from Chirpstack.
What settings I need to change in Chirpstack Gateway OS for it to be worked with global white IP?
The MQTT forwarder is only one half of the puzzle, you also must tell Chirpstack which broker the MQTT forwarder is posting to. The Chirpstack MQTT backend server is set in your regional.toml files, although for the Gateway OS there is no easy way to do this, as its not in the UI or in the UCI commands, which means that changing it will not persist on reboot.
The CS GW OS is really only for test cases though and running all off its own Pi. If you want to have the MQTT broker external, you probably have to move your Chirpstack server external as well and go with the base CS GW OS install.
Hi Liam,
Thank you for your answer. But I don’t understand, where else I need to write remote MQTT broker address :-).
I don’t find anywhere in Gateway OS manual that it can be used for testing only and I am not sure that GW OS cannot use MQTT broker with global IP address because it is very simple to implement for CS developers.
Sincerely,
Victor
From the CS GW OS full install page: “This image is intended to provide an easy-to-setup Gateway + Network Server solution for prototyping and testing”
It’s in your regional .toml files, so eu868.toml or likewise. Its under the [mqtt.backend] section or something like that. But there is no way to change these files through the UI alone.
Since the resources on a Pi are limited, the network server in full install is really only meant to support the capabilities of its own gateway, so unfortunately the support just isn’t there for setting a different MQTT broker (as the main usage for this would be to have other gateways post there aswell). Yes it is very simple for CS developers, just on a Ubuntu/docker install, not the full CS GW OS install.
In CS GW OS the config files are generated on boot, so even if you SSH’d into the gateway to change your regional.toml file, it would not persist on reboot. If you really needed to do this, you could create a “jack-benny” solution where you rewrite the file that creates your config files (which I have done before for the MQTT integration), but then it would not persist through updates.
Hi Liam,
Thank you for answer. Now I think I have two options to get data on the global MQTT broker instead of local one:
first, I can make proxy-server that will send data from local Raspberry Pi mqtt message to global server (the global MQTT broker) and
second, I can install concentratord and Chirpstack mqtt Forwarder into Raspberry, and install Chirpstack App Server on the global server. I checked that Chirpstack mqtt Forwarder emit data to the global broker, but they are encrypted and for decryption I can use Chirpstack App server. This global Chirpstack App server will emit data in the local network of global web server.
What do you think about this?
Sincerely,
Victor
You have the right idea but are overcomplicating it a little. No need for a proxy or manually installing concentratord/mqtt forwarder.
What I’d suggest is just download the Gateway OS base install onto your Pi. This gives it all the gateway components without the network server. Then set the MQTT forwarder to send data to your external MQTT broker. (Technically you could do this now if you just repoint your MQTT forwarder, but there’s no point having a server on that Pi if it won’t be used)
Then download Chirpstack itself (the Ubuntu / docker install) onto a server local to your MQTT broker. Depending on your network layout (whether or not the MQTT broker is at localhost:1883) you may need to change the MQTT server address in your regional files to address this new broker.
This is the typical usage of Chirpstack and CS GW OS, where your Pi is just the gateway and forwards to the MQTT broker local to your server.
It would be following this network flow from the architecture diagram:
Thank you, Liam again.
I have solved my problem by the next way.
I installed Gateway OS on my Raspberry. As I know experimentally, it can send massage to remote broker if I change “localhost” to IP address. But this data is not “data” field needed me, this is encrypted data for App server. So, I am receiving this data on global server and handling it using Chirpstack App Server, which gives me “data” filed for my own application.
How to send data directly from App server in Raspberry to global server I don’t know now. I guess it is don’t made by developers from security point of view.
I need full Chirpstack GW OS in Raspberry because my system must work in two conditions: locally (without internet) and globally, if it exists.
So, the problem has been resolved.
Sincerely, Victor
The ideal solution for you then would be if you could use the MQTT integration on a full gateway os install. The mqtt integration is a way for Chirpstack to pass it’s MQTT data to another broker once it has already decrypted it.
But unfortunately the issue is the same there, the MQTT integration on the Pi is not configurable through the UI or UCI commands. I have however, added a pull request to Chirpstack gateway OS in hopes this happens because many people have similar use cases, but it hasn’t been accepted yet: