Use only named volumes in docker-compose (#2221)

* Use only named volumes in docker-compose

* Try fixing itest with new docker compose

* Update development doc
This commit is contained in:
Jonathan Zernik 2022-06-09 17:58:18 -07:00 committed by GitHub
parent e66377a3c9
commit 2cabb8197a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 16 deletions

View file

@ -1,4 +1,4 @@
FROM golang:1.12-alpine as builder
FROM golang:1.18-alpine as builder
MAINTAINER Olaoluwa Osuntokun <laolu@lightning.network>

View file

@ -5,7 +5,7 @@ services:
image: ruimarinho/bitcoin-core:0.21.1
container_name: bitcoin-core
volumes:
- ~/.bitcoin:/home/bitcoin/.bitcoin
- bitcoin:/home/bitcoin/.bitcoin
ports:
- 8332:8332
- 18332:18332
@ -25,7 +25,7 @@ services:
depends_on:
- "tor-node"
volumes:
- ~/.lnd:/root/.lnd
- lnd_client_dir:/root/.lnd
- tor-dir:/var/lib/tor
ports:
- 10009:10009
@ -69,7 +69,7 @@ services:
- 10010:10009
- 9835:9835
volumes:
- ~/.lightning:/root/.lightning
- clightning_client_dir:/root/.lightning
- tor-dir:/var/lib/tor
links:
- "bitcoin-core:bitcoin-core"
@ -151,8 +151,14 @@ services:
entrypoint: ["./entrypoint.sh"]
volumes:
bitcoin:
driver: local
lnd_client_dir:
driver: local
lnd_server_dir:
driver: local
clightning_client_dir:
driver: local
clightning_server_dir:
driver: local
squeaknode_dir:

View file

@ -32,9 +32,9 @@ You can also run your own squeaknode on your host machine.
pip install .
```
- Make sure that `~/.lnd` directory (created by docker container) has read permissions. You may need to change the permissions:
- Copy the `~/.lnd` directory from the docker container to your host machine.
```
sudo chmod -R 755 ~/.lnd/
docker cp lnd_client:/root/.lnd/ ~/.lnd
```
- Run squeaknode with authentication disabled:

View file

@ -3,8 +3,8 @@
while true; do
client_address=$(docker exec -it test_lnd_client lncli --network=simnet newaddress np2wkh | jq .address -r)
MINING_ADDRESS=$client_address docker-compose up -d btcd
MINING_ADDRESS=$client_address docker compose up -d btcd
echo "Mining 1 blocks to address: $client_address ..."
docker-compose run btcctl generate 400
docker compose run btcctl generate 400
sleep 10
done

View file

@ -6,16 +6,16 @@ trap "kill 0" EXIT
function mine_blocks {
while true; do
printf "Mining 1 block to address: $MINING_ADDRESS ..."
docker-compose run btcctl generate 1
docker compose run btcctl generate 1
sleep 1
done
}
cd itests
docker-compose down --volumes --remove-orphans
docker-compose build
docker-compose up -d
docker compose down --volumes --remove-orphans
docker compose build
docker compose up -d
# Initialize the blockchain with miner rewards going to the test client.
@ -29,9 +29,9 @@ do
sleep 2
done
MINING_ADDRESS=$client_address docker-compose up -d btcd
export MINING_ADDRESS="$client_address docker compose up -d btcd"
echo "Mining 400 blocks to address: $client_address ..."
docker-compose run btcctl generate 400
docker compose run btcctl generate 400
echo "Finished mining blocks."
sleep 30
@ -40,7 +40,7 @@ mine_blocks &
echo "Background mining task is in background..."
echo "Running test.sh...."
docker-compose run test ./test.sh
docker compose run test ./test.sh
echo "Shutting down itest..."
# docker-compose down
# docker compose down

View file

@ -40,6 +40,7 @@ from tests.util import delete_squeak
from tests.util import download_squeak
from tests.util import download_squeak_secret_key
from tests.util import free_price
from tests.util import get_balance
from tests.util import get_external_address
from tests.util import get_hash
from tests.util import get_network
@ -607,6 +608,18 @@ def test_delete_peer(admin_stub, peer_id):
def test_send_coins(admin_stub, other_admin_stub):
new_address_response = admin_stub.LndNewAddress(ln.NewAddressRequest())
get_balance_response = get_balance(
other_admin_stub,
)
print("Get balance: {}".format(get_balance_response))
print("--------------------")
print("--------------------")
print("--------------------")
print("--------------------")
print("--------------------")
print("--------------------")
print("--------------------")
print("--------------------", flush=True)
send_coins_response = send_coins(
other_admin_stub, new_address_response.address, 55555555
)

View file

@ -437,6 +437,13 @@ def disconnect_peer(node_stub, pubkey):
)
def get_balance(node_stub):
get_balance_request = lnd_pb2.WalletBalanceRequest()
return node_stub.LndWalletBalance(
get_balance_request,
)
def send_coins(node_stub, addr, amount):
send_coins_request = lnd_pb2.SendCoinsRequest(
addr=addr,