Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rootless + smaller image + cleanup #402

Open
wants to merge 15 commits into
base: v1.10.0
Choose a base branch
from
Open
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
__pycache__
db.sqlite3
lndg/settings.py
frontend
node_modules
lndg-admin.txt
.vscode
.vs
gui/static/admin
gui/static/rest_framework
data/
container
doc
scripts
.github
.git
!scripts/entrypoint.sh
!scripts/init.sh
!scripts/suinit.sh
1 change: 1 addition & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IMAGE=you/lndg
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env*
!.env-example
__pycache__
db.sqlite3
lndg/settings.py
Expand All @@ -8,4 +10,13 @@ lndg-admin.txt
.vs
gui/static/admin
gui/static/rest_framework
data/
data/
.DS_Store
container
doc
scripts
.github
.git
!scripts/entrypoint.sh
!scripts/init.sh
!scripts/suinit.sh
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

61 changes: 30 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ services:
lndg:
build: .
volumes:
- /home/<user>/.lnd:/root/.lnd:ro
- /home/<user>/<path-to>/lndg/data:/app/data:rw
- /home/<user>/.lnd:/lndg/.lnd:ro
- /home/<user>/<path-to>/lndg/data:/lndg/data:rw
command:
- sh
- -c
Expand All @@ -45,7 +45,7 @@ docker-compose up -d
# Retrieve the admin password for login
nano data/lndg-admin.txt
```
- **This example configuration will host LNDg at http://0.0.0.0:8889. Use the machine IP to reach the LNDg instance.**
- **This example configuration will host LNDg at http://0.0.0.0:8889. Use the machine IP to reach the LNDg instance.**
- **Log in to LNDg using the provided password and the username `lndg-admin`.**

### Updating
Expand Down Expand Up @@ -121,7 +121,7 @@ To restart the uWSGI service, use the following command:

```bash
sudo systemctl restart uwsgi.service
```
```

### Postgres
Optionally, you may chose to run LNDg using a postgres database instead of the default sqlite3.
Expand Down Expand Up @@ -173,7 +173,7 @@ LNDg will automatically act upon the suggestions it makes on the Suggests AR Act
LNDg will listen for failure events in your htlc stream and record them to the dashboard when they occur.

### API Backend
The following data can be accessed at the /api endpoint:
The following data can be accessed at the /api endpoint:
`payments` `paymenthops` `invoices` `forwards` `onchain` `peers` `channels` `rebalancer` `settings` `pendinghtlcs` `failedhtlcs`

### Peer Reconnection
Expand All @@ -183,15 +183,15 @@ LNDg will automatically try to resolve any channels that are seen as inactive, n
### Here are some additional notes to help you get started using Auto-Fees (AF).
LNDg can update your fees on a channel every 24 hours (default) if there is a suggestion listed on the fee rates page. You must make sure the `AF-Enabled` setting is set to `1` and that individual channels you want to be managed are also set to `enabled`. You can view a log of AF changes by opening the Autofees tab.

You can customize some settings of AF by updating the following settings:
`AF-FailedHTLCs` - The minimum daily failed HTLCs count in which we could trigger a fee increase (depending on flow)
`AF-Increment` - The increment size of our potential fee changes, all fee suggestions will be a multiple of this value
`AF-MaxRate` - The maximum fee rate in which we can adjust to
`AF-MinRate` - The minimum fee rate in which we can adjust to
`AF-Multiplier` - Multiplier to increase incremental movements, the larger the multiplier, the larger the incremental moves
`AF-UpdateHours` - Change the number of hours that must pass since the last fee rate change before AF may adjust the fee rate again
`AF-LowLiqLimit` - The liquidity (%) a channel must drop below before running the `Low Liquidity` fee algorithm
`AF-ExcessLimit` - The liquidity (%) a channel must go above before running the `Excess Liquidity` fee algorithm
You can customize some settings of AF by updating the following settings:
`AF-FailedHTLCs` - The minimum daily failed HTLCs count in which we could trigger a fee increase (depending on flow)
`AF-Increment` - The increment size of our potential fee changes, all fee suggestions will be a multiple of this value
`AF-MaxRate` - The maximum fee rate in which we can adjust to
`AF-MinRate` - The minimum fee rate in which we can adjust to
`AF-Multiplier` - Multiplier to increase incremental movements, the larger the multiplier, the larger the incremental moves
`AF-UpdateHours` - Change the number of hours that must pass since the last fee rate change before AF may adjust the fee rate again
`AF-LowLiqLimit` - The liquidity (%) a channel must drop below before running the `Low Liquidity` fee algorithm
`AF-ExcessLimit` - The liquidity (%) a channel must go above before running the `Excess Liquidity` fee algorithm

