Migrations error


#1

Hi Everyone,
I would really appreciate a help here,
I have followed the instructions in the documentation and installed the three components (loraserver, lora-app-server, and lora-gateway-bridge) I have also used two separate databases loraserver_ns and loraserver_as,
However, when I start the above three i still get the following:

lora-app-server:

root@debian:/home/noman# sudo systemctl start lora-app-server
root@debian:/home/noman# 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: failed (Result: exit-code) since Tue 2018-08-28 15:16:47 BST; 8s ago
Docs: https://docs.loraserver.io
Process: 24635 ExecStart=/usr/bin/lora-app-server (code=exited, status=1/FAILURE)
Main PID: 24635 (code=exited, status=1/FAILURE)

Aug 28 15:16:47 debian systemd[1]: lora-app-server.service: Unit entered failed state.
Aug 28 15:16:47 debian systemd[1]: lora-app-server.service: Failed with result ‘exit-code’.
Aug 28 15:16:47 debian systemd[1]: lora-app-server.service: Service hold-off time over, scheduling restart.
Aug 28 15:16:47 debian systemd[1]: Stopped LoRa App Server.
Aug 28 15:16:47 debian systemd[1]: lora-app-server.service: Start request repeated too quickly.
Aug 28 15:16:47 debian systemd[1]: Failed to start LoRa App Server.
Aug 28 15:16:47 debian systemd[1]: lora-app-server.service: Unit entered failed state.
Aug 28 15:16:47 debian systemd[1]: lora-app-server.service: Failed with result ‘exit-code’.

lora-app-server config:

root@debian:/home/noman# lora-app-server --config /etc/lora-app-server/lora-app-server.toml
INFO[0000] starting LoRa App Server docs=“https://www.loraserver.io/” version=1.0.1
INFO[0000] connecting to postgresql
INFO[0000] setup redis connection pool
INFO[0000] handler/mqtt: TLS config is empty
INFO[0000] handler/mqtt: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0000] applying database migrations
INFO[0000] handler/mqtt: connected to mqtt broker
INFO[0000] handler/mqtt: subscribing to tx topic qos=0 topic=application/+/device/+/tx
FATA[0000] applying migrations error: pq: relation “node” does not exist handling 0002_join_accept_params.sql

loraserver:

root@debian:/home/noman# sudo systemctl start loraserver
root@debian:/home/noman# sudo systemctl status loraserver
● loraserver.service - LoRa Server
Loaded: loaded (/lib/systemd/system/loraserver.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-08-28 15:20:23 BST; 7s ago
Docs: https://docs.loraserver.io
Process: 24726 ExecStart=/usr/bin/loraserver (code=exited, status=1/FAILURE)
Main PID: 24726 (code=exited, status=1/FAILURE)

Aug 28 15:20:23 debian systemd[1]: loraserver.service: Failed with result ‘exit-code’.
Aug 28 15:20:23 debian systemd[1]: loraserver.service: Service hold-off time over, scheduling restart.
Aug 28 15:20:23 debian systemd[1]: Stopped LoRa Server.
Aug 28 15:20:23 debian systemd[1]: loraserver.service: Start request repeated too quickly.
Aug 28 15:20:23 debian systemd[1]: Failed to start LoRa Server.
Aug 28 15:20:23 debian systemd[1]: loraserver.service: Unit entered failed state.
Aug 28 15:20:23 debian systemd[1]: loraserver.service: Failed with result ‘exit-code’.

loraserver config:

root@debian:/home/noman# loraserver --config /etc/loraserver/loraserver.toml
INFO[0000] starting LoRa Server band=EU_863_870 docs=“https://docs.loraserver.io/” net_id=010203 version=1.0.0
INFO[0000] setup redis connection pool url=“redis://localhost:6379”
INFO[0000] connecting to postgresql
INFO[0000] backend/gateway: TLS config is empty
INFO[0000] backend/gateway: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0000] configuring join-server client ca_cert= server=“http://localhost:8003” tls_cert= tls_key=
INFO[0000] no network-controller configured
INFO[0000] applying database migrations
INFO[0000] backend/gateway: connected to mqtt server
INFO[0000] backend/gateway: subscribing to rx topic qos=0 topic=gateway/+/rx
INFO[0000] backend/gateway: subscribing to stats topic qos=0 topic=gateway/+/stats
FATA[0000] applying migrations failed: pq: column “location” does not exist handling 0004_update_gateway_model.sql

lora-gateway-bridge:

root@debian:/home/noman# 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 Mon 2018-08-20 09:59:21 BST; 1 weeks 1 days ago
Docs: https://docs.loraserver.io
Main PID: 611 (lora-gateway-br)
Tasks: 12 (limit: 4915)
CGroup: /system.slice/lora-gateway-bridge.service
└─611 /usr/bin/lora-gateway-bridge

