Setting up multiple LoRa Server instances / duplicate routing-profile error

I am trying to setup two loraserver instances, one for India and another for Europe. The configurations are all in place and the all the components start-up fine.
When I add the first network server, let’s say for India, it is added without any problems.
But while adding the second network server, I get the error ERROR: duplicate key value violates unique constraint “routing_profile_pkey”. Following this is a description of the error which says that the routing_profile_id cannot be duplicate.
AFAIK the routing-profile-id was specified in the lora-app-server config and should not be changed.
So, what am I doing wrong??

Edit: I have managed to get that working by using separate database instances for each network server.
But this begs the question that why are we using such an architecture? IMHO this increases the number of managed instances which I was trying to avoid.

Yes, you need to create a separate database for each LoRa Server instance to separate the data between these network-servers. Please note that these these databases can exist on the same PostgreSQL instance (e.g. loraserver_ns_band_a, loraserver_ns_band_b, …).

But this begs the question that why are we using such an architecture? IMHO this increases the number of managed instances which I was trying to avoid.

Since every region has different settings which can be customized. Some regions cover multiple countries where you want to make per-country modifications to these settings.

It also allows you to run the India instance at a datacenter close to / in India, same for the European instance. That way you’ll be able to keep the latency between the network-servers and the gateways low :slight_smile:

Thanks a lot for the prompt reply. I agree with you regarding separate instances of network server. My question was regarding separate instances of PostgreSQL, which as you said are not required.
Thanks again. :grinning:

1 Like

Hi arpitmsharma,

did you get two different instances up and running using the docker images or ‘normal’ installed services on the server? Could you share the settings you changed for each loraserver?

I am trying to have a working EU and US loraserver services on the same server using the Docker but no luck so far.

Hi urosm,
I was able to set up the both the servers using docker.
What is the problem that you are facing?

Hi arpitmsharma,
what about mosquitto services? did you use same mosquitto instance for both loraservers?

Hi arpitmsharma,

I am trying to setup two network servers for two different frequency band . Did you specify two services of loraserver in docker-compose.yml or was it two toml files in the same /configuration/loraserver folder.

Thank you

@brocaar I am also trying to achieve setup of two loraservers ( EU and US bands), I created another service called loraserver915 in docker-compose yml. Below is the screenshot of docker-compose file. Is this the right thing to do.


I have also setup another database instance with new user. Following are the issues I’m having. Could you please guide me.

  1. When i navigate to loraserver-docker => configuration => loraserver915 , i expect to see toml file, however I cant see any config file, the new loraserver915 folder is empty. What am I doing wrong.

  2. So I tried copying the file from other loraserver folder and configured it to point to database and frequency band. However I always get the same error.

  1. So when I try to add network server from lora-app-server GUI, I get the above connection error , I have also verified that I am using the right password/db instance name. On the other hand on GUI I see context exceeded deadline error.

Thank you,

Make sure you have a loraserver.toml configuration file in configuration/loraserver915/. Also please search on the error you are getting. I believe there is already an other topic about this error message. If that doesn’t help, please share your complete configuration on GitHub so we can help out.

@brocaar yes I manually copied toml file from one server to newly added server, I have also looked at the error in other topics and made sure i m using correct password and db instance names in “dsn” string. However I could not get it working, do you think the two loraserver configuration in docker-compose file which I have shared is correct?

I don’t know. I suggest that you post your full configuration on for example GitHub :slight_smile: That makes it easier to look into it as now I can only make assumptions.

@brocaar I got it working, just did a fresh install, defined loraserver915 as service in docker-compose.yml pointed to loraserver.toml, created another database instance, changed the “dsn” string in the toml file of new loraserver. Added network server from GUI with hostname point to new network server and port still 8000. For someone who is stuck with it.

I still don’t know what went wrong yesterday because it was same setup except I did a fresh start again :slight_smile:

I had to create two separate service profiles for each bands, two separate device profiles, two separate application as well with its own list of devices. However if we have a dual band sensor then having multiple applications and duplicating sensor list does not look manageable.
Could you suggest how to configure such a device to be all in one application. We are in middle of critical development stage and am really thankful to you for all your help.

@arpitmsharma don’t bother I figured it out thanks.

I’m trying to setup a LoRaWAN ChirpStack for 2 regions, US and AU. From previous posts I understand that there is not other option that creating 2 NS instances (different servers), that’s right?
Regarding DB, what do you mean with “created another DB instance”? Could you explain that process please?
@brocaar is there some documentation for this?

Thank you very much!

Documentation here:

Yes, you can create a second PG database on the same DB host.