mirror of
https://github.com/lnbook/lnbook
synced 2024-11-04 18:00:26 +00:00
Docker (wait-for-bitcoind) and docker-compose fixes
Sequencing of containers now works.
This commit is contained in:
parent
e43d0bfa82
commit
6f25921336
@ -24,6 +24,11 @@ ADD fund-c-lightning.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/fund-c-lightning.sh
|
||||
ADD logtail.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/logtail.sh
|
||||
ADD wait-for-bitcoind.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/wait-for-bitcoind.sh
|
||||
|
||||
EXPOSE 9735 9835
|
||||
ENTRYPOINT ["/usr/local/bin/c-lightning-entrypoint.sh"]
|
||||
|
||||
# Show logs from beginning and keep following
|
||||
CMD ["/usr/local/bin/logtail.sh"]
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
source /usr/local/bin/wait-for-bitcoind.sh
|
||||
|
||||
echo Starting c-lightning...
|
||||
lightningd --lightning-dir=/lightningd --daemon
|
||||
|
||||
until lightning-cli --lightning-dir=/lightningd --network regtest getinfo > /dev/null 2>&1
|
||||
|
16
code/docker/c-lightning/wait-for-bitcoind.sh
Normal file
16
code/docker/c-lightning/wait-for-bitcoind.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo Waiting for bitcoind to start...
|
||||
until bitcoin-cli -rpcconnect=bitcoind -rpcport=18443 -rpcuser=regtest -rpcpassword=regtest getblockchaininfo > /dev/null 2>&1
|
||||
do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo Waiting for bitcoind to mine blocks...
|
||||
until bitcoin-cli -rpcconnect=bitcoind -rpcport=18443 -rpcuser=regtest -rpcpassword=regtest getbalance | jq -e ". > 0" > /dev/null 2>&1
|
||||
do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
@ -6,6 +6,8 @@ RUN apt update && apt install -yqq \
|
||||
RUN apt update && apt install -yqq \
|
||||
openjdk-11-jdk unzip
|
||||
|
||||
COPY --from=lnbook/bitcoind /usr/local/ /usr/local/
|
||||
|
||||
# Install eclair
|
||||
ENV ECLAIR_VER 0.4
|
||||
ENV ECLAIR_COMMIT 69c538e
|
||||
@ -25,6 +27,11 @@ ADD eclair-entrypoint.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/eclair-entrypoint.sh
|
||||
ADD logtail.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/logtail.sh
|
||||
ADD wait-for-bitcoind.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/wait-for-bitcoind.sh
|
||||
|
||||
EXPOSE 9735
|
||||
ENTRYPOINT ["/usr/local/bin/eclair-entrypoint.sh"]
|
||||
|
||||
# Show logs from beginning and keep following
|
||||
CMD ["/usr/local/bin/logtail.sh"]
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
source /usr/local/bin/wait-for-bitcoind.sh
|
||||
|
||||
echo Starting eclair...
|
||||
cd /usr/src/eclair-node-${ECLAIR_VER}-${ECLAIR_COMMIT}/
|
||||
/bin/bash bin/eclair-node.sh -Declair.datadir="/eclair" &
|
||||
@ -13,6 +15,8 @@ done
|
||||
|
||||
echo Eclair node started
|
||||
|
||||
sleep 2
|
||||
|
||||
# Executing CMD
|
||||
echo "$@"
|
||||
exec "$@"
|
||||
|
16
code/docker/eclair/wait-for-bitcoind.sh
Normal file
16
code/docker/eclair/wait-for-bitcoind.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo Waiting for bitcoind to start...
|
||||
until bitcoin-cli -rpcconnect=bitcoind -rpcport=18443 -rpcuser=regtest -rpcpassword=regtest getblockchaininfo > /dev/null 2>&1
|
||||
do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo Waiting for bitcoind to mine blocks...
|
||||
until bitcoin-cli -rpcconnect=bitcoind -rpcport=18443 -rpcuser=regtest -rpcpassword=regtest getbalance | jq -e ". > 0" > /dev/null 2>&1
|
||||
do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
@ -14,19 +14,12 @@ services:
|
||||
- "18443"
|
||||
- "12005"
|
||||
- "12006"
|
||||
healthcheck:
|
||||
test: bitcoin-cli -datadir=/bitcoind getblockchaininfo
|
||||
interval: 2s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
|
||||
Alice:
|
||||
container_name: Alice
|
||||
build:
|
||||
context: ../lnd
|
||||
image: lnbook/lnd:latest
|
||||
depends_on:
|
||||
- bitcoind
|
||||
networks:
|
||||
- lnnet
|
||||
expose:
|
||||
@ -37,9 +30,6 @@ services:
|
||||
build:
|
||||
context: ../c-lightning
|
||||
image: lnbook/c-lightning:latest
|
||||
depends_on:
|
||||
- bitcoind
|
||||
- Alice
|
||||
networks:
|
||||
- lnnet
|
||||
expose:
|
||||
@ -50,9 +40,6 @@ services:
|
||||
build:
|
||||
context: ../eclair
|
||||
image: lnbook/eclair:latest
|
||||
depends_on:
|
||||
- bitcoind
|
||||
- Bob
|
||||
networks:
|
||||
- lnnet
|
||||
expose:
|
||||
@ -63,9 +50,6 @@ services:
|
||||
build:
|
||||
context: ../lnd
|
||||
image: lnbook/lnd:latest
|
||||
depends_on:
|
||||
- bitcoind
|
||||
- Wei
|
||||
networks:
|
||||
- lnnet
|
||||
expose:
|
||||
|
@ -14,6 +14,8 @@ RUN apt update && apt install -yqq \
|
||||
curl gosu jq bash-completion
|
||||
|
||||
COPY --from=lnd-base /go /go
|
||||
COPY --from=lnbook/bitcoind /usr/local/ /usr/local/
|
||||
|
||||
RUN cp /go/src/github.com/lightningnetwork/lnd/contrib/lncli.bash-completion \
|
||||
/usr/share/bash-completion/completions/lncli
|
||||
|
||||
@ -29,6 +31,8 @@ ADD lnd-entrypoint.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/lnd-entrypoint.sh
|
||||
ADD logtail.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/logtail.sh
|
||||
ADD wait-for-bitcoind.sh /usr/local/bin
|
||||
RUN chmod +x /usr/local/bin/wait-for-bitcoind.sh
|
||||
|
||||
# LND RPC
|
||||
EXPOSE 10009/tcp
|
||||
@ -39,5 +43,5 @@ EXPOSE 9735/tcp
|
||||
WORKDIR /lnd
|
||||
ENTRYPOINT ["/usr/local/bin/lnd-entrypoint.sh"]
|
||||
|
||||
# Show lnd logs from beginning and keep following
|
||||
# Show logs from beginning and keep following
|
||||
CMD ["/usr/local/bin/logtail.sh"]
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
source /usr/local/bin/wait-for-bitcoind.sh
|
||||
|
||||
echo Starting lnd...
|
||||
lnd --lnddir=/lnd --noseedbackup > /dev/null &
|
||||
|
||||
|
16
code/docker/lnd/wait-for-bitcoind.sh
Normal file
16
code/docker/lnd/wait-for-bitcoind.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
echo Waiting for bitcoind to start...
|
||||
until bitcoin-cli -rpcconnect=bitcoind -rpcport=18443 -rpcuser=regtest -rpcpassword=regtest getblockchaininfo > /dev/null 2>&1
|
||||
do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo Waiting for bitcoind to mine blocks...
|
||||
until bitcoin-cli -rpcconnect=bitcoind -rpcport=18443 -rpcuser=regtest -rpcpassword=regtest getbalance | jq -e ". > 0" > /dev/null 2>&1
|
||||
do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
Loading…
Reference in New Issue
Block a user