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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Badgateway 502 - Nginx - issue on RaspiBlitz

Steve-too opened this issue · comments

I'm not too technical but I know my way around and have followed all instructions but I'm not able to connect to LNDg via my webbrowser. When I type in the ip-addres and port number in the webbrowser I get a Bad Gateway 502 error.

example: http://192.168.2.178:8889

As said I'm not too technical and need help to troubleshoot this issue to resolve it. Thank you for you help (and patience ;-))

A 502 error usually presents when nginx cannot reach the app service, how did you install LNDg? If you did the setup for nginx, double check the uwsgi is running properly.

Check uwsgi the service status:
sudo systemctl status uwsgi.service

Check the uwsgi logs at:
/var/log/uwsgi/lndg.log

Thank you for your help - I want to make it work :) - NOTE - I've done the manual installation.

uwsgi.service - Lndg uWSGI app
Loaded: loaded (/etc/systemd/system/uwsgi.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2023-11-26 14:47:45 GMT; 1 day 3h ago
Main PID: 1722438 (uwsgi)
Status: "uWSGI is ready"
Tasks: 2 (limit: 9352)
CPU: 9.964s
CGroup: /system.slice/uwsgi.service
├─1722438 /home/admin/lndg/.venv/bin/uwsgi --ini /home/admin/lndg/lndg.ini
└─1722574 /home/admin/lndg/.venv/bin/uwsgi --ini /home/admin/lndg/lndg.ini

Nov 26 14:47:43 raspberrypi systemd[1]: Starting Lndg uWSGI app...
Nov 26 14:47:43 raspberrypi uwsgi[1722438]: [uWSGI] getting INI configuration from /home/admin/lndg/lndg.ini
Nov 26 14:47:45 raspberrypi systemd[1]: Started Lndg uWSGI app.
Nov 26 14:47:51 raspberrypi systemd[1]: /etc/systemd/system/uwsgi.service:12: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.

*** Starting uWSGI 2.0.23 (64bit) on [Sun Nov 26 14:47:43 2023] ***
compiled with version: 10.2.1 20210110 on 26 November 2023 12:16:52
os: Linux-6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023
nodename: raspberrypi
machine: aarch64
clock source: unix
detected number of CPU cores: 4
current working directory: /
detected binary path: /home/admin/lndg/.venv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /home/admin/lndg
your processes number limit is 31176
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /home/admin/lndg/lndg.sock fd 4
Python version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
PEP 405 virtualenv detected: /home/admin/lndg/.venv
Set PythonHome to /home/admin/lndg/.venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x5584eaae40
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145808 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x5584eaae40 pid: 1722438 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 1722438)
spawned uWSGI worker 1 (pid: 1722574, cores: 1)

This seems to be operational. Maybe check for clues in the nginx logs as well. They should be here:
/var/log/nginx/

Thanks again - in the error.log I find the following when accessing 192.168.2.178:8889 via Safari webbrowser

2023/11/28 16:46:10 [crit] 1723225#1723225: *228 connect() to unix:///home/admin/lndg/lndg.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.2.148, server: _, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///home/admin/lndg/lndg.sock:", host: "192.168.2.178:8889"
2023/11/28 16:46:14 [crit] 1723225#1723225: *227 connect() to unix:///home/admin/lndg/lndg.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.2.148, server: _, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///home/admin/lndg/lndg.sock:", host: "192.168.2.178:8889"

It seems like there is a permission issue with the lndg.sock file. You can try to resolve this so that both uwsgi and nginx are able to read/write to this file.

One thing that helped some resolve this issue was to update /etc/nginx/sites-enabled/lndg with user admin at the top of the file. You will need to restart nginx afterwards. sudo systemctl restart nginx