LoRa server(appserver and networkserver) Installation on Raspberry pi3

Could you share some relevant code, logs, etc.? And what’s exactly the issue you are facing?

Sorry, I was referring to this piece that you had mentioned. Also I apologize, I was in a rush with other stuff last night.

I was following through the Quick Install Guide and have installed Mosquitto and set the passwords for the four users (loraroot, loragw, loraserver, and loraappserver). My local.conf just has the two lines:

allow_anonymous false
password_file /etc/mosquitto/pwd

I then installed Postgresql, and set up the two users and databases loraserver_as and loraserver_ns, followed by adding the extension pg_trgm to the loraserver_as database.

I then went about installing the Lora Gateway Bridge and the Lora Server. For the Gateway Bridge is my udp.bind is set to 0.0.0.0:1700, and the mqtt.username is set to loragw and the mqtt.password is set to the corresponding password that I set for that user earlier. For the Lora Server my band is set to the US_902_928, the postgresql.dsn is set to postgres://loraserver_ns:dbpassword@localhost/loraserver_ns?sslmode=disable where dbpassword is the same as the one I set up for the database for loraserver_ns. My postgresql.automigrate is set to true, mqtt.username is set to loraserver and the mqtt.password is the one I setup for that user. Everything else is set as it was mentioned in the quick install guide, and when I did sudo systemctl start loraserver and journalctl -u loraserver the first time it seemed to be ok, I received an error message at first but I just went with the fact that it was the one indicating the Lora App Server was not running.

I then went on to install the Lora App Server and set the following in the lora-app-server.toml file.
postgresql.dsn postgres://loraserver_as:dbpassword@localhost/loraserver_as?sslmode=disable
postgresql.automigrate true
mqtt.username loraappserver
mqtt.password the_corresponding_password_that_I_set_earlier_for_loraappserver
api.bind localhost:8001
external_api.bind 0.0.0.0:8080

After setting up that file I started the lora app server and stopped for the evening. Coming back the next day, I did a restart on everything just to check to see if it would reset itself easily. When I checked the journals for the loraserver and lora-app-server that is when I first started noticing the issue that you had mentioned and that I have copied above.

Lastly I checked the status of each of the services, and mosquitto and postgresql are labeled as active (exited) while loraserver, lora-app-server and lora-gateway-bridge are listed as active(running). I don’t know if that is of any help.

Here exactly are the outputs of the status.

`
root@raspberrypi:/home/pi# sudo systemctl status loraserver
● loraserver.service - LoRa Server
Loaded: loaded (/lib/systemd/system/loraserver.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-04-08 12:56:17 EDT; 9min ago

Main PID: 1397 (loraserver)
CGroup: /system.slice/loraserver.service
└─1397 /usr/bin/loraserver

Apr 08 13:05:16 raspberrypi loraserver[1397]: time=“2018-04-08T13:05:16-04:00” level=error msg=“ping database error, will retry in 2s: dial tcp [::1]:5432: connect: connection refused”

root@raspberrypi:/home/pi# sudo systemctl status lora-app-server
● lora-app-server.service - LoRa App Server
Loaded: loaded (/lib/systemd/system/lora-app-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-04-08 12:56:37 EDT; 17min ago

Main PID: 1414 (lora-app-server)
CGroup: /system.slice/lora-app-server.service
└─1414 /usr/bin/lora-app-server

Apr 08 13:13:55 raspberrypi lora-app-server[1414]: time=“2018-04-08T13:13:55-04:00” level=error msg=“ping database error, will retry in 2s: dial tcp [::1]:5432: connect: connection refused”

@raspberrypi:/home/pi# sudo systemctl status lora-gateway-bridge
● lora-gateway-bridge.service - LoRa Gateway Bridge
Loaded: loaded (/lib/systemd/system/lora-gateway-bridge.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-04-08 12:56:53 EDT; 17min ago

Main PID: 1431 (lora-gateway-br)
CGroup: /system.slice/lora-gateway-bridge.service
└─1431 /usr/bin/lora-gateway-bridge

Apr 08 13:14:42 raspberrypi lora-gateway-bridge[1431]: time=“2018-04-08T13:14:42-04:00” level=error msg=“could not setup mqtt backend, retry in 2 seconds: Network Error : dial tcp 127.0.0.1:1883: getsockopt: connection refused”
Apr 08 13:14:44 raspberrypi lora-gateway-bridge[1431]: time=“2018-04-08T13:14:44-04:00” level=info msg=“backend: TLS config is empty”
Apr 08 13:14:44 raspberrypi lora-gateway-bridge[1431]: time=“2018-04-08T13:14:44-04:00” level=info msg=“backend: connecting to mqtt broker” server=“tcp://127.0.0.1:1883”

root@raspberrypi:/home/pi# sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2018-04-07 21:55:49 EDT; 15h ago
Process: 499 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 499 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/postgresql.service

Apr 07 21:55:37 raspberrypi systemd[1]: Starting PostgreSQL RDBMS…
Apr 07 21:55:49 raspberrypi systemd[1]: Started PostgreSQL RDBMS.

root@raspberrypi:/home/pi# sudo systemctl status mosquitto
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (exited) since Sun 2018-04-08 13:04:08 EDT; 13min ago
Docs: man:systemd-sysv-generator(8)
Process: 1505 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)
Process: 1512 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)

Apr 08 13:04:08 raspberrypi systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker…
Apr 08 13:04:08 raspberrypi mosquitto[1512]: Starting network daemon:: mosquitto.
Apr 08 13:04:08 raspberrypi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
`

