Issue on Configuring LoRa Server and App server database

Hi Brocaar,
I just install LoRa server referring on Quick install. I have followed on all configuration Mosquitto authentication and PostgreSQL databases and users. But when i run ‘journalctl -u loraserver’, the output is


Same goes to ‘journalctl -u lora-app-server’

Showing content in “cd /etc/default/loraserver”

# ip:port to bind the api server (default: "0.0.0.0:8000")
BIND=localhost:8000

# redis url (e.g. redis://user:password@hostname:port/0) (default: "redis://localhost:6379")
REDIS_URL=redis://localhost:6379

# postgresql dsn (e.g.: postgres://user:password@hostname/database?sslmode=disable)
POSTGRES_DSN=postgres://loraserver_ns:dbpassword@localhost/loraserver_ns?sslmode=disable

# automatically apply database migrations
DB_AUTOMIGRATE=true

# mqtt broker server used by the gateway backend (e.g. scheme://host:port where scheme is tcp, ssl or ws) (default: "tcp://localhost:1883")
GW_MQTT_SERVER=tcp://localhost:1883

# mqtt username used by the gateway backend (optional)
GW_MQTT_USERNAME=

# mqtt password used by the gateway backend (optional)
GW_MQTT_PASSWORD=

# hostname:port of the application-server api server (optional) (default: "127.0.0.1:8001")
AS_SERVER=58.26.233.192:8001

# ca certificate used by the application-server client (optional)
AS_CA_CERT=

# tls certificate used by the application-server client (optional)
AS_TLS_CERT=

# tls key used by the application-server client (optional)
AS_TLS_KEY=

# hostname:port of the network-controller api server (optional)
NC_SERVER=

# ca certificate used by the network-controller client (optional)
NC_CA_CERT=

# tls certificate used by the network-controller client (optional)
NC_TLS_CERT=

# tls key used by the network-controller client (optional)
NC_TLS_KEY=

# time to wait for uplink de-duplication (default: 200ms)
DEDUPLICATION_DELAY=200ms

# delay between uplink delivery to the app server and getting the downlink data from the app server (if any) (default: 100ms)
GET_DOWNLINK_DATA_DELAY=100ms

# timezone to use when aggregating data (e.g. 'Europe/Amsterdam') (optional, by default the local timezone is used)
# TIMEZONE=Europe/Amsterdam

# create non-existing gateways on receiving of stats
GW_CREATE_ON_STATS=true

# aggregation intervals to use for aggregating the gateway stats (valid options: second, minute, hour, day, week, month, quarter, year)
GW_STATS_AGGREGATION_INTERVALS=minute,hour,day

# extra frequencies to use for ISM bands that implement the CFList
# EXTRA_FREQUENCIES=867100000,867300000,867500000,867700000

And showing " cd /etc/default/lora-app-server"
# ip:port to bind the api server (default: "0.0.0.0:8000")
BIND=localhost:8000

# redis url (e.g. redis://user:password@hostname:port/0) (default: "redis://localhost:6379")
REDIS_URL=redis://localhost:6379

# postgresql dsn (e.g.: postgres://user:password@hostname/database?sslmode=disable)
POSTGRES_DSN=postgres://loraserver_ns:dbpassword@localhost/loraserver_ns?sslmode=disable

# automatically apply database migrations
DB_AUTOMIGRATE=true

# mqtt broker server used by the gateway backend (e.g. scheme://host:port where scheme is tcp, ssl or ws) (default: "tcp://localhost:1883")
GW_MQTT_SERVER=tcp://localhost:1883

# mqtt username used by the gateway backend (optional)
GW_MQTT_USERNAME=

# mqtt password used by the gateway backend (optional)
GW_MQTT_PASSWORD=

# hostname:port of the application-server api server (optional) (default: "127.0.0.1:8001")
AS_SERVER=58.26.233.192:8001

# ca certificate used by the application-server client (optional)
AS_CA_CERT=

# tls certificate used by the application-server client (optional)
AS_TLS_CERT=

# tls key used by the application-server client (optional)
AS_TLS_KEY=

# hostname:port of the network-controller api server (optional)
NC_SERVER=

# ca certificate used by the network-controller client (optional)
NC_CA_CERT=

# tls certificate used by the network-controller client (optional)
NC_TLS_CERT=

# tls key used by the network-controller client (optional)
NC_TLS_KEY=

# time to wait for uplink de-duplication (default: 200ms)
DEDUPLICATION_DELAY=200ms

# delay between uplink delivery to the app server and getting the downlink data from the app server (if any) (default: 100ms)
GET_DOWNLINK_DATA_DELAY=100ms

# timezone to use when aggregating data (e.g. 'Europe/Amsterdam') (optional, by default the local timezone is used)
# TIMEZONE=Europe/Amsterdam

# create non-existing gateways on receiving of stats
GW_CREATE_ON_STATS=true

# aggregation intervals to use for aggregating the gateway stats (valid options: second, minute, hour, day, week, month, quarter, year)
GW_STATS_AGGREGATION_INTERVALS=minute,hour,day

# extra frequencies to use for ISM bands that implement the CFList
# EXTRA_FREQUENCIES=867100000,867300000,867500000,867700000

# enable only a given sub-set of channels (e.g. '0-7,64')
# ENABLE_UPLINK_CHANNELS=0-7,64

# the ttl after which a node-session expires after no activity (default 31 days)
NODE_SESSION_TTL=744h0m0s

