Integrating Chripstack and LWN-simulator in Docker

Hi, I’m having some difficulties integrating LWN-simulator and Chripstack in docker-compose. If I run Chirpstack using the docker-compose file found on github and run LWN-simulator 1.0.2 beta directly on my Raspberry Pi 5 it works without any issues. But I would like to have both Chirpstack and the LWN-simulator in 1 docker-compose file so it can be used on all our development devices.

The issue that I’m having is that the LWN-simulator sends out a “JOIN REQUEST”, this join request is also viewable within Chirpstack but the LWN-simulator never receives the acknowledge message from Chripstack so no actual data is send.
LWN-simulator console:

[ Jul 9 09:03:34 ] GW[LWN_Gateway]: Turn ON
[ Jul 9 09:03:34 ] DEV[TestDevice] |Activation| {A}: Turn ON
[ Jul 9 09:03:34 ] GW[LWN_Gateway]: PULL DATA send
[ Jul 9 09:03:34 ] DEV[TestDevice] |Activation| {A}: JOIN REQUEST sent
[ Jul 9 09:03:34 ] DEV[TestDevice] |Activation| {A}: Open RXs
[ Jul 9 09:03:34 ] GW[LWN_Gateway]: PUSH DATA send
[ Jul 9 09:03:46 ] DEV[TestDevice] |Activation| {A}: None downlink received
[ Jul 9 09:03:46 ] DEV[TestDevice] |Activation| {A}: Unjoined
[ Jul 9 09:03:46 ] DEV[TestDevice] |Activation| {A}: JOIN REQUEST sent
[ Jul 9 09:03:46 ] DEV[TestDevice] |Activation| {A}: Open RXs
[ Jul 9 09:03:46 ] GW[LWN_Gateway]: PUSH DATA send
[ Jul 9 09:03:50 ] GW[LWN_Gateway]: Turn OFF
[ Jul 9 09:03:58 ] DEV[TestDevice] |Activation| {A}: None downlink received
[ Jul 9 09:03:58 ] DEV[TestDevice] |Activation| {A}: Unjoined
[ Jul 9 09:03:58 ] DEV[TestDevice] |Activation| {A}: Turn OFF
[ Jul 9 09:03:58 ] [SIM]: STOPPED

And this is what I see in Chirpstack:

In the LWN-simulator I have setup the gateway bridge as followed:
IP/URL: 172.17.0.1
PORT: 1700

my best guess is that Chirpstack still sends out the acknowledge message but to a different IP/URL which LWN-Simulator is not connected to. Although I cannot confirm my suspicion as I can not find the IP/URL that Chirpstack uses to send this acknowledgement message.

Any debug or solutions are welcome to find out how to resolve the issues that I’m having.

Hello,

I think your problem is the IP, you don’t have to use 172.17.0.1, you need to use the “hostname” is the service name of the Docker container. For example, if you have: “chirpstack”. You will write: “chirpstack:1700”. To interconnect containers, you always have to use the hostname (service name if you don’t set “hostname: whateveryouwant” manually on each service). Never use IPs as they change and are so difficult to maintain.

That being said, check that on your LWN-Simulator > Dockerfile you have this:

ENV SIM_BRIDGE_HOST chirpstack-gateway-bridge
ENV SIM_BRIDGE_PORT 1700

Instead of an IP, otherwise it won’t work. After this change, you should build your LWN-Simulator container and restart your docker-compose services. This way it should work :slight_smile:

If this doesn’t solve your problem, share your Docker Compose, so I can see what you have.

Adrián

Hi Adrián,

interesting suggestion will definitely try this out! But in the mean time (since I posted this message and now) I managed to resolve the issue.

With the commands docker network ls and docker network inspect [name] I found out that the containers where not on 172.17.0.0/16 but on 172.18.0.0/16. Changing the host in LWN-simulator from 172.17.0.1 to 172.18.0.1 resolved the issue and am able to send all the data that I needed.

Your suggestion might be more elegant and probably better practice, so will definitely try it out after I have thingsboard working with its own gateway for mqtt messages. Had it working when thingsboard was its own service, but have it running in docker now too and now it doesn’t work anymore. Probably also networking like this.

regards,

Wesley

1 Like

Hi Wesley,

I’m happy to hear that you solved it!

And that’s why I proposed the usage of the “hostname” because the IP regenerate every time you stop the containers. And the Docker network give each docker compose group of services a different network on every restart. That’s because it’s a bad practice to use the IP directly :wink:.

Tell me if my solution works when you try it, and then mark the topic as solved (I don’t know how to do that XD)

Good luck mate!

Adrián

I tested it out with the adding the hostname and it seems to work like a charm. I still needed to add the gateway bridge URL in the webinterface which I didn’t expect, but this could be since I’m using version 1.0.2 of the LWN-simulator which doesn’t support docker I guess like the newest version.

Thanks again for the suggestion and will mark your answer as the solution.

1 Like