robclark56 / RaspiBolt-Extras

More Ways to Use The RaspiBolt
MIT License
21 stars 8 forks source link

Raspibolt without upnp #11

Open giulnz opened 5 years ago

giulnz commented 5 years ago

Hi, thanks for your guides, In the new version of public ip script "RB_extra_02.md" , is it not necessary create corresponding systemd unit ?? see below

$ sudo nano /etc/systemd/system/getpublicip.service

RaspiBolt LND Mainnet: systemd unit for getpublicip.sh script

/etc/systemd/system/getpublicip.service

[Unit] Description=getpublicip.sh: get public ip address from ipinfo.io After=network.target

[Service] User=root Group=root Type=simple ExecStart=/usr/local/bin/getpublicip.sh ExecStartPost=/bin/sleep 5 Restart=always

RestartSec=600 TimeoutSec=10

[Install] WantedBy=multi-user.target enable systemd startup $ sudo systemctl enable getpublicip $ sudo systemctl start getpublicip $ sudo systemctl status getpublicip

Also is it not necessary to change this line in /etc/systemd/system/lnd.service ?

[Service]

get var PUBIP from file

EnvironmentFile=/run/publicip

ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP} PIDFile=/home/bitcoin/.lnd/lnd.pid

robclark56 commented 5 years ago

guilnz: LND v0.4.2: No. With the original lnd V0.4.2 Stadicus guides, he had the /usr/local/bin/getpublicip.sh script running every 10 mins. My script would notice that the IP address had changed, and restart lnd. No need to add your new systemd service in this case

LNV v0.5.x: Hmmm ... Stadicus uses the new feature in V0.5 where lnd queries the local (uPnP enabled) router and lnd itself manages the advertising of external IP. If you are running V0.5.2 with a router that does not support uPnP, then it is quite possible your new systemd service (or a cron job) is needed.

As mentioned in my extra "There is discussion among the lnd developers about adding a new lncli command to update the --externalip parameter without restarting lnd - which locks the wallet. Until that is implemented, the solution presented here is a stop-gap solution." That discussion concluded in lnd V0.5 being able to manage all this itself.

BTW ... I am on V0.5.2 so no longer use /usr/local/bin/getpublicip.sh at all

Hope that helps.

giulnz commented 5 years ago

Hi , yes i have LND 0.5.2 and router without Upnp. You right, your script need to run only at start .

Brief for people with same issue: -same installation as Stadicus guide -comment/delete nat=true line from lnd.conf -add getpublicip script -make it executable -add getpublicip to cron (without RestartSec=600 TimeoutSec=10) -add this 3 lines to lnd.service

EnvironmentFile=/run/publicip ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP} PIDFile=/home/bitcoin/.lnd/lnd.pid

I don't understand if "lnd" takes $PUBLICIP from "getpublicip" without this 3 lines. Anyway like that it works so fine for me.

Thanks for your help.