Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM rust:1.91.1-slim@sha256:cef0ec962e08d8b5dcba05604189e5751c1bd3ec7d12db0a93e4215468d4ac4a AS builder

ARG BUILD_FEATURES=""

WORKDIR /opt/app

COPY Cargo.* ./
COPY ldk-server/ ldk-server/
COPY ldk-server-cli/ ldk-server-cli/
COPY ldk-server-client/ ldk-server-client/
COPY ldk-server-protos/ ldk-server-protos/
RUN --mount=type=cache,target=/usr/local/cargo/registry \
if [ -n "$BUILD_FEATURES" ]; then \
cargo build --release --features "$BUILD_FEATURES"; \
else \
cargo build --release; \
fi

FROM debian:13.1-slim@sha256:1caf1c703c8f7e15dcf2e7769b35000c764e6f50e4d7401c355fb0248f3ddfdb

COPY --from=builder /opt/app/target/release/ldk-server /usr/local/bin/ldk-server
COPY --from=builder /opt/app/target/release/ldk-server-cli /usr/local/bin/ldk-server-cli
COPY --from=builder /opt/app/ldk-server/ldk-server-config.toml /usr/local/bin/ldk-server-config.toml

EXPOSE 3000 3001
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should expose 9735

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This port will conflict with LND.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dockerfile doesn't contain lnd, only ldk-server


ENTRYPOINT [ "ldk-server", "/usr/local/bin/ldk-server-config.toml" ]
123 changes: 123 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
services:
ldk-server:
container_name: ldk-server
build:
context: .
args:
BUILD_FEATURES: ""
command: [
"--node-listening-address=0.0.0.0:3001",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems weird for ldk-server we use the non-default 3001 but give the default 9735 to lnd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LND uses port 9735, and LDK uses port 3001. I checked in my tests, and LDK is indeed using 3001.

"--node-rest-service-address=0.0.0.0:3000",
"--bitcoind-rpc-host=ldk-server-bitcoin",
"--bitcoind-rpc-port=18443",
"--bitcoind-rpc-user=user",
"--bitcoind-rpc-password=pass",
]
ports:
- "3000:3000"
- "3001:3001"
networks:
- ldk-server
depends_on:
bitcoin:
condition: service_healthy
profiles: ["ldk-server"]

bitcoin:
container_name: ldk-server-bitcoin
image: blockstream/bitcoind:30.0@sha256:e1351bb0d735893abee13af422d4209069592d8113f8b0aa5ed1458681bfb715
platform: linux/amd64
command:
[
"bitcoind",
"-printtoconsole",
"-regtest=1",
"-rpcallowip=0.0.0.0/0",
"-rpcbind=0.0.0.0",
"-rpcuser=user",
"-rpcpassword=pass",
"-fallbackfee=0.00001",
"-zmqpubrawblock=tcp://0.0.0.0:28332",
"-zmqpubrawtx=tcp://0.0.0.0:28333"
]
ports:
- "18443:18443"
- "18444:18444"
networks:
- ldk-server
healthcheck:
test: ["CMD", "bitcoin-cli", "-regtest", "-rpcuser=user", "-rpcpassword=pass", "getblockchaininfo"]
interval: 5s
timeout: 10s
retries: 5
# Example command: bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo

lnd:
image: lightninglabs/lnd:v0.18.5-beta@sha256:2b560c9beb559c57ab2f2da1dfed80d286cf11a6dc6e4354cab84aafba79b6f6
container_name: ldk-server-lnd
ports:
- "9735:9735" # P2P
- "10009:10009" # RPC
command:
- "--noseedbackup"
- "--trickledelay=5000"
- "--alias=ldk-node-lnd-test"
- "--externalip=lnd:9735"
- "--bitcoin.active"
- "--bitcoin.regtest"
- "--bitcoin.node=bitcoind"
- "--bitcoind.rpchost=ldk-server-bitcoin:18443"
- "--bitcoind.rpcuser=user"
- "--bitcoind.rpcpass=pass"
- "--bitcoind.zmqpubrawblock=tcp://ldk-server-bitcoin:28332"
- "--bitcoind.zmqpubrawtx=tcp://ldk-server-bitcoin:28333"
- "--accept-keysend"
- "--accept-amp"
- "--rpclisten=0.0.0.0:10009"
- "--tlsextradomain=lnd"
- "--tlsextraip=0.0.0.0"
- "--listen=0.0.0.0:9735"
depends_on:
bitcoin:
condition: service_healthy
networks:
- ldk-server
# Example command: lncli --tlscertpath=/root/.lnd/tls.cert --macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon getinfo

cln:
image: blockstream/lightningd:v25.05@sha256:4f61a5e77deb27c14ed223dd789bb3bfafe00c0c13f4f1e973c0a43b8ad5de90
container_name: ldk-server-cln
platform: linux/amd64
command:
[
"--bitcoin-rpcconnect=ldk-server-bitcoin",
"--bitcoin-rpcport=18443",
"--bitcoin-rpcuser=user",
"--bitcoin-rpcpassword=pass",
"--network=regtest",
"--log-level=debug",
"--alias=ldk-server-cln",
]
ports:
- "19846:19846" # RPC
- "9736:9736" # P2P
depends_on:
bitcoin:
condition: service_healthy
networks:
- ldk-server
# Example command: lightning-cli --network=regtest getinfo

rabbitmq:
image: rabbitmq:3-management
container_name: ldk-server-rabbitmq
ports:
- "5672:5672"
- "15672:15672"
networks:
- ldk-server
profiles: ["rabbitmq"]

networks:
ldk-server:
driver: bridge
2 changes: 1 addition & 1 deletion ldk-server/ldk-server-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[node]
network = "regtest" # Bitcoin network to use
listening_address = "localhost:3001" # Lightning node listening address
rest_service_address = "127.0.0.1:3002" # LDK Server REST address
rest_service_address = "127.0.0.1:3000" # LDK Server REST address

# Storage settings
[storage.disk]
Expand Down