Skip to content

Commit fbf346b

Browse files
committed
Add Docker Compose and CI workflows for integration tests
- Add docker-compose configs for CLN (bitcoind 29.1), LND (bitcoind 29.1), and Eclair (bitcoind 30.2 required by Eclair latest) - Add CI workflows: cln-integration.yml, lnd-integration.yml, eclair-integration.yml - Bump corepc-node feature to 29_0 and update download_bitcoind_electrs.sh
1 parent 9c4bddb commit fbf346b

9 files changed

Lines changed: 273 additions & 30 deletions

.github/workflows/cln-integration.yml

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,62 @@ jobs:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
1515

16-
- name: Install dependencies
17-
run: |
18-
sudo apt-get update -y
19-
sudo apt-get install -y socat
16+
- name: Create temporary directory for CLN data
17+
run: echo "CLN_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
2018

2119
- name: Start bitcoind, electrs, and lightningd
2220
run: docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml up -d
2321

24-
- name: Forward lightningd RPC socket
22+
- name: Wait for bitcoind to be healthy
23+
run: |
24+
for i in $(seq 1 30); do
25+
if docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
26+
echo "bitcoind is ready"
27+
exit 0
28+
fi
29+
echo "Waiting for bitcoind... ($i/30)"
30+
sleep 2
31+
done
32+
echo "ERROR: bitcoind not ready"
33+
exit 1
34+
35+
- name: Mine initial block for CLN
36+
run: |
37+
docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet miner
38+
ADDR=$(docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=miner getnewaddress)
39+
docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass generatetoaddress 1 "$ADDR"
40+
docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass unloadwallet miner
41+
42+
- name: Start lightningd
43+
run: docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml up -d cln
44+
env:
45+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
46+
47+
- name: Wait for CLN to be ready
48+
run: |
49+
for i in $(seq 1 30); do
50+
if docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec cln test -S /root/.lightning/regtest/lightning-rpc 2>/dev/null; then
51+
echo "CLN RPC socket found"
52+
break
53+
fi
54+
echo "Waiting for CLN RPC socket... ($i/30)"
55+
sleep 2
56+
done
57+
docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml exec cln test -S /root/.lightning/regtest/lightning-rpc || {
58+
echo "ERROR: CLN RPC socket not found after 60 seconds"
59+
docker compose -p ldk-node -f tests/docker/docker-compose-cln.yml logs cln
60+
exit 1
61+
}
62+
63+
- name: Set permissions for CLN data directory
2564
run: |
26-
docker exec ldk-node-cln-1 sh -c "socat -d -d TCP-LISTEN:9937,fork,reuseaddr UNIX-CONNECT:/root/.lightning/regtest/lightning-rpc&"
27-
socat -d -d UNIX-LISTEN:/tmp/lightning-rpc,reuseaddr,fork TCP:127.0.0.1:9937&
65+
sudo chown -R $(id -u):$(id -g) $CLN_DATA_DIR
66+
sudo chmod -R 755 $CLN_DATA_DIR
67+
env:
68+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
2869

2970
- name: Run CLN integration tests
30-
run: RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln
71+
run: CLN_SOCKET_PATH=$CLN_DATA_DIR/regtest/lightning-rpc
72+
RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln -- --show-output --test-threads=1
73+
env:
74+
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI Checks - Eclair Integration Tests
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check-eclair:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Start bitcoind and electrs
17+
run: docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml up -d bitcoin electrs
18+
19+
- name: Wait for bitcoind to be healthy
20+
run: |
21+
for i in $(seq 1 30); do
22+
if docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
23+
echo "bitcoind is ready"
24+
exit 0
25+
fi
26+
echo "Waiting for bitcoind... ($i/30)"
27+
sleep 2
28+
done
29+
echo "ERROR: bitcoind not ready"
30+
exit 1
31+
32+
- name: Create wallets on bitcoind
33+
run: |
34+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet eclair
35+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=eclair getnewaddress
36+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet ldk_node_test
37+
38+
- name: Start Eclair
39+
run: docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml up -d eclair
40+
41+
- name: Wait for Eclair to be ready
42+
run: |
43+
for i in $(seq 1 60); do
44+
if curl -s -u :eclairpassword -X POST http://127.0.0.1:8080/getinfo > /dev/null 2>&1; then
45+
echo "Eclair is ready"
46+
exit 0
47+
fi
48+
echo "Waiting for Eclair... ($i/60)"
49+
sleep 5
50+
done
51+
echo "Eclair failed to start"
52+
docker compose -p ldk-node -f tests/docker/docker-compose-eclair.yml logs eclair
53+
exit 1
54+
55+
- name: Run Eclair integration tests
56+
run: RUSTFLAGS="--cfg eclair_test" cargo test --test integration_tests_eclair -- --show-output --test-threads=1

