Run multiple instances of chirpstack-gateway-bridge on the same server

Hi all,
Chirpstack v4 can support multiple regions which is cool.
However, I want to avoid installing chirpstack-gateway-bridge on LoRaWAN gateways and to use Semtech UDP port 1700.

Then I install chirpstack-gateway-bridge on the server.
However, it seems that in v4, the chirpstack-gateway-bridge only supports 1 region.
=> So I need to install multiple chirpstack-gateway-bridge instances?

In v3, I need 1 application server + multiple network servers + 1 gateway bridge.
In v4, I need 1 Chirpstack server + multiple gateway bridge servers.
=> So how to install multiple instances for v4 chirpstack-gateway-bridge?

Any help is appreciated.
Thanks a lot.

1 Like

To be honest, I’m surprised you were supporting multiple network servers with a single gateway bridge under v3. I imagine it could be deployed that way, but I guess I’m used to seeing people geolocate their network servers anyway.

But to answer your question - as I understand it, yes, the gateway bridge is now tied to a region by MQTT topic, so you will want to run multiple. If they all need to run on the same public/exposed IP, you could select different UDP ports to receive traffic for each bridge.

See Multi-region examples 1 and 2:
https://www.chirpstack.io/docs/architecture.html#multi-region-example-1

1 Like

Ok, let me see how to run multiple instances of gateway bridges.

Thanks a lot for your comfirmation.

@bconway
I am doing a lot of tests for my company and have 5 gateways for different regional settings for these tests.
It is much easier to have them all on one network server than jumping around between different installations.

For testing, sure. But I don’t see that a lot has changed here. In v3, it would have been 5 network servers. In v4, it’s 5 gateway bridges.

In my opinion, you neither need multiple network servers nor multiple gateway bridges.
One gateway bridge and a properly configured mqtt bridge (a feature of mosquitto) could do the job.
Just remove the region prefix in gateway bridge config and add it back based on gateway topic name in the mqtt bridge.
No additional installation needed.

Regards, Johannes

1 Like

That’s a nice feature, but how/where do you track your gateway-region mapping for topic rewriting as you scale up to thousands of gateways? It sounds like a lot more work than spinning up an extra container per region, whether that’s the network server (v3) or gateway bridge (v4).

1 Like

Of course you’re right in case of going live.
I just referred testing.

Johannes

I did the same thing like you did before asking. I removed the region in the bridge toml too.
However, my AS923 gateway seems to be wrongly detected as AU915 when I use AS923 and AU915 concurrently.
AS923 and AU915 have some similar frequencies.

How does Chirpstack v4 know if a gateway uses AS923 or AU915 if no region in bridge is specified?
Thanks a lot.

I did not only propose to remove the region in gateway bridge toml, but also to reapply it per gateway in the mqtt config.
Does chirpstack v4 even work without region prefix?

How do you do this?
Is your chirpstack-gateway-bridge running on the server or gateways?
Thanks a lot.

On the server.

I don’t do this. I use the bridge functionality to connect gateways to a chirpstackv3 and a v4 installation the same time.
But I’m quite sure it is achievable by adding:

connection gateway_mapping

address 127.0.0.1:1883

topic # both 0 gateway/gatewayid_eu868/ eu868/gateway/gatewayid_eu868/
topic # both 0 gateway/gatewayid_as923/ as923/gateway/gatewayid_as923/

to your mosquitto.conf

Just replace the gatewayid_xxxxx with the corresponding IDs of your actual gateways.

This is not tested. Apologies if it doesn’t work.

Bridge explained

Regards, Johannes

Edit:
Just another thought.
Since you’ve written that v4 is also accepting the non prefixed topics (perhaps some kind of legacy mode) but is interpreting the region wrong, you should perhaps think about a generic saveguard prefix (added to the gateway bridge toml and the mosquitto conf).

Edit2: Error in config.

1 Like

Wow, nice trick.
Thanks a lot for your detail explanation.

I manage to run multiple instances of chirpstack-gateway-bridge on different ports in the same server using multiple systemd services.

Thanks a lot for help and advice.

Hi @datnus

I also tried a similar method, but I got some problems at some points.

  • chirpstack-gateway-bridge is duplicated at /usr/bin as chirpstack-gateway-bridge-test
  • I generated a new service whose name is chirpstack-gateway-bridge-test to /usr/lib/systemd/system
[Unit]
Description=ChirpStack Gateway Bridge
Documentation=https://www.chirpstack.io/
Wants=network-online.target
After=network-online.target

[Service]
User=gatewaybridge-test
Group=gatewaybridge-test
ExecStart=/usr/bin/chirpstack-gateway-bridge-test
Restart=on-failure

[Install]
WantedBy=multi-user.target
  • I’ve generated a new config file (lets say cs-gw-bridge-2.toml). udp_bind is changed to “0.0.0.0:1701”. after, by using -c flag, I assigned the config file to #2.toml.

  • When I try to start chirpstack-gateway-bridge-test.service, I’m getting an error that I can not use port 1700 (because it is being used by original chirpstack-gateway-bridge).

  • When I get the config file by chirpstack-gateway-bridge-test configfile, the port is still at 1700, not 1701

I think I made a mistake at step 1, but I could not find a proper solution.

Can you be a little bit clear about how to run multiple gateway bridges by systemd?

Hi,
To use the same bin but different config file for bridge.

I remember -c to specify the toml for bridge.

ExecStart=/usr/bin/chirpstack-gateway-bridge -c as923.toml

ExecStart=/usr/bin/chirpstack-gateway-bridge -c eu868.toml

In the toml, to specify different ports 170x.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.