AF Notes:
1. AF changes only trigger after `AF-UpdateHours` hours of no fee updates via LNDg
Expand Down Expand Up @@ -225,20 +225,20 @@ Additional customization options:
6. `AR-Workers` - Define how many parallel rebalances to spin up at once. (default=1)

#### Steps to start the Auto-Rebalancer:
1. Update Channel Specific Settings
a. Go to Active Channels section
b. Find the channels you would like to activate for rebalancing (this refills its outbound)
c. On far right column Click the Enable button to activate rebalancing
d. The dashboard will refresh and show AR-Target 100%
e. Adjust the AR-Target to desired % of liquidity you want to keep on remote INBOUND side. Example select 0.60 if you want 60% of the channel capacity on Remote/INBOUND side which would mean that there is 40% on Local/OUTBOUND side
f. Hit Enter
g. Dashboard will refresh in the browser
h. Make sure you enable all channels that are valuable outbound routes for you to ensure they are not used for filling up routes you have targeted (you can enable and target 100% in order to avoid any action on this channel from the rebalancer)

2. Update Global Settings
a. Go to section Update Auto Rebalancer Settings
b. Select the global settings (sample below):
c. Click OK button to submit
1. Update Channel Specific Settings
a. Go to Active Channels section
b. Find the channels you would like to activate for rebalancing (this refills its outbound)
c. On far right column Click the Enable button to activate rebalancing
d. The dashboard will refresh and show AR-Target 100%
e. Adjust the AR-Target to desired % of liquidity you want to keep on remote INBOUND side. Example select 0.60 if you want 60% of the channel capacity on Remote/INBOUND side which would mean that there is 40% on Local/OUTBOUND side
f. Hit Enter
g. Dashboard will refresh in the browser
h. Make sure you enable all channels that are valuable outbound routes for you to ensure they are not used for filling up routes you have targeted (you can enable and target 100% in order to avoid any action on this channel from the rebalancer)

2. Update Global Settings
a. Go to section Update Auto Rebalancer Settings
b. Select the global settings (sample below):
c. Click OK button to submit
d. Once enabled is set to 1 in the global settings - the rebalancer will become active
```
Enabled: 1
Expand All @@ -248,9 +248,9 @@ Additional customization options:
Global Max Fee Rate (ppm): 500
Max Cost (%): 0.6
```
3. Go to section Last 10 Rebalance Requests - that will show the list of the rebalancing queue and status.
3. Go to section Last 10 Rebalance Requests - that will show the list of the rebalancing queue and status.

If you want a channel not to be picked for rebalancing (i.e. it is already full with OUTBOUND capacity that you desire), enable the channel and set the AR-Target% to 100. The rebalancer will ignore the channel while selecting the channels for outbound candidates and since its INBOUND can never be above 100% it will never trigger a rebalance.
If you want a channel not to be picked for rebalancing (i.e. it is already full with OUTBOUND capacity that you desire), enable the channel and set the AR-Target% to 100. The rebalancer will ignore the channel while selecting the channels for outbound candidates and since its INBOUND can never be above 100% it will never trigger a rebalance.

