docker: enable docker-compose up command for btc and ltc compose files

This commit is contained in:
yancy ribbens 2019-02-25 07:45:47 -06:00 committed by yancy
parent 883f9e5f9a
commit 1f457ac1a8
5 changed files with 81 additions and 88 deletions

View File

@ -68,7 +68,7 @@ docker volume create simnet_lnd_alice
docker volume create simnet_lnd_bob
# Run the "Alice" container and log into it:
$ docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd_btc
$ docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd
$ docker exec -i -t alice bash
# Generate a new backward compatible nested p2sh address for Alice:
@ -79,10 +79,10 @@ $ MINING_ADDRESS=<alice_address> docker-compose up -d btcd
# Generate 400 blocks (we need at least "100 >=" blocks because of coinbase
# block maturity and "300 ~=" in order to activate segwit):
$ docker-compose run btcctl generate 400
$ docker exec -it btcd /start-btcctl.sh generate 400
# Check that segwit is active:
$ docker-compose run btcctl getblockchaininfo | grep -A 1 segwit
$ docker exec -it btcd /start-btcctl.sh getblockchaininfo | grep -A 1 segwit
```
Check `Alice` balance:
@ -94,7 +94,7 @@ Connect `Bob` node to `Alice` node.
```bash
# Run "Bob" node and log into it:
$ docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd_btc
$ docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd
$ docker exec -i -t bob bash
# Get the identity pubkey of "Bob" node:
@ -163,7 +163,7 @@ Create the `Alice<->Bob` channel.
alice$ lncli --network=simnet openchannel --node_key=<bob_identity_pubkey> --local_amt=1000000
# Include funding transaction in block thereby opening the channel:
$ docker-compose run btcctl generate 3
$ docker exec -it btcd /start-btcctl.sh generate 3
# Check that channel with "Bob" was opened:
alice$ lncli --network=simnet listchannels
@ -247,7 +247,7 @@ alice$ lncli --network=simnet listchannels
alice$ lncli --network=simnet closechannel --funding_txid=<funding_txid> --output_index=<output_index>
# Include close transaction in a block thereby closing the channel:
$ docker-compose run btcctl generate 3
$ docker exec -it btcd /start-btcctl.sh generate 3
# Check "Alice" on-chain balance was credited by her settled amount in the channel:
alice$ lncli --network=simnet walletbalance
@ -299,10 +299,7 @@ First of all you need to run `btcd` node in `testnet` and wait for it to be
synced with test network (`May the Force and Patience be with you`).
```bash
# Init bitcoin network env variable:
$ export NETWORK="testnet"
# Run "btcd" node:
$ docker-compose up -d "btcd"
$ NETWORK="testnet" docker-compose up
```
After `btcd` synced, connect `Alice` to the `Faucet` node.

View File

@ -52,7 +52,7 @@ PARAMS=$(echo $PARAMS \
"--rpccert=/rpc/rpc.cert" \
"--rpcuser=$RPCUSER" \
"--rpcpass=$RPCPASS" \
"--rpcserver=rpcserver" \
"--rpcserver=localhost" \
)
PARAMS="$PARAMS $@"

View File

@ -0,0 +1,55 @@
version: '2'
services:
# ltc is an image of litecoin node which used as base image for ltcd and
# ltcctl. The environment variables default values determined on stage of
# container start within starting script.
ltcd:
image: ltcd
container_name: ltcd
build:
context: ltcd/
volumes:
- shared:/rpc
- litecoin:/data
environment:
- RPCUSER
- RPCPASS
- NETWORK
- DEBUG
- MINING_ADDRESS
entrypoint: ["./start-ltcd.sh"]
lnd:
image: lnd
container_name: lnd_ltc
build:
context: ../
dockerfile: docker/lnd/Dockerfile
environment:
- RPCUSER
- RPCPASS
- NETWORK
- CHAIN
- DEBUG
volumes:
- shared:/rpc
- lnd_ltc:/root/.lnd
entrypoint: ["./start-lnd.sh"]
links:
- "ltcd:blockchain"
volumes:
# shared volume is need to store the btcd rpc certificates and use it within
# ltcctl and lnd containers.
shared:
driver: local
# litecoin volume is needed for maintaining blockchain persistence
# during ltcd container recreation.
litecoin:
driver: local
# lnd volume is used for persisting lnd application data and chain state
# during container lifecycle.
lnd_ltc:
driver: local

View File

@ -1,11 +1,11 @@
version: '2'
services:
# btc is an image of bitcoin node which used as base image for btcd and
# btccli. The environment variables default values determined on stage of
# container start within starting script.
btc:
btcd:
image: btcd
container_name: btcd
build:
context: btcd/
volumes:
@ -15,82 +15,28 @@ services:
- RPCUSER
- RPCPASS
- NETWORK
- DEBUG
- MINING_ADDRESS
entrypoint: ["./start-btcd.sh"]
btcd:
extends: btc
container_name: btcd
environment:
- DEBUG
- MINING_ADDRESS
- NETWORK
entrypoint: ["./start-btcd.sh"]
btcctl:
extends: btc
container_name: btcctl
links:
- "btcd:rpcserver"
entrypoint: ["./start-btcctl.sh"]
# ltc is an image of litecoin node which used as base image for ltcd and
# ltcctl. The environment variables default values determined on stage of
# container start within starting script.
ltc:
image: ltcd
lnd:
image: lnd
container_name: lnd
build:
context: ltcd/
volumes:
- shared:/rpc
- litecoin:/data
context: ../
dockerfile: docker/lnd/Dockerfile
environment:
- RPCUSER
- RPCPASS
- NETWORK
ltcd:
extends: ltc
container_name: ltcd
environment:
- DEBUG
- MINING_ADDRESS
- NETWORK
entrypoint: ["./start-ltcd.sh"]
ltcctl:
extends: ltc
container_name: ltcctl
links:
- "ltcd:rpcserver"
entrypoint: ["./start-ltcctl.sh"]
lnd:
image: lnd
build:
context: ../
dockerfile: docker/lnd/Dockerfile
environment:
- RPCUSER
- RPCPASS
- NETWORK
- CHAIN
- DEBUG
volumes:
- shared:/rpc
- lnd:/root/.lnd
entrypoint: ["./start-lnd.sh"]
lnd_ltc:
extends: lnd
container_name: lnd_ltc
- CHAIN
- DEBUG
volumes:
- shared:/rpc
- lnd:/root/.lnd
entrypoint: ["./start-lnd.sh"]
links:
- "ltcd:blockchain"
lnd_btc:
extends: lnd
container_name: lnd_btc
links:
- "btcd:blockchain"
- "btcd:blockchain"
volumes:
# shared volume is need to store the btcd rpc certificates and use it within
@ -107,8 +53,3 @@ volumes:
# during container lifecycle.
lnd:
driver: local
# litecoin volume is needed for maintaining blockchain persistence
# during ltcd container recreation.
litecoin:
driver: local

View File

@ -52,7 +52,7 @@ PARAMS=$(echo $PARAMS \
"--rpccert=/rpc/rpc.cert" \
"--rpcuser=$RPCUSER" \
"--rpcpass=$RPCPASS" \
"--rpcserver=rpcserver" \
"--rpcserver=localhost" \
)
PARAMS="$PARAMS $@"