Lite GUI web interface to analyze lnd data and manage your node with automation.
- Clone respository
git clone https://github.com/cryptosharks131/lndg.git
- Change directory into the repo
cd lndg
- Customize
docker-compose.yaml
if you like and then build/deploy your docker image:docker-compose up -d
- LNDg should now be available on port
8889
- Unless you save your
db.sqlite3
file before destroying your container, this data will be lost and rebuilt when making a new container. However, some data such as rebalances from previous containers cannot be rebuilt. - You can make this file persist by initializing it first locally
touch /root/lndg/db.sqlite3
and then mapping it locally in your docker-compose file under the volumes./root/lndg/db.sqlite3:/lndg/db.sqlite3:rw
- Clone respository
git clone https://github.com/cryptosharks131/lndg.git
- Change directory into the repo
cd lndg
- Make sure you have python virtualenv installed
apt install virtualenv
- Setup a python3 virtual environment
virtualenv -p python3 .venv
- Install required dependencies
.venv/bin/pip install -r requirements.txt
- Initialize some settings for your django site (see notes below)
.venv/bin/python initialize.py
- Migrate all database objects
.venv/bin/python manage.py migrate
- Generate some initial data for your dashboard
.venv/bin/python jobs.py
- Run the server via a python development server
.venv/bin/python manage.py runserver 0.0.0.0:8889
The files jobs.py
and rebalancer.py
inside lndg/gui/ serve to update the backend database with the most up to date information and rebalance any channels based on your lndg dashboard settings and requests. A refresh interval of at least 15-30 seconds is recommended for the best user experience.
Recommend Setup With Supervisord or Systemd
-
Supervisord
a) Setup supervisord config.venv/bin/python initialize.py -sd
b) Install Supervisord.venv/bin/pip install supervisor
c) Start Supervisordsupervisord
-
Systemd (2 options)
Option 1 - Bash script installsudo bash systemd.sh
Option 2 - Manual Setup Instructions
Alternatively, you may also make your own task for these files with your preferred tool (task scheduler/cronjob/etc).
- If you are not using the default settings for LND or you would like to run a LND instance on a network other than
mainnet
you can use the correct flags in step 6 (seeinitialize.py --help
) or you can edit the variables directly inlndg/lndg/settings.py
. - Some systems have a hard time serving static files (docker/macOs) and installing whitenoise and configuring it can help solve this issue. You can use
initialize.py -wn
to setup whitenoise and install it with.venv/bin/pip install whitenoise
. - If you want to recreate a settings file, delete it from
lndg/lndg/settings.py
and rerun.initialize.py
- If you plan to run this site continuously, consider setting up a proper web server to host it (see Nginx below).
-ip
or--nodeip
- Accepts only this host IP to serve the LNDg page - default:*
-dir
or--lnddir
- LND Directory for tls cert and admin macaroon paths - default:~/.lnd
-net
or--network
- Network LND will run over - default:mainnet
-server
or--rpcserver
- Server address to use for rpc communications with LND - default:localhost:10009
-sd
or--supervisord
- Setup supervisord to run jobs/rebalancer background processes - default:False
-wn
or--whitenoise
- Add whitenoise middleware (docker requirement for static files) - default:False
-d
or--docker
- Single option for docker container setup (supervisord + whitenoise) - default:False
-dx
or--debug
- Setup the django site in debug mode - default:False
- Make sure you are in the lndg folder
cd lndg
- Pull the new files
git pull
- Migrate any database changes
.venv/bin/python manage.py migrate
If you would like to serve the dashboard at all times, it is recommended to setup a proper production webserver to host the site.
A bash script has been included to help aide in the setup of a nginx webserver. sudo bash nginx.sh
The following data can be accessed at the /api endpoint:
payments
paymenthops
invoices
forwards
onchain
peers
channels
rebalancer
settings
Here are some notes to help you get started using the auto-rebalancer (AR).
- The AR variable
AR-Enabled
must be set to 1 (enabled) in order to start looking for new rebalance opportunities. - The AR variable
AR-Target%
defines the % size of the channel capacity you would like to use for rebalance attempts. - The AR variable
AR-Time
defines the maximum amount of time we will spend looking for a route. - The AR variable
AR-MaxFeeRate
defines the maximum amount in ppm a rebalance attempt can ever use for a fee limit. - The AR variable
AR-MaxCost%
defines the maximum % of the ppm being charged on theINBOUND
receving channel that will be used as the fee limit for the rebalance attempt. - Rebalances will only consider any
OUTBOUND
channel that has more outbound liquidity than the currentAR-Outbound%
target and the channel is not currently being targeted as anINBOUND
receving channel for rebalances. - Channels need to be targeted in order to be refilled with outbound liquidity and in order to control costs as a first prioirty, all calculations are based on the specific
INBOUND
receving channel. - Enable
INBOUND
receving channels you would like to target and set an inbound liquidityTarget%
on the specific channel. Rebalance attempts will be made until inbound liquidity falls below this channel settting. - The
INBOUND
receving channel is the channel that later routes out real payments and earns back the fees paid. Target channels that have lucrative outbound flows. - Successful and attempts with only incorrect payment information are tried again immediately.
- Attempts that fail for other reasons will not be tried again for 30 minutes after the stop time.