Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adlernscs50/1fd8d780ff2467bdfdd2c22d2ffaac33 to your computer and use it in GitHub Desktop.
Save adlernscs50/1fd8d780ff2467bdfdd2c22d2ffaac33 to your computer and use it in GitHub Desktop.
My charge-lnd setup with Lightning Shell in Umbrel

I've tested this script and workflow on Umbrel, and it works. See resource/credit at the end.

1. SSH to Umbrel

ssh -t umbrel@umbrel.local, and login with your password

2. Create config/policy file

Read more about charge-lnd here.

First step is to create charge-lnd config/policy file charge-lnd.config, and put it in /mnt/data/umbrel/app-data/lightning-shell/data Type: sudo nano /mnt/data/umbrel/app-data/lightning-shell/data/charge-lnd.config (retype your password if asked on prompt) here's my config file for example

3. Make sure the config file works

On Umbrel, open Lightning Shell (install it first via Umbrel app store).
To check whether the syntax on your policy is valid, type: charge-lnd --config /data/charge-lnd.config --check if it return Configuration file is valid, your config file is ready to go.

additional step is to run --dry-run to test the policy without applying it, type: charge-lnd --config /data/charge-lnd.config --dry-run if it works, it will return one of your channels that adjusted based on your policy/config file.

4. Schedule it to automate using crontab

type cd ~, then crontab -e to create new cron file. In the editor, type: 0 * * * * (docker exec -u lnshell -w /home/lnshell lightning-shell_web_1 /home/lnshell/.local/bin/charge-lnd --config /data/charge-lnd.config) 2>&1 | logger -t charge-lnd to set it trigger every hour. Change the interval based on your need, learn more https://crontab.guru/

exit the editor by type ctrl + x, save it, and it will starts triggering every hour from now on.

5. Check the syslog, make sure it works

type: cd /var/log and then nano syslog. It will open nano editor, scroll down to recent log. If it works, you can see log item with title charge-lnd on it.

Known issue

If you get a permission issue on this step ("Permission denied while trying to connect to the Docker daemon socket"), try sudo usermod -aG docker <your_username> Disconnect the session and connect again.


Forked from https://gist.github.com/rizalrenaldi/42331f5666bf6471be63072f7e2388c0 with plus https://stackoverflow.com/questions/46202475/permission-denied-while-trying-to-connect-to-the-docker-daemon-socket combined snippets from these resources:
https://community.getumbrel.com/t/guide-installing-charge-lnd-in-a-docker-to-automate-your-fee-policies/2187
https://gist.github.com/msimion/e756bbe95426a91d7a0aa9912c7d0619
https://community.getumbrel.com/t/running-charge-lnd-with-cron-from-lnshell/6207/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment