Skip to content

Commit

Permalink
define only the required services in docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
yancyribbens committed Mar 21, 2019
1 parent b3ed40f commit 1db9326
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 49 deletions.
19 changes: 8 additions & 11 deletions docker/README.md
Expand Up @@ -64,7 +64,7 @@ bitcoin into.
$ export NETWORK="simnet"

# Run the "Alice" container and log into it:
$ docker-compose run -d --name alice lnd_btc
$ docker-compose run -d --name alice lnd
$ docker exec -i -t alice bash

# Generate a new backward compatible nested p2sh address for Alice:
Expand All @@ -75,10 +75,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:
Expand All @@ -90,7 +90,7 @@ Connect `Bob` node to `Alice` node.

```bash
# Run "Bob" node and log into it:
$ docker-compose run -d --name bob lnd_btc
$ docker-compose run -d --name bob lnd
$ docker exec -i -t bob bash

# Get the identity pubkey of "Bob" node:
Expand Down Expand Up @@ -159,7 +159,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
Expand Down Expand Up @@ -243,7 +243,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
Expand Down Expand Up @@ -295,10 +295,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.
Expand All @@ -310,7 +307,7 @@ The `Faucet` node address can be found at the [Faucet Lightning Community webpag
$ docker-compose up -d "alice"; docker exec -i -t "alice" bash

# Connect "Alice" to the "Faucet" node:
alice$ lncli --network=simnet connect <faucet_identity_address>@<faucet_host>
alice$ lncli --network=testnet connect <faucet_identity_address>@<faucet_host>
```

After a connection is achieved, the `Faucet` node should create the channel
Expand Down
2 changes: 1 addition & 1 deletion docker/btcd/start-btcctl.sh
Expand Up @@ -52,7 +52,7 @@ PARAMS=$(echo $PARAMS \
"--rpccert=/rpc/rpc.cert" \
"--rpcuser=$RPCUSER" \
"--rpcpass=$RPCPASS" \
"--rpcserver=rpcserver" \
"--rpcserver=localhost" \
)

PARAMS="$PARAMS $@"
Expand Down
59 changes: 22 additions & 37 deletions docker/docker-compose.yml
@@ -1,56 +1,41 @@
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:
- shared:/rpc
- bitcoin:/data
- shared:/rpc
- bitcoin:/data
environment:
- RPCUSER
- RPCPASS
- NETWORK

btcd:
extends: btc
container_name: btcd
environment:
- DEBUG
- MINING_ADDRESS
entrypoint: ["./start-btcd.sh"]

btcctl:
extends: btc
container_name: btcctl
links:
- "btcd:rpcserver"
entrypoint: ["./start-btcctl.sh"]
- DEBUG
- MINING_ADDRESS
entrypoint: ["./start-btcd.sh"]

lnd:
image: lnd
build:
context: ../
dockerfile: docker/lnd/Dockerfile
environment:
- RPCUSER
- RPCPASS
- NETWORK
- CHAIN
- DEBUG
volumes:
- shared:/rpc
entrypoint: ["./start-lnd.sh"]

lnd_btc:
extends: lnd
container_name: lnd_btc
image: lnd
container_name: lnd
build:
context: ../
dockerfile: docker/lnd/Dockerfile
environment:
- RPCUSER
- RPCPASS
- NETWORK
- CHAIN
- DEBUG
volumes:
- shared:/rpc
entrypoint: ["./start-lnd.sh"]
links:
- "btcd:blockchain"
- "btcd:blockchain"

volumes:
# shared volume is need to store the btcd rpc certificates and use it within
Expand Down

0 comments on commit 1db9326

Please sign in to comment.