.github/workflows/lnd-integration.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Check and install CMake if needed
17-
# lnd_grpc_rust (via prost-build v0.10.4) requires CMake >= 3.5 but is incompatible with CMake >= 4.0.
18-
# This step checks if CMake is missing, below 3.5, or 4.0 or higher, and installs CMake 3.31.6 if needed,
19-
# ensuring compatibility with prost-build in ubuntu-latest.
2017
run: |
2118
if ! command -v cmake &> /dev/null ||
2219
[ "$(cmake --version | head -n1 | cut -d' ' -f3)" \< "3.5" ] ||
@@ -33,24 +30,54 @@ jobs:
3330
fi
3431
3532
- name: Create temporary directory for LND data
36-
id: create-temp-dir
3733
run: echo "LND_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV
3834

3935
- name: Start bitcoind, electrs, and LND
4036
run: docker compose -p ldk-node -f tests/docker/docker-compose-lnd.yml up -d
4137
env:
4238
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
4339

40+
- name: Wait for LND to be ready
41+
run: |
42+
for i in $(seq 1 30); do
43+
if docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon 2>/dev/null; then
44+
echo "LND macaroon found"
45+
break
46+
fi
47+
echo "Waiting for LND macaroon... ($i/30)"
48+
sleep 2
49+
done
50+
docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon || {
51+
echo "ERROR: LND macaroon not found after 60 seconds"
52+
docker compose -p ldk-node -f tests/docker/docker-compose-lnd.yml logs lnd
53+
exit 1
54+
}
55+
4456
- name: Set permissions for LND data directory
45-
# In PR 4622 (https://github.com/lightningnetwork/lnd/pull/4622),
46-
# LND sets file permissions to 0700, preventing test code from accessing them.
47-
# This step ensures the test suite has the necessary permissions.
4857
run: sudo chmod -R 755 $LND_DATA_DIR
4958
env:
5059
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
5160

61+
- name: Wait for LND gRPC to be ready
62+
run: |
63+
for i in $(seq 1 15); do
64+
if docker exec ldk-node-lnd lncli \
65+
--rpcserver=localhost:8081 \
66+
--tlscertpath=/root/.lnd/tls.cert \
67+
--macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon \
68+
--network=regtest getinfo 2>/dev/null; then
69+
echo "LND gRPC is ready"
70+
exit 0
71+
fi
72+
echo "Waiting for LND gRPC... ($i/15)"
73+
sleep 2
74+
done
75+
echo "ERROR: LND gRPC not ready after 30 seconds"
76+
docker compose -p ldk-node -f tests/docker/docker-compose-lnd.yml logs lnd
77+
exit 1
78+
5279
- name: Run LND integration tests
5380
run: LND_CERT_PATH=$LND_DATA_DIR/tls.cert LND_MACAROON_PATH=$LND_DATA_DIR/data/chain/bitcoin/regtest/admin.macaroon
54-
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --exact --show-output
81+
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --show-output --test-threads=1
5582
env:
5683
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ winapi = { version = "0.3", features = ["winbase"] }
8888
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "dcf0c203e166da2348bef12b2e5eff4a250cdec7", features = ["std", "_test_utils"] }
8989
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
9090
proptest = "1.0.0"
91+
paste = "1.0"
9192
regex = "1.5.6"
9293
criterion = { version = "0.7.0", features = ["async_tokio"] }
9394
ldk-node-062 = { package = "ldk-node", version = "=0.6.2" }

Dockerfile.eclair

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Repackage acinq/eclair:latest onto a glibc-based runtime.
2+
# The official image uses Alpine (musl libc), which causes SIGSEGV in
3+
# secp256k1-jni because the native library is compiled against glibc.
4+
FROM acinq/eclair:latest AS source
5+
6+
FROM eclipse-temurin:21-jre-jammy
7+
WORKDIR /app
8+
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
bash jq curl unzip && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
COPY --from=source /sbin/eclair-cli /sbin/eclair-cli
14+
COPY --from=source /app/eclair-node /app/eclair-node
15+
16+
ENV ECLAIR_DATADIR=/data
17+
ENV JAVA_OPTS=
18+
19+
RUN mkdir -p "$ECLAIR_DATADIR"
20+
VOLUME [ "/data" ]
21+
22+
ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh "-Declair.datadir=${ECLAIR_DATADIR}"