Previously we was work with Orbiwise on the testing purpose. Now we are trying to develop loraserver my own VM. Please help me to solve my error. Please email me
basker.balasundram@tm.com.my to share more info.

Thanks
Basker

I think the error message is quite clear :smiley:

Can you help to solve because i not clear the error. For your info, i’m installing loraserver for testing purpose to evaluate and than if it looks comply with our requirements than i will send an email to purchase support. I need to test adding devices class A & C UL and DL. Class C for street light. I’m using kerlink gateway model Wirnet Station 928mhz. Appreciate if you could help me. Thanks.

Are you follow this instructions?

and instructions for loraserver

And you must pay attention for this:
LoRa Server persists the gateway data into a PostgreSQL database. Note that PostgreSQL 9.5+ is required.

Somewhere you’ve configured the DB user loraserver for the loraserver service. For the lora-app-server service, you’ve configured the DB user loraappserver. That is at least what the log is telling you. As this does not match the DB users you’ve created (loraserver_ns and loraserver_as), both services are not able to connect to the DB (password authentication failed).

Hi Grendy Eki Aliandy,

Thanks for your reply and for your information i have done the quick install instruction.


I have attached, installed psql -v 9.5
I followed all the credential as mention in loraserver.io even for mosquitto and of course PostgresSQL db.
Please guide me to finish setup this loraserver.

Thanks

Hi Brocaar,
Please confirm the portion where i configured wrong credential? This is from /etc/default/loraserver


For /etc/default/lora-app-server:

For your information, i have use same credential as in quick install.

Thanks

Please see the POSTGRES_DSN setting.

Hi Brocaar,
I’m getting the same error even i have done the changes in Postgres SQL.


“journalctl -u loraserver -f -n 50”

“journalctl -u lora-app-server -f -n 50”

And my “sudo nano loraserver”
image
In "sudo nano lora-app-server

Please advise me
Thanks

Please note that you need to restart both services in order to apply the settings.

Hi Brocaar,
I have done reboot and restart few times.
“journalctl -u loraserver -f -n 50”
and
“journalctl -u lora-app-server -f -n 50”
is still not resolve.
The error is
image

image

**I would like to get your assistance, if you’re ok than please share your email.

Thanks
Basker

Please note that you’ve configured loraserver as database in your POSTGRES_DSN settings. You’re getting the database "loraserver" does not exist" as that is not the database you’ve created.

As you mentioned earlier, you’ve created two databases loraserver_ns and loraserver_as :wink:

Hi Brocaar,

I hope that you will bare with me.
Base on your advise, i have done but yet still get error.

For mqtt user credential:

User-------------------Password
loraroot----------------loraserver
loragw-----------------loragw
loraserver-------------loraserver
loraappserver--------loraappserver

Postgres Database Credential

Database Name-----------------Password
loraserver_ns---------------------dbpassword
loraserver_as---------------------dbpassword

image

sudo nano loraserver

sudo nano lora-app-server

Please advise and sorry for keep this unfinished. Thanks in advance

You made any setup on mosquitto in terms of authentication ? If so, you have to add it to the services config files, loraserver, lora-gateway-bridge and lora-app-server

Hi Tiago,
As per quick install tutorial, yes i have setup on Mosquitto authentication :–

Create a password file for your mosquitto users, starting with a “root” user.

The “-c” parameter creates the new password file. The command will prompt for

a new password for the user.

Add users for the various MQTT protocol users

sudo mosquitto_passwd /etc/mosquitto/pwd loragw
sudo mosquitto_passwd /etc/mosquitto/pwd loraserver
sudo mosquitto_passwd /etc/mosquitto/pwd loraappserver

Secure the password file

sudo chmod 600 /etc/mosquitto/pwd

I done as above and can i know if still have to add it to the services config files, loraserver, lora-gateway-bridge and lora-app-server.
If yes than can you direct which services config files, etc…

Thanks

just input on :
sudo nano lora-app-server
sudo nano loraserver
sudo nano loragw

at the fields:
MQTT_USERNAME/MQTT_PASSWORD that info

-> then stop all the services, restart mosquitto

-> and in another terminal window : tail -f /var/log/messages | grep mosquitto

-> sudo service loraserver start, check the messages in the previous terminal
-> proceed equally to all the remaining services;

:wink:

Hope it helps

Hi Tiago,
Please refer to the below as i fix the input on
sudo nano lora-app-server
sudo nano loraserver
sudo nano loragw


image


I don’t have loragw file to input.
Input on "sudo nano lora-gateway-bridge

In my server, i don’t have /var/log/messages as you can see below
image

If you willing to help, please share your email so i can send my server credential to you for ssh.
Thanks in advance

Hi,
Only for check if it is related to mosquitto in your mosquitto.conf file
check

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

and do not put anything in conf.d certs and ca_certificates folders.
Now in loraserver lora-gateway-bridge and lora-app-server files donot give MQTT_USERNAME and password.
And check

have you solved yet?

Hi Rajnish Narayan & Tiago Magalhaes,

I have done as per Rajnish and the result as below : -

image

image

I believe that i have followed as per your guide and it will be very appreciated if any could share they email so i will send my loraserver ssh credential to look forward. Next week i have demo with my customer and vendor on Street Light by using two LoRa Server provider. But i’m a bit worried unable to show demo on loraserver.io if this issue remain. I hope will get assistance from any who willing to help me. My email is basker.balasundram@tm.com.my

Thanks,
Basker