tdiesler / nessus-cardano

A Cardano playground that explores various build/runtime aspects of the project. Something like an incubation space, before we are propose changes upstream. The initial focus is on "container first" for the Cardano node.
91 stars 29 forks source link

Use dynamic public IP in topology updater #8

Closed tdiesler closed 3 years ago

tdiesler commented 3 years ago

It should be possible to not explicitly give a public IP. The topology updater should be able to figure that out itself.

Dominik-Gubrynowicz commented 2 years ago

Hello, it is possible to do this? When I skip CARDANO_PUBLIC_IP env I get an error like this:

Writing /var/cardano/config/mainnet-topology.json ...
Reading CARDANO_PUBLIC_IP from Kubernetes ...
jq: error (at <stdin>:14): Cannot index string with string "addresses"

On the other hand, if I specify CARDANO_PUBLIC_IP, the IP in the topologyUpdater is set explicitly:

curl -s -f https://api.clio.one/htopology/v1/?port=30801&blockNo=7025682&valency=1&magic=764824073&hostname=<CARDANO_PUBLIC_IP>
{ "resultcode": "501", "datetime":"2022-03-21 21:57:27", "clientIp": "<CARDANO_PUBLIC_IP>", "msg": "invalid hostname not pointing to client IP" }
curl -s -f https://api.clio.one/htopology/v1/fetch/?max=8&magic=764824073
Topology updated: /var/cardano/config/mainnet-topology.json

I would much appreciate any help in this case.

tdiesler commented 2 years ago

Are you actually trying to run this on k8s? This code would only be executed, if you have KUBERNETES_SERVICE_HOST set.

There isn't actually much benefit of running the node in k8s over using docker compose.

Dominik-Gubrynowicz commented 2 years ago

Do you suggest that I should set KUBERNETES_SERVICE_HOST explicitly? I'll try, thanks! I'm running it as you said on Kubernetes and I find this approach pretty great in the case of scalability.

EDIT - I have KUBERNETES_SERVICE_HOST and I'm unable to overwrite this.