enable tor for cln and lnbits

This commit is contained in:
Riccardo Balbo 2024-10-26 11:36:03 +02:00
parent 33c4314212
commit 4fb873b105
5 changed files with 69 additions and 3 deletions

View File

@ -471,7 +471,11 @@ services:
healthcheck:
<<: *healthcheck
test: ["CMD-SHELL", "su clightning -c 'lightning-cli --network=regtest getinfo'"]
depends_on: *depends_on_bitcoin
depends_on:
tor:
condition: service_healthy
restart: true
<<: *depends_on_bitcoin
env_file: *env_file
command:
- 'lightningd'
@ -490,6 +494,7 @@ services:
- "${STACKER_CLN_REST_PORT}:3010"
volumes:
- stacker_cln:/home/clightning/.lightning
- tordata:/home/clightning/.tor
labels:
ofelia.enabled: "true"
ofelia.job-exec.stacker_cln_channel_cron.schedule: "@every 1m"
@ -614,7 +619,12 @@ services:
ports:
- "${LNBITS_WEB_PORT}:5000"
depends_on:
- stacker_lnd
tor:
condition: service_healthy
restart: true
stacker_lnd:
condition: service_healthy
restart: true
environment:
- LNBITS_ADMIN_UI=true
- LNBITS_BACKEND_WALLET_CLASS=LndWallet
@ -624,6 +634,7 @@ services:
- LND_GRPC_MACAROON=/app/.lnd/regtest/admin.macaroon
volumes:
- ./docker/lnd/stacker:/app/.lnd
- tordata:/app/.tor
labels:
CONNECT: "localhost:${LNBITS_WEB_PORT}"
cpu_shares: "${CPU_SHARES_LOW}"

View File

@ -1 +1,3 @@
HiddenServicePort 10009 stacker_lnd:10009
HiddenServicePort 10009 stacker_lnd:10009
HiddenServicePort 3010 stacker_cln:3010
HiddenServicePort 5000 lnbits:5000

36
sndev
View File

@ -56,12 +56,19 @@ docker__stacker_lnd() {
docker__stacker_cln() {
t=$1
if [ "$t" = "-t" ]; then
shift
else
t=""
fi
if [ "$1" = "get_onion" ]; then
onion="$(docker__exec -t stacker_cln cat /home/clightning/.tor/hidden_service/hostname | tr -d '[:space:]')"
echo "$onion:3010"
exit 0
fi
docker__exec $t -u clightning stacker_cln lightning-cli --regtest "$@"
}
@ -414,6 +421,9 @@ sndev__stacker_clncli() {
sndev__help_stacker_clncli() {
docker__stacker_cln help
echo
echo "EXTRA:"
echo " get_onion get the onion address"
}
sndev__stacker_litcli() {
@ -551,6 +561,29 @@ sndev__stacker_lnd() {
fi
}
sndev__help_lnbits() {
help="
USAGE
$ sndev stacker_lnbits get_onion get the onion address
"
}
sndev__lnbits() {
shift
if [ -z "$1" ]; then
echo "no command provided"
sndev__help_lnbits
exit 1
fi
if [ "$1" = "get_onion" ];
then
onion="$(docker__exec -t lnbits cat /app/.tor/hidden_service/hostname | tr -d '[:space:]')"
echo "$onion:5000"
fi
}
sndev__help_tor() {
help="
@ -637,6 +670,9 @@ COMMANDS
stacker_litcli litcli passthrough on litd
tor get_onion get the onion address
stacker_lnd get_cert get the tls cert
stacker_lnd get_onion get the onion address
stacker_cln get_onion get the onion address
lndbits get_onion get the onion address
"
echo "$help"
}

View File

@ -4,6 +4,14 @@ For testing cln as an attached receiving wallet, you'll need a rune and the cert
`stacker_cln:3010`
# host and port (onion)
Run:
```bash
sndev stacker_clncli get_onion
```
# create rune
```bash

View File

@ -22,3 +22,12 @@ Or simply copy the keys from here:
( These keys can be found under `Node URL, API keys and API docs`. )
To use the same URL to connect to LNbits in the browser and server during local development, `localhost:<port>` is mapped to `lnbits:5000` on the server.
# tor onion url
Run the following command to get the onion url:
```bash
sndev lnbits get_onion
```