Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose up #2699

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 7 additions & 10 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docker/btcd/start-btcctl.sh
Original file line number Diff line number Diff line change
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
55 changes: 55 additions & 0 deletions docker/docker-compose.ltc.yml
Original file line number Diff line number Diff line change
@@ -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:
guggero marked this conversation as resolved.
Show resolved Hide resolved
context: ../
dockerfile: docker/lnd/Dockerfile
environment:
- RPCUSER
- RPCPASS
- NETWORK
- CHAIN
- DEBUG
volumes:
- shared:/rpc
- lnd_ltc:/root/.lnd
entrypoint: ["./start-lnd.sh"]
links:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove links, which is deprecated?

Links are a legacy option. We recommend using networks instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johng removing the legacy issues could take place in a separate PR. I think there are enough changes in this PR and better to keep the PR simple and address the github issue imo.

- "ltcd:blockchain"
guggero marked this conversation as resolved.
Show resolved Hide resolved

volumes:
guggero marked this conversation as resolved.
Show resolved Hide resolved
# 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
93 changes: 17 additions & 76 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
links:
- "ltcd:blockchain"

lnd_btc:
extends: lnd
container_name: lnd_btc
- CHAIN
- DEBUG
volumes:
- shared:/rpc
yancyribbens marked this conversation as resolved.
Show resolved Hide resolved
- lnd:/root/.lnd
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 All @@ -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
2 changes: 1 addition & 1 deletion docker/ltcd/start-ltcctl.sh
Original file line number Diff line number Diff line change
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