No relations found using Vagrant LoraServer-Setup

Hi,

I’m trying use loraserver-setup but I’m having some issues, after update the BAND configuration I run on the terminal:

vagrant up

Looking in the logs I see the next.

POSTGRES LOG
----------------------
[11884] loraserver_as@loraserver_as ERROR:  relation "user" does not exist at character 27
[11884] loraserver_as@loraserver_as STATEMENT:  select password_hash from "user" where username = $1 and is_active = true limit 1
MOSQUITTO LOG
----------------------
1509237012: mosquitto_auth_unpwd_check(loraserver_gw)
1509237012: ** checking backend files
1509237012: ** checking backend postgres
1509237012: GETTING USERS: loraserver_gw
1509237012: ERROR:  relation "user" does not exist
LINE 1: select password_hash from "user" where username = $1 and is_...

Checking with PSQL

postgres=# \list
                                      List of databases
     Name      |     Owner     | Encoding |   Collate   |    Ctype    |   Access privileges   
---------------+---------------+----------+-------------+-------------+-----------------------
 loraserver_as | loraserver_as | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 loraserver_ns | loraserver_ns | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres      | postgres      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0     | postgres      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |               |          |             |             | postgres=CTc/postgres
 template1     | postgres      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |               |          |             |             | postgres=CTc/postgres
(5 rows)

postgres=# \c loraserver_as
You are now connected to database "loraserver_as" as user "postgres".
loraserver_as=# \dt
No relations found.

postgres=# \c loraserver_ns
You are now connected to database "loraserver_as" as user "postgres".
loraserver_ns=# \dt
No relations found.

Anybody with the same issue?

Environment:

  • vagrant 2.0.0
  • virtual box 5.1.30
  • MacOS High Sierra

Probably your DBs haven’t been migrated yet. Check the auto migrate flags for both, loraserver and appserver, and run them with auto migrations on to get your DBs setted up.

Good catch! I think during the cleanup of the main.go file I might have changed the order of some of the functions. What happens is that LoRa App Server tries to connect to the MQTT broker first, before creating the tabes. As the MQTT authentication is querying the database for authentication it fails on the non-existing tables. Because of this the MQTT connection is rejected.

It could also be because of a change in the mosquitto-auth-plug, as the LoRa App Server, LoRa Gateway Bridge and LoRa Server MQTT authentication data is written to a file, and file-based authentication has priority over db authentication.

I’m planning to release a fix soon. In the meanwhile, could you change lora_app_server_integration: True to lora_app_server_integration: False in the vagrant.yml? And then run vagrant provision to update the configuration.

Actually, there was a different issue. A new build flag was added to the mosquitto-auth-plug build config.

SUPPORT_DJANGO_HASHERS ?= no

I’ve updated the loraserver-setup repository (https://github.com/brocaar/loraserver-setup/commit/2408f50ec70ad4611e0af1f1a6384d791329e137). Could you pull the last changes and do a:

# destroy old vagrant instance
vagrant destroy -f

# re-create instance
vagrant up

I’ve tried this myself and adding the above build flag fixed the issue for me :slight_smile:

Brocaar, https://github.com/brocaar/loraserver-setup/commit/2408f50ec70ad4611e0af1f1a6384d791329e137 Fix the error, for some strange reason I had to run also vagrant provision

Thank you Brocaar, iegomez.

1 Like