docker: add "CHAIN" parameter

After addition of the Litecoin client image (ltcd), we should add
additional parameter to notify the start script which network we should
use.
This commit is contained in:
Andrey Samokhvalov 2017-05-13 23:22:40 +03:00 committed by Olaoluwa Osuntokun
parent 25970bc113
commit 816b9ada44
2 changed files with 49 additions and 11 deletions

View File

@ -10,7 +10,7 @@ services:
context: btcd/
volumes:
- shared:/rpc
- blockchain:/data
- bitcoin:/data
environment:
- RPCUSER
- RPCPASS
@ -31,6 +31,37 @@ services:
- "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
build:
context: ltcd/
volumes:
- shared:/rpc
- litecoin:/data
environment:
- RPCUSER
- RPCPASS
- NETWORK
ltcd:
extends: ltc
container_name: ltcd
environment:
- DEBUG
- MINING_ADDRESS
entrypoint: ["./start-ltcd.sh"]
ltcctl:
extends: ltc
container_name: ltcctl
links:
- "ltcd:rpcserver"
entrypoint: ["./start-ltcctl.sh"]
lnd:
image: lnd
build:
@ -40,6 +71,7 @@ services:
- RPCUSER
- RPCPASS
- NETWORK
- CHAIN
- DEBUG
volumes:
- shared:/rpc
@ -49,13 +81,13 @@ services:
extends: lnd
container_name: alice
links:
- "btcd:btcd"
- "btcd:blockchain"
bob:
extends: lnd
container_name: bob
links:
- "btcd:btcd"
- "btcd:blockchain"
volumes:
# shared volume is need to store the btcd rpc certificates and us it within
@ -63,7 +95,12 @@ volumes:
shared:
driver: local
# blockhain volume is needed for maintaining blockchain persistance
# bitcoin volume is needed for maintaining blockchain persistance
# during btcd container recreation.
blockchain:
bitcoin:
driver: local
# litecoin volume is needed for maintaining blockchain persistance
# during ltcd container recreation.
litecoin:
driver: local

View File

@ -43,15 +43,16 @@ RPCUSER=$(set_default "$RPCUSER" "devuser")
RPCPASS=$(set_default "$RPCPASS" "devpass")
DEBUG=$(set_default "$DEBUG" "debug")
NETWORK=$(set_default "$NETWORK" "simnet")
CHAIN=$(set_default "$CHAIN" "bitcoin")
lnd \
--datadir="/data" \
--logdir="/data" \
--bitcoin.active \
"--bitcoin.$NETWORK" \
--bitcoin.rpchost="btcd" \
--bitcoin.rpccert="/rpc/rpc.cert" \
--bitcoin.rpcuser="$RPCUSER" \
--bitcoin.rpcpass="$RPCPASS" \
"--$CHAIN.rpccert"="/rpc/rpc.cert" \
"--$CHAIN.active" \
"--$CHAIN.$NETWORK" \
"--$CHAIN.rpchost"="blockchain" \
"--$CHAIN.rpcuser"="$RPCUSER" \
"--$CHAIN.rpcpass"="$RPCPASS" \
--debuglevel="$DEBUG" \
"$@"