diff --git a/docker/README.md b/docker/README.md index 1dc79dbb..ebce1990 100644 --- a/docker/README.md +++ b/docker/README.md @@ -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= 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= --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= --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. diff --git a/docker/btcd/start-btcctl.sh b/docker/btcd/start-btcctl.sh index c8fda50d..8bd5fda0 100755 --- a/docker/btcd/start-btcctl.sh +++ b/docker/btcd/start-btcctl.sh @@ -52,7 +52,7 @@ PARAMS=$(echo $PARAMS \ "--rpccert=/rpc/rpc.cert" \ "--rpcuser=$RPCUSER" \ "--rpcpass=$RPCPASS" \ - "--rpcserver=rpcserver" \ + "--rpcserver=localhost" \ ) PARAMS="$PARAMS $@" diff --git a/docker/docker-compose.ltc.yml b/docker/docker-compose.ltc.yml new file mode 100644 index 00000000..c3bbd3dc --- /dev/null +++ b/docker/docker-compose.ltc.yml @@ -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 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8794f688..f13a400f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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 diff --git a/docker/ltcd/start-ltcctl.sh b/docker/ltcd/start-ltcctl.sh index 481586e0..2888ab9c 100755 --- a/docker/ltcd/start-ltcctl.sh +++ b/docker/ltcd/start-ltcctl.sh @@ -52,7 +52,7 @@ PARAMS=$(echo $PARAMS \ "--rpccert=/rpc/rpc.cert" \ "--rpcuser=$RPCUSER" \ "--rpcpass=$RPCPASS" \ - "--rpcserver=rpcserver" \ + "--rpcserver=localhost" \ ) PARAMS="$PARAMS $@"