From 9cb9062ce871ff05cd6bc92d8e0131df0e435165 Mon Sep 17 00:00:00 2001 From: Lakshya Singh Date: Tue, 31 Oct 2023 20:57:04 +0530 Subject: [PATCH] lightning: remote_hsmd_socket & remove env files - build vls and copy binary in final layer - update configs - add vls port, network, rust log and rpc url in env - compose: set env variable in compose only - dont separate env files, ease of access on env vars with compose - common across networks set in dockerfile Signed-off-by: Lakshya Singh --- assets/regtest-config | 3 ++- assets/regtest-env | 4 ---- assets/testnet-config | 3 ++- assets/testnet-env | 4 ---- docker-compose.regtest.yml | 4 ++-- docker-compose.yml | 8 ++++++-- lightningd/Dockerfile | 15 +++++++++++++++ 7 files changed, 27 insertions(+), 14 deletions(-) delete mode 100644 assets/regtest-env delete mode 100644 assets/testnet-env diff --git a/assets/regtest-config b/assets/regtest-config index cbe65d8..c471792 100644 --- a/assets/regtest-config +++ b/assets/regtest-config @@ -7,4 +7,5 @@ max-locktime-blocks=288 important-plugin=/usr/bin/clboss clboss-auto-close=true bind-addr=0.0.0.0:19846 -plugin=/usr/local/src/plugins/summary/summary.py \ No newline at end of file +plugin=/usr/local/src/plugins/summary/summary.py +subdaemon=hsmd:remote_hsmd_socket \ No newline at end of file diff --git a/assets/regtest-env b/assets/regtest-env deleted file mode 100644 index a21ee38..0000000 --- a/assets/regtest-env +++ /dev/null @@ -1,4 +0,0 @@ -VLS_PORT=17701 -VLS_NETWORK=regtest -BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:38332 -RUST_LOG=info \ No newline at end of file diff --git a/assets/testnet-config b/assets/testnet-config index 274338b..2d6abd3 100644 --- a/assets/testnet-config +++ b/assets/testnet-config @@ -7,4 +7,5 @@ max-locktime-blocks=288 important-plugin=/usr/bin/clboss clboss-auto-close=true bind-addr=0.0.0.0:19735 -plugin=/usr/local/src/plugins/summary/summary.py \ No newline at end of file +plugin=/usr/local/src/plugins/summary/summary.py +subdaemon=hsmd:remote_hsmd_socket \ No newline at end of file diff --git a/assets/testnet-env b/assets/testnet-env deleted file mode 100644 index b0e54aa..0000000 --- a/assets/testnet-env +++ /dev/null @@ -1,4 +0,0 @@ -VLS_PORT=17701 -VLS_NETWORK=testnet -BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332 -RUST_LOG=info diff --git a/docker-compose.regtest.yml b/docker-compose.regtest.yml index d1d2a34..c40b408 100644 --- a/docker-compose.regtest.yml +++ b/docker-compose.regtest.yml @@ -18,10 +18,10 @@ services: - 19846 ports: - 19846:19846 - env_file: - - ./assets/regtest-env environment: - BITCOIN_CHAIN=regtest + - VLS_NETWORK=regtest + - BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:38332 txoo: container_name: txoo-regtest diff --git a/docker-compose.yml b/docker-compose.yml index daf88e2..de19964 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,15 +30,19 @@ services: - clightning:/home/lightning/.lightning expose: - 19735 + - 7701 networks: - LN_testing depends_on: bitcoin-core: condition: service_healthy - env_file: - - ./assets/testnet-env environment: - BITCOIN_CHAIN=test + - BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332 + - RUST_LOG=info + - VLS_NETWORK=testnet + - VLS_BIND=0.0.0.0 + - VLS_PORT=7701 txoo: build: diff --git a/lightningd/Dockerfile b/lightningd/Dockerfile index f9d4e88..c3f040b 100644 --- a/lightningd/Dockerfile +++ b/lightningd/Dockerfile @@ -61,6 +61,20 @@ RUN git clone $PLUGINS_REPO && \ cd plugins && \ git checkout $PLUGINS_GIT_HASH +RUN apk add \ + cargo \ + rust \ + grpc \ + protobuf \ + protobuf-dev + +ARG VLS_GIT_HASH=af02dac8b855c361d74234387d288a9591fad1d5 +ARG VLS_REPO=https://gitlab.com/lightning-signer/validating-lightning-signer.git +RUN git clone $VLS_REPO && \ + cd validating-lightning-signer && \ + git checkout $VLS_GIT_HASH && \ + cargo build --bins -r + # final stage with runtime dependencies and pkgs FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM:-linux/amd64}} alpine:3.18 as runner @@ -98,6 +112,7 @@ COPY --from=builder /usr/share/man/man8 /usr/share/man/man8 COPY --from=builder /usr/share/doc/c-lightning /usr/share/doc/c-lightning COPY --from=builder /usr/bin/clboss /usr/bin/clboss COPY --from=builder /build/plugins/summary /usr/local/src/plugins/summary +COPY --from=builder /build/validating-lightning-signer/target/release/remote_hsmd_socket /usr/libexec/c-lightning/remote_hsmd_socket RUN addgroup -S lightning && adduser -S lightning -G lightning && \ mkdir -p ${LIGHTNINGD_DATA} && \