Problem with loraserver installed with Docker (docker-compose)

Hi,

First of all, I’m not sure where to post (github issue or this forum) since I’m not sure that my problem is a software bug or not, but here we are.

I followed the instruction on installing with Docker by using docker-compose to try the loraserver.
Almost everything works fine, my node can send the data via gateway and I can see the data on the LoRa App Server web.

But, I can not get anything from MQTT broker, I make sure to open the 1883 port and the connection is not refused from the network (my loraserver is hosted on Azure VM).

Also, I always get this error message:

loraserver_1     | time="2017-09-04T10:00:48Z" level=error msg="processing rx packet error: publish data up to application-server error: rpc error: code = Unavailable desc = grpc: the connection is unavailable" data_base64="DATA_IS_REMOVED_FOR_REASONS"

EDIT:

I did get the message from MQTT broker with gateway/# topic, but I didn’t get anything from application/# topic. Is this expected behavior?

Thanks

This is a good place to discuss your issue :slight_smile: It looks like the loraserver container is unable to contact the lora-app-server container, is the latter one up and running?

Glad to hear that :smile:.

App server is running, here’s the output from docker-compose ps

           Name                          Command               State            Ports          
----------------------------------------------------------------------------------------------
loraservers_appserver_1       ./lora-app-server                Up      0.0.0.0:8080->8080/tcp

Here’s the log from app server

appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="starting LoRa App Server" docs="https://docs.loraserver.io/" version=d79ba29 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="connecting to postgresql" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="setup redis connection pool" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="handler/mqtt: connecting to mqtt broker" server="tcp://mosquitto:1883" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="connecting to network-server api" ca-cert= server="loraserver:8000" tls-cert= tls-key= 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="applying database migrations" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="handler/mqtt: connected to mqtt broker" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="handler/mqtt: subscribling to tx topic" topic="application/+/node/+/tx" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="migrations applied" count=0 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="starting application-server api" bind="0.0.0.0:8001" ca-cert= tls-cert= tls-key= 
appserver_1      | time="2017-09-04T10:11:34Z" 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" 
appserver_1      | time="2017-09-04T10:11:34Z" level=info msg="registering rest api handler and documentation endpoint" path="/api" 
appserver_1      | time="2017-09-04T10:11:35Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.18.0.3:8000: getsockopt: connection refused"; Reconnecting to {loraserver:8000 <nil>}" 
appserver_1      | 2017/09/04 10:16:21 http2: server: error reading preface from client 36.84.67.248:31345: timeout waiting for client preface
appserver_1      | 2017/09/04 10:16:22 http2: server: error reading preface from client 36.84.67.248:31306: timeout waiting for client preface
appserver_1      | 2017/09/04 10:16:22 http2: server: error reading preface from client 36.84.67.248:31467: timeout waiting for client preface
appserver_1      | 2017/09/04 10:16:22 http2: server: error reading preface from client 36.84.67.248:31373: timeout waiting for client preface
appserver_1      | 2017/09/04 10:16:22 http2: server: error reading preface from client 36.84.67.248:31296: timeout waiting for client preface
appserver_1      | 2017/09/04 12:58:57 http: TLS handshake error from 52.179.173.109:47598: tls: first record does not look like a TLS handshake
appserver_1      | 2017/09/04 13:02:36 http: TLS handshake error from 115.231.218.25:2371: tls: first record does not look like a TLS handshake

I noticed that app server had similar error message

appserver_1      | time="2017-09-04T10:11:35Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.18.0.3:8000: getsockopt: connection refused"; Reconnecting to {loraserver:8000 <nil>}" 

I’ll try adding

ports:
  - 8000

to loraserver service and

ports:
  - 8001

to appserver service and hoping it would solve the problem.

By the way, I can not transmit any data now because the node and gateway are in my office, not until tomorrow morning (my timezone is GMT+7)

Hi @brocaar

I think the problem is in docker-compose.yml configuration.

Here’s the root cause:

loraserver:
  # ...
  environment:
    # ...
    - AS_SERVER=loraserver:8001

After changing AS_SERVER env. variable value to appserver:8001 the error message is gone.

I also filed a pull request to the docs.loraserver.io web repository.
https://github.com/brocaar/docs.loraserver.io/pull/4

I’ll test the whole thing tomorrow morning (in 12 hours).

EDIT: The solution above works. Now I can get data from the application/# topic. Yeay! :confetti_ball:

Thanks

1 Like

Cheers! That should indeed have been appserver instead of loraserver :slight_smile: I’ve merged your pull-request and will push the new docs in a second.

1 Like

Hi Orne @brocaar,

I was bit confused about what you directed me. It may be very foolishness on my part.

I tried the fix provided here but stil the issue exits. Please let me know where to provide the application-server ip and port in the loraserver.toml configfile. I think by default loraserver trying to talk to lora-app-server on localhost:8001 ( this ip:host is embedded some where in the code) and I want to override that with lora-app-server:8001 but I donot know where to do that.

#hope this time I have posted in correct topic.

1 Like

Please see this section in the lora-app-server.toml configuration (note: you configure this at the LoRa App Server side).

  # Public ip:port of the application-server API.
  #
  # This is used by LoRa Server to connect to LoRa App Server. When running
  # LoRa App Server on a different host than LoRa Server, make sure to set
  # this to the host:ip on which LoRa Server can reach LoRa App Server.
  # The port must be equal to the port configured by the 'bind' flag
  # above.
  public_host="localhost:8001"

That must be set to the LoRa App Server hostname. Please note that when you change this config file, you also need to update the network-server object in the web interface so that LoRa App Server notifies LoRa Server that the hostname changed.

You will find a fully working Docker Compose example configured for the EU868 band here: https://www.loraserver.io/install/docker/ (see how https://github.com/brocaar/loraserver-docker/blob/master/configuration/lora-app-server/lora-app-server.toml#L168 maps to https://github.com/brocaar/loraserver-docker/blob/master/docker-compose.yml#L9).

1 Like

Thank You Orne @brocaar .I configured it as you suggested .Now the lora server is talking to lora appaserver.

Previous I was not aware off this section .Now I tried that and the lora server got notified about the new host

1 Like