add named volume to lnd service for persisting data accross container lifecycle

This commit is contained in:
yancy ribbens 2019-01-23 07:34:09 -06:00 committed by Yancy Ribbens
parent d50b3a9c81
commit 5c4edcab8f
3 changed files with 17 additions and 8 deletions

@ -63,8 +63,12 @@ bitcoin into.
# Init bitcoin network env variable: # Init bitcoin network env variable:
$ export NETWORK="simnet" $ export NETWORK="simnet"
# Create persistent volumes for alice and bob.
docker volume create simnet_lnd_alice
docker volume create simnet_lnd_bob
# Run the "Alice" container and log into it: # Run the "Alice" container and log into it:
$ docker-compose run -d --name alice lnd_btc $ docker-compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd_btc
$ docker exec -i -t alice bash $ docker exec -i -t alice bash
# Generate a new backward compatible nested p2sh address for Alice: # Generate a new backward compatible nested p2sh address for Alice:
@ -90,7 +94,7 @@ Connect `Bob` node to `Alice` node.
```bash ```bash
# Run "Bob" node and log into it: # Run "Bob" node and log into it:
$ docker-compose run -d --name bob lnd_btc $ docker-compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd_btc
$ docker exec -i -t bob bash $ docker exec -i -t bob bash
# Get the identity pubkey of "Bob" node: # Get the identity pubkey of "Bob" node:

@ -9,8 +9,8 @@ services:
build: build:
context: btcd/ context: btcd/
volumes: volumes:
- shared:/rpc - shared:/rpc
- bitcoin:/data - bitcoin:/data
environment: environment:
- RPCUSER - RPCUSER
- RPCPASS - RPCPASS
@ -41,8 +41,8 @@ services:
build: build:
context: ltcd/ context: ltcd/
volumes: volumes:
- shared:/rpc - shared:/rpc
- litecoin:/data - litecoin:/data
environment: environment:
- RPCUSER - RPCUSER
- RPCPASS - RPCPASS
@ -76,7 +76,8 @@ services:
- CHAIN - CHAIN
- DEBUG - DEBUG
volumes: volumes:
- shared:/rpc - shared:/rpc
- lnd:/root/.lnd
entrypoint: ["./start-lnd.sh"] entrypoint: ["./start-lnd.sh"]
lnd_ltc: lnd_ltc:
@ -102,6 +103,11 @@ volumes:
bitcoin: bitcoin:
driver: local driver: local
# lnd volume is used for persisting lnd application data and chain state
# during container lifecycle.
lnd:
driver: local
# litecoin volume is needed for maintaining blockchain persistence # litecoin volume is needed for maintaining blockchain persistence
# during ltcd container recreation. # during ltcd container recreation.
litecoin: litecoin:

@ -51,7 +51,6 @@ fi
exec lnd \ exec lnd \
--noseedbackup \ --noseedbackup \
--logdir="/data" \
"--$CHAIN.active" \ "--$CHAIN.active" \
"--$CHAIN.$NETWORK" \ "--$CHAIN.$NETWORK" \
"--$CHAIN.node"="btcd" \ "--$CHAIN.node"="btcd" \