## Preview Screens
### Main Dashboard
Expand Down Expand Up @@ -283,4 +283,3 @@ If you want a channel not to be picked for rebalancing (i.e. it is already full

### View Keysend Messages (you can only receive these if you have `accept-keysend=true` in lnd.conf)
![image](https://user-images.githubusercontent.com/38626122/134045287-086d56e3-5959-4f5f-a06e-cb6d2ac4957c.png)

31 changes: 31 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3-slim

ARG LNDG_PORT=8000
ARG SUPERVISOR=1
ENV PYTHONUNBUFFERED 1

# Add group abnd user to run rootless
RUN addgroup -gid 1000 lndg && \
useradd -r -m -s /bin/bash -g lndg -u 1000 lndg

WORKDIR /lndg

COPY . .

ENV LNDG_PORT=$LNDG_PORT
ENV LNDG_SUPERVISOR=$SUPERVISOR

RUN echo "Install pip deps" && \
pip install --upgrade pip && \
pip install -r requirements.txt && \
pip install whitenoise

RUN scripts/suinit.sh

EXPOSE $LNDG_PORT

VOLUME [ "/lnd", "/lndg/data" ]

USER 1000

ENTRYPOINT [ "scripts/entrypoint.sh" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions systemd.md → doc/systemd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- **This assumes you have installed lndg on the home directory of the user. For example, user `mynode` will have a home directory of `/home/mynode/`.**

## Backend Controller Setup
Create a service file for `controller.py`, copying the contents below to the file and filling in the user you would like this to run under.
Create a service file for `controller.py`, copying the contents below to the file and filling in the user you would like this to run under.
`nano /etc/systemd/system/lndg-controller.service`
```
[Unit]
Expand All @@ -21,12 +21,12 @@ RestartSec=60s
[Install]
WantedBy=multi-user.target
```
Enable and start the service to run the backend controller.
`sudo systemctl enable lndg-controller.service`
Enable and start the service to run the backend controller.
`sudo systemctl enable lndg-controller.service`
`sudo systemctl start lndg-controller.service`

## Additional Commands
You can also check on the status, disable or stop the backend controller.
`sudo systemctl status lndg-controller.service`
`sudo systemctl disable lndg-controller.service`
`sudo systemctl stop lndg-controller.service`
You can also check on the status, disable or stop the backend controller.
`sudo systemctl status lndg-controller.service`
`sudo systemctl disable lndg-controller.service`
`sudo systemctl stop lndg-controller.service`
2 changes: 1 addition & 1 deletion gui/templates/action_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ <h2>Suggested Action List</h2>
<center><h1>Nothing to see here! Great job!</h1></center>
</div>
{% endif %}
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion gui/templates/addresses.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ <h2>{% if addresses.address_type == 1 %}Legacy{% elif addresses.address_type ==
<center><h1>You dont have any addresses yet.</h1></center>
</div>
{% endif %}
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion gui/templates/advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,4 @@ <h2>Advanced Channel Settings</h2>
}
})
</script>
{% endblock %}
{% endblock %}
8 changes: 4 additions & 4 deletions gui/templates/channel.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ <h3><a href="{{ graph_links }}/{{ network }}node/{{ channel.remote_pubkey }}" ta
<small class="w3-round w3-border-small w3-border-grey">{{ chan_id }}</small> <small class="w3-round w3-border-small w3-border-grey">{{ channel.short_chan_id }}</small>
</h3>
<span style="padding:1.5px 8px" title="{%if channel.private %}🕶️ Private{%else%}🌐 Public{%endif%} {% if channel.is_active and peer_info.connected %}Connected{%elif not channel.is_open %}Closed{% else %}Disconnected/Inactive{% endif %} Channel" class="w3-round w3-border w3-border-{% if channel.is_active and peer_info.connected %}green{%elif not channel.is_open %}gray{% else %}red{% endif %}">
{% if peer_info %}📍{{ peer_info.address }} |
Channel Updates: {{ channel.num_updates|intcomma }} |
{% if peer_info %}📍{{ peer_info.address }} |
Channel Updates: {{ channel.num_updates|intcomma }} |
{% if not channel.is_open %}❌ Closed:{% elif channel.is_active %}Uptime:{% else %}Downtime:{% endif %} {{ channel.last_update|naturaltime|slice:":-4" }} <small class="w3-round w3-border-small w3-border-grey">since {{ channel.last_update }}</small></h6>{% endif %} {%if channel.private %}🕶️{%else%}🌐{%endif%}
</span>
<div style="padding-top:5px"/>
<span style="padding:1.5px 8px;" class="w3-round w3-border w3-border-gray">
⛓️ Channel Point: <a href="{{ network_links }}/{{ network }}tx/{{ channel.funding_txid }}" target="_blank">{{ channel.funding_txid }}:{{ channel.output_index }}</a> |
Opened In: <a href="{{ network_links }}/{{ network }}block/{{ channel.open_block }}" target="_blank">{{ channel.open_block|intcomma }}</a> |
Opened In: <a href="{{ network_links }}/{{ network }}block/{{ channel.open_block }}" target="_blank">{{ channel.open_block|intcomma }}</a> |
Opener: {% if channel.initiator == True %}Local{% else %}Remote{% endif %}
</span>
</div>
Expand Down Expand Up @@ -570,7 +570,7 @@ <h2>Channel Notes</h2>
let next_failed_htlcs = (await failedhtlcs_task).results
if(next_failed_htlcs.length<5){
byId("loadMoreFailedHTLCs").style.display = "none"
}
}
if(next_failed_htlcs.length==0){
return
}
Expand Down
2 changes: 1 addition & 1 deletion gui/templates/channels.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ <h2>Channel Performance</h2>
<center><h1>You dont have any channels to analyze yet!</h1></center>
</div>
{% endif %}
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion gui/templates/fee_rates.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ <h2>Suggested Fee Rates</h2>
{% if local_settings %}
{% include 'local_settings.html' with settings=local_settings title='Auto-Fees' postURL='update_setting' %}
{% endif %}
{% endblock %}
{% endblock %}
Loading