diff --git a/docker-compose.yml b/docker-compose.yml index 17b7a16b..8c993b0b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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}" diff --git a/docker/tor/services.conf b/docker/tor/services.conf index 528cba2e..6da6d0da 100644 --- a/docker/tor/services.conf +++ b/docker/tor/services.conf @@ -1 +1,3 @@ -HiddenServicePort 10009 stacker_lnd:10009 \ No newline at end of file +HiddenServicePort 10009 stacker_lnd:10009 +HiddenServicePort 3010 stacker_cln:3010 +HiddenServicePort 5000 lnbits:5000 diff --git a/sndev b/sndev index 6b527a5c..c294c76a 100755 --- a/sndev +++ b/sndev @@ -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" } diff --git a/wallets/cln/ATTACH.md b/wallets/cln/ATTACH.md index 6d282628..4093f1b4 100644 --- a/wallets/cln/ATTACH.md +++ b/wallets/cln/ATTACH.md @@ -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 diff --git a/wallets/lnbits/ATTACH.md b/wallets/lnbits/ATTACH.md index baafa1bf..aced9a41 100644 --- a/wallets/lnbits/ATTACH.md +++ b/wallets/lnbits/ATTACH.md @@ -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:` 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 +``` \ No newline at end of file