Aug 20 09:59:21 debian systemd[1]: Started LoRa Gateway Bridge.
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“starting LoRa Gateway Bridge” docs="https://www.loraserver.io/lora
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“backend: TLS config is empty”
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“backend: connecting to mqtt broker” server=“tcp://127.0.0.1:1883”
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“gateway: starting gateway udp listener” addr=“0.0.0.0:1700”
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“backend: connected to mqtt broker”

lora-gateway-bridge config:

root@debian:/home/noman# 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 Mon 2018-08-20 09:59:21 BST; 1 weeks 1 days ago
Docs: https://docs.loraserver.io
Main PID: 611 (lora-gateway-br)
Tasks: 12 (limit: 4915)
CGroup: /system.slice/lora-gateway-bridge.service
└─611 /usr/bin/lora-gateway-bridge

Aug 20 09:59:21 debian systemd[1]: Started LoRa Gateway Bridge.
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“starting LoRa Gateway Bridge” docs="https://www.loraserver.io/lora
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“backend: TLS config is empty”
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“backend: connecting to mqtt broker” server=“tcp://127.0.0.1:1883”
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“gateway: starting gateway udp listener” addr=“0.0.0.0:1700”
Aug 20 09:59:23 debian lora-gateway-bridge[611]: time=“2018-08-20T09:59:23+01:00” level=info msg=“backend: connected to mqtt broker”

root@debian:/home/noman# lora-gateway-bridge --config /etc/lora-gateway-bridge/lora-gateway-bridge.toml
INFO[0000] starting LoRa Gateway Bridge docs=“https://www.loraserver.io/lora-gateway-bridge/” version=2.4.1
INFO[0000] backend: TLS config is empty
INFO[0000] backend: connecting to mqtt broker server=“tcp://127.0.0.1:1883”
INFO[0000] gateway: starting gateway udp listener addr=“0.0.0.0:1700”
FATA[0000] could not setup gateway backend: listen udp 0.0.0.0:1700: bind: address already in use

I would really appreciate any help as I’m really lost…

Many Thanks


#2

Have you seen the already existing topics? https://forum.loraserver.io/search?q=applying%20migrations%20error


#3

Thanks @brocaar
Yes, I went through the existing related topics and it didn’t help…

Please help…

Cheers


#4

Any ideas guys??

Really desperate here…

Thanks


#5

The only answer that I can think of is that both services are sharing the same database, as you had the previous time when you ran into this issue: Applying migrations error.

In that case I advice you to empty both databases and start from scratch as they might contain the wrong tables.


#6

Hi brocaar,

I have dropped both databases and recreated them, and now i got the following errors:

root@debian:~# loraserver --config /etc/loraserver/loraserver.toml
INFO[0000] starting LoRa Server band=EU_863_870 docs=“https://docs.loraserver.io/” net_id=010203 version=1.0.0
INFO[0000] setup redis connection pool url=“redis://localhost:6379”
INFO[0000] connecting to postgresql
INFO[0000] backend/gateway: TLS config is empty
INFO[0000] backend/gateway: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0000] backend/gateway: connected to mqtt server
INFO[0000] configuring join-server client ca_cert= server=“http://localhost:8003” tls_cert= tls_key=
INFO[0000] no network-controller configured
INFO[0000] applying database migrations
INFO[0000] backend/gateway: subscribing to rx topic qos=0 topic=gateway/+/rx
INFO[0000] backend/gateway: subscribing to stats topic qos=0 topic=gateway/+/stats
INFO[0000] migrations applied count=0
INFO[0000] starting api server bind=“0.0.0.0:8000” ca-cert= tls-cert= tls-key=
FATA[0000] start api listener error: listen tcp 0.0.0.0:8000: bind: address already in use

and

root@debian:~# loraserver --config /etc/lora-app-server/lora-app-server.toml
INFO[0000] starting LoRa Server band=EU_863_870 docs=“https://docs.loraserver.io/” net_id=000000 version=1.0.0
INFO[0000] setup redis connection pool url=“redis://localhost:6379”
INFO[0000] connecting to postgresql
INFO[0000] backend/gateway: TLS config is empty
INFO[0000] backend/gateway: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0000] backend/gateway: connected to mqtt server
INFO[0000] configuring join-server client ca_cert= server=“http://localhost:8003” tls_cert= tls_key=
INFO[0000] no network-controller configured
INFO[0000] applying database migrations
INFO[0000] backend/gateway: subscribing to rx topic qos=0 topic=gateway/+/rx
INFO[0000] backend/gateway: subscribing to stats topic qos=0 topic=gateway/+/stats
FATA[0000] applying migrations failed: pq: column “location” does not exist handling 0004_update_gateway_model.sql

Really appreciate your help in this…

Thanks