From 816b9ada44d2cb310e2b2586f461536daeaf0337 Mon Sep 17 00:00:00 2001 From: Andrey Samokhvalov Date: Sat, 13 May 2017 23:22:40 +0300 Subject: [PATCH] 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. --- docker/docker-compose.yml | 47 ++++++++++++++++++++++++++++++++++----- docker/lnd/start-lnd.sh | 13 ++++++----- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3eaf20b0..00ca1d06 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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 diff --git a/docker/lnd/start-lnd.sh b/docker/lnd/start-lnd.sh index 7c636a78..7b6ed917 100755 --- a/docker/lnd/start-lnd.sh +++ b/docker/lnd/start-lnd.sh @@ -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" \ "$@"