docker-compose-eclair.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
services:
2+
# All services use host networking because Eclair subscribes to bitcoind
3+
# ZMQ notifications (hashblock/rawtx). ZMQ PUB/SUB over Docker bridge
4+
# networking is unreliable — the subscriber may silently miss messages,
5+
# causing Eclair to fall behind the chain tip. Host networking avoids
6+
# this by keeping all inter-process communication on localhost.
7+
bitcoin:
8+
image: blockstream/bitcoind:30.2
9+
platform: linux/amd64
10+
network_mode: host
11+
command:
12+
[
13+
"bitcoind",
14+
"-printtoconsole",
15+
"-regtest=1",
16+
"-rpcallowip=0.0.0.0/0",
17+
"-rpcbind=0.0.0.0",
18+
"-rpcuser=user",
19+
"-rpcpassword=pass",
20+
"-fallbackfee=0.00001",
21+
"-rest",
22+
"-txindex=1",
23+
"-zmqpubhashblock=tcp://0.0.0.0:28332",
24+
"-zmqpubrawtx=tcp://0.0.0.0:28333"
25+
]
26+
healthcheck:
27+
test: ["CMD", "bitcoin-cli", "-regtest", "-rpcuser=user", "-rpcpassword=pass", "getblockchaininfo"]
28+
interval: 5s
29+
timeout: 10s
30+
retries: 5
31+
32+
electrs:
33+
image: mempool/electrs:v3.2.0
34+
platform: linux/amd64
35+
network_mode: host
36+
depends_on:
37+
bitcoin:
38+
condition: service_healthy
39+
command:
40+
[
41+
"-vvvv",
42+
"--timestamp",
43+
"--jsonrpc-import",
44+
"--cookie=user:pass",
45+
"--network=regtest",
46+
"--daemon-rpc-addr=127.0.0.1:18443",
47+
"--http-addr=0.0.0.0:3002",
48+
"--electrum-rpc-addr=0.0.0.0:50001"
49+
]
50+
51+
eclair:
52+
build:
53+
context: .
54+
dockerfile: Dockerfile.eclair
55+
image: ldk-node-eclair:local
56+
platform: linux/amd64
57+
network_mode: host
58+
depends_on:
59+
bitcoin:
60+
condition: service_healthy
61+
environment:
62+
JAVA_OPTS: >-
63+
-Xmx512m
64+
-Declair.allow-unsafe-startup=true
65+
-Declair.chain=regtest
66+
-Declair.server.port=9736
67+
-Declair.api.enabled=true
68+
-Declair.api.binding-ip=0.0.0.0
69+
-Declair.api.port=8080
70+
-Declair.api.password=eclairpassword
71+
-Declair.bitcoind.host=127.0.0.1
72+
-Declair.bitcoind.rpcport=18443
73+
-Declair.bitcoind.rpcuser=user
74+
-Declair.bitcoind.rpcpassword=pass
75+
-Declair.bitcoind.wallet=eclair
76+
-Declair.bitcoind.zmqblock=tcp://127.0.0.1:28332
77+
-Declair.bitcoind.zmqtx=tcp://127.0.0.1:28333
78+
-Declair.features.keysend=optional
79+
-Declair.on-chain-fees.confirmation-priority.funding=slow
80+
-Declair.printToConsole

docker-compose.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
version: '3'
2-
31
services:
42
bitcoin:
5-
image: blockstream/bitcoind:27.2
3+
image: blockstream/bitcoind:30.2
64
platform: linux/amd64
75
command:
86
[
@@ -14,11 +12,15 @@ services:
1412
"-rpcuser=user",
1513
"-rpcpassword=pass",
1614
"-fallbackfee=0.00001",
17-
"-rest"
15+
"-rest",
16+
"-zmqpubrawblock=tcp://0.0.0.0:28332",
17+
"-zmqpubrawtx=tcp://0.0.0.0:28333"
1818
]
1919
ports:
2020
- "18443:18443" # Regtest REST and RPC port
2121
- "18444:18444" # Regtest P2P port
22+
- "28332:28332" # ZMQ block port
23+
- "28333:28333" # ZMQ tx port
2224
networks:
2325
- bitcoin-electrs
2426
healthcheck:
@@ -41,10 +43,12 @@ services:
4143
"--cookie=user:pass",
4244
"--network=regtest",
4345
"--daemon-rpc-addr=bitcoin:18443",
44-
"--http-addr=0.0.0.0:3002"
46+
"--http-addr=0.0.0.0:3002",
47+
"--electrum-rpc-addr=0.0.0.0:50001"
4548
]
4649
ports:
4750
- "3002:3002"
51+
- "50001:50001"
4852
networks:
4953
- bitcoin-electrs
5054

tests/docker/docker-compose-cln.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ services:
1111
"-rpcbind=0.0.0.0",
1212
"-rpcuser=user",
1313
"-rpcpassword=pass",
14-
"-fallbackfee=0.00001"
14+
"-fallbackfee=0.00001",
15+
"-rest",
16+
"-zmqpubrawblock=tcp://0.0.0.0:28332",
17+
"-zmqpubrawtx=tcp://0.0.0.0:28333"
1518
]
1619
ports:
17-
- "18443:18443" # Regtest RPC port
18-
- "18444:18444" # Regtest P2P port
20+
- "18443:18443"
21+
- "18444:18444"
22+
- "28332:28332"
23+
- "28333:28333"
1924
networks:
2025
- bitcoin-electrs
2126
healthcheck:
@@ -53,6 +58,8 @@ services:
5358
depends_on:
5459
bitcoin:
5560
condition: service_healthy
61+
volumes:
62+
- ${CLN_DATA_DIR:-/tmp/cln-data}:/root/.lightning
5663
command:
5764
[
5865
"--bitcoin-rpcconnect=bitcoin",

0 commit comments

Comments
 (0)