The errors suggest that Postgres isn’t running or the connection DSNs are wrong.

That was probably from me screwing around with the .toml file last night. I’ll need to double check it.

Ok rechecked my files, and restarted everything. Now the error message seems to point to mosquitto.

Here’s what I’m seeing now.

Apr 08 19:09:37 raspberrypi lora-app-server[7701]: time=“2018-04-08T19:09:37-04:00” level=info msg=“starting LoRa App Server” docs=“https://docs.loraserver.io/” version=0.19.0
Apr 08 19:09:37 raspberrypi lora-app-server[7701]: time=“2018-04-08T19:09:37-04:00” level=info msg=“connecting to postgresql”
Apr 08 19:09:38 raspberrypi lora-app-server[7701]: time=“2018-04-08T19:09:38-04:00” level=info msg=“setup redis connection pool”
Apr 08 19:09:38 raspberrypi lora-app-server[7701]: time=“2018-04-08T19:09:38-04:00” level=info msg=“handler/mqtt: TLS config is empty”
Apr 08 19:09:38 raspberrypi lora-app-server[7701]: time=“2018-04-08T19:09:38-04:00” level=info msg=“handler/mqtt: connecting to mqtt broker” server=“tcp://localhost:1883”
Apr 08 19:09:38 raspberrypi lora-app-server[7701]: time=“2018-04-08T19:09:38-04:00” level=error msg=“handler/mqtt: connecting to broker error, will retry in 2s: Network Error : dial tcp [::1]:1883: connect: connection refused”

I can’t recall if that message was specific or generic and don’t have means to check it right now, but again it seems that either mosquitto isn’t running, credentials for mosquitto at lora-app-server configuration are wrong or mosquitto authentication is not correctly set. You’ll need to check those things to see which is the one causing the issue.

It appears to have been an issue with Mosquitto not actually running. Upon starting the service with the code

sudo mosquitto -c /etc/mosquitto/mosquitto.conf

I found the issue was within the .conf file apparently I was having a hard time typing in English the other evening and my

persistence_location

was

presistence_location

Sorry again for the hassle as I should have been checking my .conf files better. Hopefully the rest of the setup will run smoothly. Thank you again for your help.

1 Like

Hello,

I am trying to setup LoRa Server and LoRa APP server on the same Raspberry Pi. I followed the quick install guide . LoRa server is working but lora app server failed to do so. Other than this, when i check the created role for created database, it give peer authentication failed for user [] error. When i check the status of lora app server it gives the error as shown in attached image. I am wondering what should i do to eliminate this error?