urosm
March 23, 2018, 12:26pm
#1
Hi,
I am trying to run US and EU loraserver instances using docker-compose on the same pc (linux server).
I changed the .yml files so each service uses its own database. I tried to set up the web port (from 8080 to 8081 for US and form 8080 to 8082 to EU instance) but it does not work. In the terminal, I can see:
appserver_eu_1 | time=“2018-03-23T12:16:46Z” level=info msg=“starting client api server” bind=“0.0.0.0:8080” tls-cert=/etc/lora-app-server/certs/http.pem tls-key=/etc/lora-app-server/certs/http-key.pem
meaning, the port specified for the appserver in the yml is not used for setting up the ‘client api server’ port (stil points to the default 8080.
Did anyone manage to get this kind of setup up and running (using Docker images)?
Other option is that I install services the ‘old way’ and change all configs there.
Running EU or US loraserver separately (with default settings) works fine, gateways connecting, nodes communicating …
The EU yml file:
version: “2”
services:
loraserver:
image: loraserver/loraserver
environment:
- DB_AUTOMIGRATE=true
- LOG_NODE_FRAMES=true
- NET_ID=020304
- BAND=EU_863_870
- REDIS_URL=redis://redis_eu:6379
- GW_MQTT_SERVER=tcp://mosquitto_eu:1883
- GW_SERVER_JWT_SECRET=verysecreteu
- POSTGRES_DSN=postgres://loraserver_ns_eu:loraserver_ns_eu@postgresql_ns_eu/loraserver_ns_eu?sslmode=disable
- JS_SERVER=http://appserver_eu:8003
appserver_eu:
image: loraserver/lora-app-server
ports:
- 8081:8081
environment:
- DB_AUTOMIGRATE=true
- REDIS_URL=redis://redis_eu:6379
- POSTGRES_DSN=postgres://loraserver_as_eu:loraserver_as_eu@postgresql_as_eu/loraserver_as_eu?sslmode=disable
- MQTT_SERVER=tcp://mosquitto_eu:1883
- JWT_SECRET=verysecreteu
- HTTP_TLS_CERT=/etc/lora-app-server/certs/http.pem
- HTTP_TLS_KEY=/etc/lora-app-server/certs/http-key.pem
- AS_PUBLIC_SERVER=appserver_eu:8001
gatewaybridge:
ports:
- 1700:1700/udp
image: loraserver/lora-gateway-bridge
environment:
- MQTT_SERVER=tcp://mosquitto_eu:1883
postgresql_ns_eu:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_ns_eu
- POSTGRES_USER=loraserver_ns_eu
- POSTGRES_DB=loraserver_ns_eu
postgresql_as_eu:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_as_eu
- POSTGRES_USER=loraserver_as_eu
- POSTGRES_DB=loraserver_as_eu
redis_eu:
ports:
- 6379
image: redis:4-alpine
mosquitto_eu:
ports:
- 1883:1883
image: eclipse-mosquitto
best regards, Uros
urosm
March 23, 2018, 3:21pm
#2
This seems to work (starting up all services):
version: "2"
services:
# EU lora services
loraserver_eu:
image: loraserver/loraserver
environment:
- DB_AUTOMIGRATE=true
- LOG_NODE_FRAMES=true
- NET_ID=020304
- BAND=EU_863_870
- REDIS_URL=redis://redis_eu:6379
- GW_MQTT_SERVER=tcp://mosquitto:1883
- GW_SERVER_JWT_SECRET=verysecreteu
- POSTGRES_DSN=postgres://loraserver_ns_eu:loraserver_ns_eu@postgresql_ns_eu/loraserver_ns_eu?sslmode=disable
- JS_SERVER=http://appserver_eu:8003
appserver_eu:
image: loraserver/lora-app-server
ports:
- 8081:8080
environment:
- DB_AUTOMIGRATE=true
- REDIS_URL=redis://redis_eu:6379
- POSTGRES_DSN=postgres://loraserver_as_eu:loraserver_as_eu@postgresql_as_eu/loraserver_as_eu?sslmode=disable
- MQTT_SERVER=tcp://mosquitto:1883
- JWT_SECRET=verysecreteu
- HTTP_TLS_CERT=/etc/lora-app-server/certs/http.pem
- HTTP_TLS_KEY=/etc/lora-app-server/certs/http-key.pem
- AS_PUBLIC_SERVER=appserver_eu:8001
gatewaybridge:
ports:
- 1701:1700/udp
image: loraserver/lora-gateway-bridge
environment:
- MQTT_SERVER=tcp://mosquitto:1883
postgresql_ns_eu:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_ns_eu
- POSTGRES_USER=loraserver_ns_eu
- POSTGRES_DB=loraserver_ns_eu
postgresql_as_eu:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_as_eu
- POSTGRES_USER=loraserver_as_eu
- POSTGRES_DB=loraserver_as_eu
redis_eu:
ports:
- 6379
image: redis:4-alpine
# US lora services
loraserver_us:
image: loraserver/loraserver
environment:
- DB_AUTOMIGRATE=true
- LOG_NODE_FRAMES=true
- NET_ID=010203
- BAND=US_902_928
- REDIS_URL=redis://redis_us:6379
- GW_MQTT_SERVER=tcp://mosquitto:1883
- GW_SERVER_JWT_SECRET=verysecretus
- POSTGRES_DSN=postgres://loraserver_ns_us:loraserver_ns_us@postgresql_ns_us/loraserver_ns_us?sslmode=disable
- JS_SERVER=http://appserver_us:8003
appserver_us:
image: loraserver/lora-app-server
ports:
- 8082:8080
environment:
- DB_AUTOMIGRATE=true
- REDIS_URL=redis://redis_us:6379
- POSTGRES_DSN=postgres://loraserver_as_us:loraserver_as_us@postgresql_as_us/loraserver_as_us?sslmode=disable
- MQTT_SERVER=tcp://mosquitto:1883
- JWT_SECRET=verysecretus
- HTTP_TLS_CERT=/etc/lora-app-server/certs/http.pem
- HTTP_TLS_KEY=/etc/lora-app-server/certs/http-key.pem
- AS_PUBLIC_SERVER=appserver_us:8001
gatewaybridge_us:
ports:
- 1702:1700/udp
image: loraserver/lora-gateway-bridge
environment:
- MQTT_SERVER=tcp://mosquitto:1883
postgresql_ns_us:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_ns_us
- POSTGRES_USER=loraserver_ns_us
- POSTGRES_DB=loraserver_ns_us
postgresql_as_us:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_as_us
- POSTGRES_USER=loraserver_as_us
- POSTGRES_DB=loraserver_as_us
redis_us:
ports:
- 6379
image: redis:4-alpine
# common lora services
mosquitto:
ports:
- 1883:1883
image: eclipse-mosquitto
fma
March 28, 2018, 6:24am
#3
I see that you are using 2 instances of appserver.
Could it be possible of just running 1? It seems that you can duplicate everything and each loraserver should have its own MQTT, bridge,postgres_ns config. But I have doubts about redis, this is because the appserver uses redis but I don’t know if it is used for comunicating with loraserver or just because it needs to save some messages.
If I look at the architecture of the server the only thing comunicating loraserver and appserver is GRPC. So if I understood well I will need 3 (or 3 internal databses) instances of redis.
Appserver: [redis, mqtt(if needed), postgress_as]
eu868:[redis_eu, mqtt_eu, postgress_ns_eu, bridge_eu
as915:[redis_as, mqtt_as, postgress_ns_as, bridge_as]
Would this aproximation be correct? @brocaar
Thanks.
You need one LoRa App Server, for LoRa App Server and LoRa Server each a separate PostgreSQL database and you can share the Redis database for all services. The same with the MQTT broker / Mosquitto.
1 Like
fma
March 28, 2018, 7:19am
#5
Thanks for the fast answer.
Just to have it written:
Appserver: [postgress_as]
eu868:[mqtt_eu, postgress_ns_eu]
as915:[mqtt_as, postgress_ns_as]
common:[MQTT, redis, bridge(in server)]
I will try this when they give me some time.
urosm
March 30, 2018, 1:23pm
#6
Thanks for the responses. At the moment I have this in the .yml and it works fine:
version: "2"
services:
# EU lora services
loraserver_eu:
image: loraserver/loraserver
environment:
- DB_AUTOMIGRATE=true
- LOG_NODE_FRAMES=true
- NET_ID=020304
- BAND=EU_863_870
- REDIS_URL=redis://redis:6379
- GW_MQTT_SERVER=tcp://mosquitto:1883
- GW_SERVER_JWT_SECRET=verysecreteu
- POSTGRES_DSN=postgres://loraserver_ns_eu:loraserver_ns_eu@postgresql_ns_eu/loraserver_ns_eu?sslmode=disable
- JS_SERVER=http://appserver_eu:8003
appserver_eu:
image: loraserver/lora-app-server
ports:
- 8091:8080
environment:
- DB_AUTOMIGRATE=true
- REDIS_URL=redis://redis:6379
- POSTGRES_DSN=postgres://loraserver_as_eu:loraserver_as_eu@postgresql_as_eu/loraserver_as_eu?sslmode=disable
- MQTT_SERVER=tcp://mosquitto:1883
- JWT_SECRET=verysecreteu
- HTTP_TLS_CERT=/etc/lora-app-server/certs/http.pem
- HTTP_TLS_KEY=/etc/lora-app-server/certs/http-key.pem
- AS_PUBLIC_SERVER=appserver_eu:8001
postgresql_ns_eu:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_ns_eu
- POSTGRES_USER=loraserver_ns_eu
- POSTGRES_DB=loraserver_ns_eu
postgresql_as_eu:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_as_eu
- POSTGRES_USER=loraserver_as_eu
- POSTGRES_DB=loraserver_as_eu
# US lora services
loraserver_us:
image: loraserver/loraserver
environment:
- DB_AUTOMIGRATE=true
- LOG_NODE_FRAMES=true
- NET_ID=010203
- BAND=US_902_928
- REDIS_URL=redis://redis:6379
- GW_MQTT_SERVER=tcp://mosquitto:1883
- GW_SERVER_JWT_SECRET=verysecretus
- POSTGRES_DSN=postgres://loraserver_ns_us:loraserver_ns_us@postgresql_ns_us/loraserver_ns_us?sslmode=disable
- JS_SERVER=http://appserver_us:8003
appserver_us:
image: loraserver/lora-app-server
ports:
- 8092:8080
environment:
- DB_AUTOMIGRATE=true
- REDIS_URL=redis://redis:6379
- POSTGRES_DSN=postgres://loraserver_as_us:loraserver_as_us@postgresql_as_us/loraserver_as_us?sslmode=disable
- MQTT_SERVER=tcp://mosquitto:1883
- JWT_SECRET=verysecretus
- HTTP_TLS_CERT=/etc/lora-app-server/certs/http.pem
- HTTP_TLS_KEY=/etc/lora-app-server/certs/http-key.pem
- AS_PUBLIC_SERVER=appserver_us:8001
postgresql_ns_us:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_ns_us
- POSTGRES_USER=loraserver_ns_us
- POSTGRES_DB=loraserver_ns_us
postgresql_as_us:
image: postgres:9.6-alpine
ports:
- 5432
environment:
- POSTGRES_PASSWORD=loraserver_as_us
- POSTGRES_USER=loraserver_as_us
- POSTGRES_DB=loraserver_as_us
# common lora services
redis:
ports:
- 6379
image: redis:4-alpine
gatewaybridge:
ports:
- 1700:1700/udp
image: loraserver/lora-gateway-bridge
environment:
- MQTT_SERVER=tcp://mosquitto:1883
mosquitto:
ports:
- 1883:1883
image: eclipse-mosquitto
Currently I have only 1 US gateway at hand, hoping to get set up EU gateway next week to see if all works normally. If anyone have any test gateways in other bands (AS_923, AU_915_928, CN_470_510, CN_779_787, IN_865_867, KR_920_923, RU_864_870) let me know and we can do some tests.
best regards, Uros