Hello all,
I reply to my post reagarding to the error that the pirvate docker handler seems to get stack while registering, adding devices or trying to retrieve device list.
After a lot of debugging and attemps ( also understanding the architecture did help) , the issue relies on the fact that of missing configuration for the communication between the broker and the networkserver. The error
> Discovery_1 | DEBUG Handled request CallerID=artGuard-handler CallerIP=172.18.0.6:56794 Duration=210.561µs Method=/discovery.Discovery/Get
> handler_1 | DEBUG Could not connect to gRPC server, reconnecting... Address=broker.local.thethings.network:1902 error=dial tcp 172.18.0.8:1902: getsockopt: connection refused
> handler_1 | DEBUG Could not connect to gRPC server, reconnecting... Address=broker.local.thethings.network:1902 error=dial tcp 172.18.0.8:1902: getsockopt: connection refused
> handler_1 | DEBUG Could not connect to gRPC server, reconnecting... Address=broker.local.thethings.network:1902 error=dial tcp 172.18.0.8:1902: getsockopt: connection refused
> broker_1 | DEBUG Could not connect to gRPC server, reconnecting... Address=localhost:1903 error=dial tcp [::1]:1903: getsockopt: connection refused
is only displayed if the debug option for each service (handler discovery broker
) is enabled, here below only the option enabled for the handler
handler:
image: thethingsnetwork/ttn:latest
command: handler --config /etc/ttn/handler/artGuardConfig.yml
depends_on:
- discovery
- redis
- rabbitmq
environment:
- TTN_DEBUG=true
networks:
default:
aliases:
- handler.artGuard.local
ports:
- "1904:1904"
- "8084:8084"
volumes:
- "/host/handler:/etc/ttn/handler"
The missing entry is on the broker/config.yml
and it is the network server address, otherwise the broker cannot connect to it and therefore it falls back to the localhost, which refuses the connection. Thus the boker config should contain such as entry and the port of the broker, I think @htdvisser forgot to include it, although it’s briefdly mentioned in his private route with docker section changing the hosts, it is does not appear on the private route broker section, so I think that should be changed/added.
~$cat config.yml
id: broker
tls: true
key-dir: /etc/ttn/broker/
auth-servers:
ttn-account-v2: "https://account.thethingsnetwork.org"
discovery-address: "discovery.local:1900"
auth-token: YOUR TOKEN
broker:
server-address-announce: broker.artGuard.local
networkserver-address: "networkserver.local:1903"
networkserver-cert: /etc/ttn/broker/networkserver.cert
networkserver-token: YOUR TOKEN
Likewise, there is missing an entry in the networkserver yml config, since its own advertise address is not present and it should be. This is missing as well for the private route guide
~$cat config.yml
id: networkserver
tls: true
#key-dir: /home/lorabackbone/TTNBackBone/host/networkserver/
key-dir: /etc/ttn/networkserver/
auth-servers:
ttn-account-v2: "https://account.thethingsnetwork.org"
networkserver:
redis-address: redis:6379
server-address-announce: networkserver.local
Adding those too elements made my private handler back operative and responsive ( the error is normal since that app wasn’t registered yet)
VirtualBox:~/TTNBackBone$ ./ttnctl-linux-amd64 devices list --config ./host/ttnctl/artGuardConfig.yml --data ./host/ttnctl/
INFO Using Application AppEUI=AAAAAAAAAAAA AppID=ab
INFO Discovering Handler... Handler=handler
INFO Connecting with Handler... Handler=handler.local:1904
FATAL Could not get devices. error=Could not get devices for application from Handler: Application not registered to this Handler: handler:application:ag not found
Looking into the logs of the backend I saw
discovery_1 | DEBUG Handled request CallerID=ttnctl-l@l-VirtualBox CallerIP=172.18.0.1:58502 Duration=334.669µs Method=/discovery.Discovery/Get
handler_1 | DEBUG Handled request with error CallerID=client-l@l-VirtualBox CallerIP=172.18.0.1:42358 Duration=706.174µs ErrCode=NotFound Method=/handler.ApplicationManager/GetDevicesForApplication error=rpc error: code = 5 desc = Application not registered to this Handler: handler:application:ab not found
Regards and enjoy your private docker ttn backend