From f6389c0541a161ef60c1bef6717d4d2b85316d64 Mon Sep 17 00:00:00 2001 From: fusion44 Date: Sun, 11 Dec 2022 19:23:22 +0100 Subject: [PATCH] feat: add support for more lightning nodes --- Dockerfile.regtest | 3 + docker/regtest/.env.cln1 | 2 +- docker/regtest/.env.cln2 | 131 +++++++++++++++++++++++++++++++++++ docker/regtest/.env.lnd2 | 131 +++++++++++++++++++++++++++++++++++ docker/regtest/.env.lnd3 | 131 +++++++++++++++++++++++++++++++++++ docker/regtest/entrypoint.sh | 10 ++- 6 files changed, 406 insertions(+), 2 deletions(-) create mode 100644 docker/regtest/.env.cln2 create mode 100644 docker/regtest/.env.lnd2 create mode 100644 docker/regtest/.env.lnd3 diff --git a/Dockerfile.regtest b/Dockerfile.regtest index a3c71e5..844783d 100644 --- a/Dockerfile.regtest +++ b/Dockerfile.regtest @@ -14,7 +14,10 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt COPY ./app /code/app COPY ./docker/regtest/.env.cln1 /code/.env.cln1 +COPY ./docker/regtest/.env.cln1 /code/.env.cln2 COPY ./docker/regtest/.env.lnd1 /code/.env.lnd1 +COPY ./docker/regtest/.env.lnd1 /code/.env.lnd2 +COPY ./docker/regtest/.env.lnd1 /code/.env.lnd3 COPY ./docker/regtest/entrypoint.sh /code/entrypoint.sh diff --git a/docker/regtest/.env.cln1 b/docker/regtest/.env.cln1 index abc953b..57b6bfc 100644 --- a/docker/regtest/.env.cln1 +++ b/docker/regtest/.env.cln1 @@ -53,7 +53,7 @@ shell_script_path = /root # Redis - uncomment if Redis runs with non standard values (i.e. in Docker etc) redis_host=redis redis_port=6379 -redis_db=1 +redis_db=3 # leave commented if no password is used # redis_password=my_password diff --git a/docker/regtest/.env.cln2 b/docker/regtest/.env.cln2 new file mode 100644 index 0000000..5251f73 --- /dev/null +++ b/docker/regtest/.env.cln2 @@ -0,0 +1,131 @@ +secret=please_please_update_me_please +algorithm=HS256 +# expiry time in milliseconds (3600000 = 1 hour) +jwt_expiry_time=999999999 + +# login password +login_password=12345678 + +# Enable this if you want to run blitz_gui locally. +# This will create a file called ~/blitz_api/.cookie with a +# JWT token. +enable_local_cookie_auth = true + +# Platform tells the backend on what kind of system it is running on. +# Different platforms might use different data sources and might yield +# different kinds of data. E.g.: If set to "raspiblitz",then hardware +# information will be fetched from Redis instead of the native python implementation. +# In case of native_python set other optional config vars np_* further below. +# supported values: [raspiblitz, native_python] +platform=native_python + +# Amount of seconds the app will wait until it'll +# send another hardware update +# only applies when platform=native_python +gather_hw_info_interval = 60 + +# Amount of seconds the app will gather CPU usage data for each update +# The resulting CPU usage is averaged over this period of time. +# To get realistic results at least 0.1 seconds is recommended +# must be less than and not equal to gather_hw_info_interval +# only applies when platform=native_python +cpu_usage_averaging_period = 0.5 + +# Poll interval in seconds to gather lightning information and push it via SSE +# only applies when platform=native_python +gather_ln_info_interval = 5.0 + +# Path to the shell script root folder +shell_script_path = /root + +# The API can push successfull forwards to SSE client. On big nodes +# this can cause lots of traffic. Turn this on if updates are required. +# default: false +# sse_notify_forward_successes=false + +# If set to 0 all forward event will be sent instantly, otherwise they'll +# be gathered and sent as an array of notifications. +# This also affects how often the wallet balance is updated (even if sse_notify_forward_successes is false) +# default: 2.0 seconds +# minimum: 0.3 seconds +# forwards_gather_interval=2 + +# Redis - uncomment if Redis runs with non standard values (i.e. in Docker etc) +redis_host=redis +redis_port=6379 +redis_db=4 +# leave commented if no password is used +# redis_password=my_password + +# mainnet, testnet or regtest +network=regtest +bitcoind_ip_mainnet=bitcoind +bitcoind_ip_testnet=bitcoind +bitcoind_ip_regtest=bitcoind +bitcoind_port_rpc_mainnet=18443 +bitcoind_port_rpc_testnet=18443 +bitcoind_port_rpc_regtest=18443 + + +# The API can either hashblock OR rawblock to be notified of new blocks. +# Hashblock is a bit faster, so it should be used if possible. +bitcoind_zmq_block_rpc="rawblock" +bitcoind_zmq_block_port_mainnet=29001 +bitcoind_zmq_block_port_testnet=29001 +bitcoind_zmq_block_port_regtest=29001 +bitcoind_user=lnbits +bitcoind_pw=lnbits + +# lnd_grpc, cln_grpc, none +# Please refer to the documentation for the install procedure +# for each implementation. +ln_node=cln_grpc +# LND macaroon in HEX format, or a path to the .macaroon file +lnd_macaroon="/root/data/lnd-1/data/chain/bitcoin/regtest/admin.macaroon" +# LND certificate in HEX format, or a path to the tls.cert file +lnd_cert="/root/data/lnd-1/tls.cert" + +lnd_grpc_ip=lnd-1 +lnd_grpc_port=10009 +lnd_rest_port=8081 + +# cln grpc connection data, cert files are in .lightning data folder +# xxd -p -c2000 client.pem +cln_grpc_cert="/root/data/clightning-2/regtest/client.pem" +# xxd -p -c2000 client-key.pem +cln_grpc_key="/root/data/clightning-2/regtest/client-key.pem" +# xxd -p -c2000 ca.pem +cln_grpc_ca="/root/data/clightning-2/regtest/ca.pem" +cln_grpc_ip=clightning-2 +cln_grpc_port=11109 + +# Tor url of this system. Ignored on platform Raspiblitz. +# Defaults to empty string +# np_tor_address="" + +# Tor url of api endpoint. Ignored on platform Raspiblitz +# Defaults to empty string +# np_tor_address_api_endpoint="address.onion/api" + +# Tor url of the api docs. Ignored on platform Raspiblitz +# Defaults to empty string +# np_tor_address_api_docs="address.onion/latest/docs" + +# Local LAN IP. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_ip="192.168.1.50" + +# Local LAN url of api endpoint. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_address_api_endpoint="address.onion/api" + +# Local LAN of the api docs. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_address_api_docs="address.onion/latest/docs" + +# SSH login address. Ignored on platform Raspiblitz +# Defaults to empty string +# np_ssh_address="username@192.168.1.50" + +# Version of the platform. Ignored on platform Raspiblitz +# np_version="v0.5.0beta" diff --git a/docker/regtest/.env.lnd2 b/docker/regtest/.env.lnd2 new file mode 100644 index 0000000..4893fd1 --- /dev/null +++ b/docker/regtest/.env.lnd2 @@ -0,0 +1,131 @@ +secret=please_please_update_me_please +algorithm=HS256 +# expiry time in milliseconds (3600000 = 1 hour) +jwt_expiry_time=999999999 + +# login password +login_password=12345678 + +# Enable this if you want to run blitz_gui locally. +# This will create a file called ~/blitz_api/.cookie with a +# JWT token. +enable_local_cookie_auth = true + +# Platform tells the backend on what kind of system it is running on. +# Different platforms might use different data sources and might yield +# different kinds of data. E.g.: If set to "raspiblitz",then hardware +# information will be fetched from Redis instead of the native python implementation. +# In case of native_python set other optional config vars np_* further below. +# supported values: [raspiblitz, native_python] +platform=native_python + +# Amount of seconds the app will wait until it'll +# send another hardware update +# only applies when platform=native_python +gather_hw_info_interval = 60 + +# Amount of seconds the app will gather CPU usage data for each update +# The resulting CPU usage is averaged over this period of time. +# To get realistic results at least 0.1 seconds is recommended +# must be less than and not equal to gather_hw_info_interval +# only applies when platform=native_python +cpu_usage_averaging_period = 0.5 + +# Poll interval in seconds to gather lightning information and push it via SSE +# only applies when platform=native_python +gather_ln_info_interval = 5.0 + +# Path to the shell script root folder +shell_script_path = /root + +# The API can push successfull forwards to SSE client. On big nodes +# this can cause lots of traffic. Turn this on if updates are required. +# default: false +# sse_notify_forward_successes=false + +# If set to 0 all forward event will be sent instantly, otherwise they'll +# be gathered and sent as an array of notifications. +# This also affects how often the wallet balance is updated (even if sse_notify_forward_successes is false) +# default: 2.0 seconds +# minimum: 0.3 seconds +# forwards_gather_interval=2 + +# Redis - uncomment if Redis runs with non standard values (i.e. in Docker etc) +redis_host=redis +redis_port=6379 +redis_db=1 +# leave commented if no password is used +# redis_password=my_password + +# mainnet, testnet or regtest +network=regtest +bitcoind_ip_mainnet=bitcoind +bitcoind_ip_testnet=bitcoind +bitcoind_ip_regtest=bitcoind +bitcoind_port_rpc_mainnet=18443 +bitcoind_port_rpc_testnet=18443 +bitcoind_port_rpc_regtest=18443 + + +# The API can either hashblock OR rawblock to be notified of new blocks. +# Hashblock is a bit faster, so it should be used if possible. +bitcoind_zmq_block_rpc="rawblock" +bitcoind_zmq_block_port_mainnet=29001 +bitcoind_zmq_block_port_testnet=29001 +bitcoind_zmq_block_port_regtest=29001 +bitcoind_user=lnbits +bitcoind_pw=lnbits + +# lnd_grpc, cln_grpc, none +# Please refer to the documentation for the install procedure +# for each implementation. +ln_node=lnd_grpc +# LND macaroon in HEX format, or a path to the .macaroon file +lnd_macaroon="/root/data/lnd-2/data/chain/bitcoin/regtest/admin.macaroon" +# LND certificate in HEX format, or a path to the tls.cert file +lnd_cert="/root/data/lnd-2/tls.cert" + +lnd_grpc_ip=lnd-2 +lnd_grpc_port=10009 +lnd_rest_port=8081 + +# cln grpc connection data, cert files are in .lightning data folder +# xxd -p -c2000 client.pem +cln_grpc_cert="/root/data/clightning-1/regtest/client.pem" +# xxd -p -c2000 client-key.pem +cln_grpc_key="/root/data/clightning-1/regtest/client.pem" +# xxd -p -c2000 ca.pem +cln_grpc_ca="/root/data/clightning-1/regtest/client.pem" +cln_grpc_ip=127.0.0.1 +cln_grpc_port=9537 + +# Tor url of this system. Ignored on platform Raspiblitz. +# Defaults to empty string +# np_tor_address="" + +# Tor url of api endpoint. Ignored on platform Raspiblitz +# Defaults to empty string +# np_tor_address_api_endpoint="address.onion/api" + +# Tor url of the api docs. Ignored on platform Raspiblitz +# Defaults to empty string +# np_tor_address_api_docs="address.onion/latest/docs" + +# Local LAN IP. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_ip="192.168.1.50" + +# Local LAN url of api endpoint. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_address_api_endpoint="address.onion/api" + +# Local LAN of the api docs. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_address_api_docs="address.onion/latest/docs" + +# SSH login address. Ignored on platform Raspiblitz +# Defaults to empty string +# np_ssh_address="username@192.168.1.50" + +# Version of the platform. Ignored on platform Raspiblitz +# np_version="v0.5.0beta" diff --git a/docker/regtest/.env.lnd3 b/docker/regtest/.env.lnd3 new file mode 100644 index 0000000..039861a --- /dev/null +++ b/docker/regtest/.env.lnd3 @@ -0,0 +1,131 @@ +secret=please_please_update_me_please +algorithm=HS256 +# expiry time in milliseconds (3600000 = 1 hour) +jwt_expiry_time=999999999 + +# login password +login_password=12345678 + +# Enable this if you want to run blitz_gui locally. +# This will create a file called ~/blitz_api/.cookie with a +# JWT token. +enable_local_cookie_auth = true + +# Platform tells the backend on what kind of system it is running on. +# Different platforms might use different data sources and might yield +# different kinds of data. E.g.: If set to "raspiblitz",then hardware +# information will be fetched from Redis instead of the native python implementation. +# In case of native_python set other optional config vars np_* further below. +# supported values: [raspiblitz, native_python] +platform=native_python + +# Amount of seconds the app will wait until it'll +# send another hardware update +# only applies when platform=native_python +gather_hw_info_interval = 60 + +# Amount of seconds the app will gather CPU usage data for each update +# The resulting CPU usage is averaged over this period of time. +# To get realistic results at least 0.1 seconds is recommended +# must be less than and not equal to gather_hw_info_interval +# only applies when platform=native_python +cpu_usage_averaging_period = 0.5 + +# Poll interval in seconds to gather lightning information and push it via SSE +# only applies when platform=native_python +gather_ln_info_interval = 5.0 + +# Path to the shell script root folder +shell_script_path = /root + +# The API can push successfull forwards to SSE client. On big nodes +# this can cause lots of traffic. Turn this on if updates are required. +# default: false +# sse_notify_forward_successes=false + +# If set to 0 all forward event will be sent instantly, otherwise they'll +# be gathered and sent as an array of notifications. +# This also affects how often the wallet balance is updated (even if sse_notify_forward_successes is false) +# default: 2.0 seconds +# minimum: 0.3 seconds +# forwards_gather_interval=2 + +# Redis - uncomment if Redis runs with non standard values (i.e. in Docker etc) +redis_host=redis +redis_port=6379 +redis_db=2 +# leave commented if no password is used +# redis_password=my_password + +# mainnet, testnet or regtest +network=regtest +bitcoind_ip_mainnet=bitcoind +bitcoind_ip_testnet=bitcoind +bitcoind_ip_regtest=bitcoind +bitcoind_port_rpc_mainnet=18443 +bitcoind_port_rpc_testnet=18443 +bitcoind_port_rpc_regtest=18443 + + +# The API can either hashblock OR rawblock to be notified of new blocks. +# Hashblock is a bit faster, so it should be used if possible. +bitcoind_zmq_block_rpc="rawblock" +bitcoind_zmq_block_port_mainnet=29001 +bitcoind_zmq_block_port_testnet=29001 +bitcoind_zmq_block_port_regtest=29001 +bitcoind_user=lnbits +bitcoind_pw=lnbits + +# lnd_grpc, cln_grpc, none +# Please refer to the documentation for the install procedure +# for each implementation. +ln_node=lnd_grpc +# LND macaroon in HEX format, or a path to the .macaroon file +lnd_macaroon="/root/data/lnd-3/data/chain/bitcoin/regtest/admin.macaroon" +# LND certificate in HEX format, or a path to the tls.cert file +lnd_cert="/root/data/lnd-3/tls.cert" + +lnd_grpc_ip=lnd-2 +lnd_grpc_port=10009 +lnd_rest_port=8081 + +# cln grpc connection data, cert files are in .lightning data folder +# xxd -p -c2000 client.pem +cln_grpc_cert="/root/data/clightning-1/regtest/client.pem" +# xxd -p -c2000 client-key.pem +cln_grpc_key="/root/data/clightning-1/regtest/client.pem" +# xxd -p -c2000 ca.pem +cln_grpc_ca="/root/data/clightning-1/regtest/client.pem" +cln_grpc_ip=127.0.0.1 +cln_grpc_port=9537 + +# Tor url of this system. Ignored on platform Raspiblitz. +# Defaults to empty string +# np_tor_address="" + +# Tor url of api endpoint. Ignored on platform Raspiblitz +# Defaults to empty string +# np_tor_address_api_endpoint="address.onion/api" + +# Tor url of the api docs. Ignored on platform Raspiblitz +# Defaults to empty string +# np_tor_address_api_docs="address.onion/latest/docs" + +# Local LAN IP. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_ip="192.168.1.50" + +# Local LAN url of api endpoint. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_address_api_endpoint="address.onion/api" + +# Local LAN of the api docs. Ignored on platform Raspiblitz +# Defaults to empty string +# np_local_address_api_docs="address.onion/latest/docs" + +# SSH login address. Ignored on platform Raspiblitz +# Defaults to empty string +# np_ssh_address="username@192.168.1.50" + +# Version of the platform. Ignored on platform Raspiblitz +# np_version="v0.5.0beta" diff --git a/docker/regtest/entrypoint.sh b/docker/regtest/entrypoint.sh index 94ab235..0ba72b7 100644 --- a/docker/regtest/entrypoint.sh +++ b/docker/regtest/entrypoint.sh @@ -3,8 +3,16 @@ if [ "$LN_BACKEND" = "cln-1" ]; then cp /code/.env.cln1 /code/.env -else +elif [ "$LN_BACKEND" = "cln-2" ]; then + cp /code/.env.cln2 /code/.env +elif [ "$LN_BACKEND" = "lnd-1" ]; then cp /code/.env.lnd1 /code/.env +elif [ "$LN_BACKEND" = "lnd-2" ]; then + cp /code/.env.lnd2 /code/.env +elif [ "$LN_BACKEND" = "lnd-3" ]; then + cp /code/.env.lnd3 /code/.env +else + echo "Unknown LN_BACKEND: $LN_BACKEND" fi # wait until the nodes are ready