cryptosharks131 / lndg

Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks.
MIT License
219 stars 41 forks source link

LNDg cannot reach the gRPC for LND. #348

Closed 25shmeckles closed 7 months ago

25shmeckles commented 10 months ago

I am running the latest docker image on Linux Mint 21.2 Cinnamon

I get the following error after logging in to the server.

An error has occured!
LNDg cannot reach the gRPC for LND. Make sure LND is running and/or your gRPC settings are correct.
Error Code: StatusCode.UNAVAILABLE

Screenshot from 2023-12-03 18-17-42

LND is running just fine as well as other tools, like RTL and loop. So the gRPC settings on LND should be correct. I can't find anything relevant on the docs to solve this. Any help is welcome.

cryptosharks131 commented 10 months ago

Are you also running LND in a docker container?

25shmeckles commented 9 months ago

Yes

25shmeckles commented 9 months ago

From local works, although the GUI has some issues. But from the container it is not communicating with LND.

Here is the odd rendering of the local GUI. No colored bars, weird alignments, the Toggle dark mode button doesn't work.

Screenshot 2023-12-11 at 11 59 14
cryptosharks131 commented 9 months ago

Networking between docker containers can be complex unless they are running on the same docker virtual network. You can add the docker network LND is using to your LNDg docker-compose.yaml so they can communicate on the same host or let LND listen on your machine IP and accept requests from the docker network LNDg is using. You can also try running the LNDg container with network_mode: "host" or run LNDg without Docker.

The rendering issue looks like you are missing the required css files. Usually this is not an issue for docker installations, maybe check the dev tools page of your browser to see if there are any issues loading those static files.

Heebron commented 9 months ago

Is there a debug flag I can set? I just updated my local instance following the below and can no longer connect to lnd upon restart. I get the error titling this ticket.

docker-compose down
git pull
docker-compose build --no-cache
docker-compose up

I run without the -d hoping to see some indication describing why the connection fails. Nothing pops up.

I am very familiar with docker and overlay networking but don't run my lnd in a container.

I use lit (lightning terminal) as well - and it has no problem connecting to lnd.

Here is the log output:

docker compose up 
[+] Running 1/1
 ✔ Container lndg-lndg-1  Recreated                                                                                                                                                                                                     11.0s 
Attaching to lndg-lndg-1
lndg-lndg-1  | Supervisord setup requested...
lndg-lndg-1  | Data directory already found...
lndg-lndg-1  | /usr/local/lib/python3.12/site-packages/supervisor/options.py:474: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
lndg-lndg-1  |   self.warnings.warn(
lndg-lndg-1  | Performing system checks...
lndg-lndg-1  | 
lndg-lndg-1  | System check identified no issues (0 silenced).
lndg-lndg-1  | December 30, 2023 - 14:43:43
lndg-lndg-1  | Django version 5.0, using settings 'lndg.settings'
lndg-lndg-1  | Starting development server at http://0.0.0.0:8889/
lndg-lndg-1  | Quit the server with CONTROL-C.
lndg-lndg-1  | 
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET / HTTP/1.1" 302 0
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /lndg-admin/login/?next=/ HTTP/1.1" 200 4156
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/css/dark_mode.css HTTP/1.1" 200 2682
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/css/base.css HTTP/1.1" 200 21544
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/css/login.css HTTP/1.1" 200 958
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/css/nav_sidebar.css HTTP/1.1" 200 2810
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/css/responsive.css HTTP/1.1" 200 17905
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/js/theme.js HTTP/1.1" 200 1943
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/admin/js/nav_sidebar.js HTTP/1.1" 200 3063
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /favicon.ico HTTP/1.1" 302 0
lndg-lndg-1  | [30/Dec/2023 14:44:01] "GET /static/favicon.ico HTTP/1.1" 304 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "POST /lndg-admin/login/?next=/ HTTP/1.1" 302 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET / HTTP/1.1" 200 12447
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET /static/api.js HTTP/1.1" 304 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET /static/sort_table.js HTTP/1.1" 304 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET /static/qrcode.js HTTP/1.1" 304 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET /static/w3style.css HTTP/1.1" 304 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET /static/helpers.js HTTP/1.1" 304 0
lndg-lndg-1  | [30/Dec/2023 14:44:04] "GET /favicon.ico HTTP/1.1" 302 0
cryptosharks131 commented 9 months ago

You can enable the django debug mode with the -dx flag but I'm not sure it will give you any additional information in this case.

Heebron commented 9 months ago

It told me just enough. Thanks. I recently changed my DNS cache from dnsmasq to AdGuardHome. The problem was in the way AdGuardHome handles things vice dnsmasq. Have a Happy and Safe New Year!

psisoyev commented 8 months ago

I'm facing a similar issue. I've put both LND and LNDg in the same docker network but can't establish a grpc connection:

lndg  | Migration step failed: <_InactiveRpcError of RPC that terminated with:
lndg  |     status = StatusCode.UNAVAILABLE
lndg  |     details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:172.18.0.3:10009: Peer name lnd is not in peer certificate"
lndg  |     debug_error_string = "UNKNOWN:Error received from peer  {grpc_message:"failed to connect to all addresses; last error: UNKNOWN: ipv4:172.18.0.3:10009: Peer name lnd is not in peer certificate", grpc_status:14, created_time:"2024-01-07T13:35:34.315727546+00:00"}"
lndg  | >

I've tried to pass certificates explicitly using flag -tls but had no luck. Any hints?

cryptosharks131 commented 8 months ago

I have not seen this error before, do you want to share how you setup your docker networking?

psisoyev commented 8 months ago

It was my mistake at the end. I've misconfigured TLS certificates for LND/LNDg.

What one should do is to create/edit lnd.conf for LND and add there

tlscertpath=/etc/lnd-tls/tls.crt
tlskeypath=/etc/lnd-tls/tls.key

This certificate should be generated beforehand and mounted as a volume (for my test environment I'm using simple self-signed certificate) to the container. The same certificate should be passed to LNDg and passed as an argument to LNDg: command: ["sh", "-c", "python initialize.py -net 'simnet' -tls '/etc/lnd-tls/tls.crt' -server 'lnd:10009' -d && supervisord && python manage.py runserver 0.0.0.0:8000"] One should also add the DNS name to the certificate and then it should all work well