remove lnbits from regtest

This commit is contained in:
dni 2022-07-28 09:39:04 +02:00
commit e7527957df
4 changed files with 20 additions and 68 deletions

View file

@ -13,39 +13,30 @@
./tests && echo "PASSED" || echo "FAILED" > /dev/null ./tests && echo "PASSED" || echo "FAILED" > /dev/null
``` ```
# development # lnbits development
uncomment following line in docker-compose.yaml, if you wanna use the source code of you current add this ENV variables to your `.env` file
lnbits-legend repo inside the docker ```console
```yaml DEBUG=true
4 volumes: LNBITS_BACKEND_WALLET_CLASS="LndRestWallet"
5 #- ../lnbits:/app/lnbits LND_REST_ENDPOINT="https://localhost:8081/"
LND_REST_CERT="./docker/data/lnd-2/tls.cert"
LND_REST_MACAROON="./docker/data/lnd-2/chain/bitcoin/regtest/admin.macaroon"
``` ```
# usage # usage
build the lnbits docker image
```console
git clone git@github.com:lnbits/lnbits-legend.git ~/repos/lnbits-legend
cd ~/repos/lnbits-legend
docker build -t lnbits-legend .
```
get the regtest enviroment ready get the regtest enviroment ready
```console ```console
git clone git@github.com:lnbits/legend-regtest-enviroment.git ~/repos/lnbits-legend
mkdir ~/repos/lnbits-legend/docker mkdir ~/repos/lnbits-legend/docker
git clone git@github.com:lnbits/legend-regtest-enviroment.git ~/repos/lnbits-legend/docker
cd ~/repos/lnbits-legend/docker cd ~/repos/lnbits-legend/docker
source docker-scripts.sh chmod +x ./tests
``` ./tests # start the regtest and also run tests
start the regtest
```console
# start docker-compose with logs
lnbits-regtest-start-log
# start docker-compose in background
lnbits-regtest-start
``` ```
usage of the `bitcoin-cli-sim`, `lightning-cli-sim` and `lncli-sim` aliases usage of the `bitcoin-cli-sim`, `lightning-cli-sim` and `lncli-sim` aliases
```console ```console
cd ~/repos/lnbits-legend/docker
source docker-scripts.sh
# use bitcoin core, mine a block # use bitcoin core, mine a block
bitcoin-cli-sim -generate 1 bitcoin-cli-sim -generate 1
@ -59,11 +50,14 @@ lncli-sim 1 newaddr p2wsh
lncli-sim 2 listpeers lncli-sim 2 listpeers
``` ```
# urls for lnbits and mempool # urls
* lnbits: http://localhost:5000/
* mempool: http://localhost:8080/ * mempool: http://localhost:8080/
* boltz api: http://localhost:9001/
* lnd-1 rest: http://localhost:8081/
# lnbits debug log # debugging docker logs
```console ```console
docker logs lnbits-legend-lnbits-1 -f docker logs lnbits-legend-boltz-1 -f
docker logs lnbits-legend-clightning-1-1 -f
docker logs lnbits-legend-lnd-2-1 -f
``` ```

View file

@ -1,30 +1,5 @@
version: "3.7" version: "3.7"
services: services:
lnbits:
hostname: lnbits
depends_on:
- boltz
- mempool-api
- lnd-2
image: lnbits-legend
restart: on-failure
user: "0:0"
entrypoint: "sh -c 'sleep 30; uvicorn lnbits.__main__:app --port 5000 --host lnbits --reload'"
environment:
HOST: lnbits
DEBUG: true
LNBITS_BACKEND_WALLET_CLASS: "LndRestWallet"
LNBITS_DATA_FOLDER: "./data"
LND_REST_ENDPOINT: "https://lnd-2:8081/"
LND_REST_CERT: "./lnd/tls.cert"
LND_REST_MACAROON: "./lnd/data/chain/bitcoin/regtest/admin.macaroon"
ports:
- 5000:5000
volumes:
#- ../lnbits:/app/lnbits
- lnbits-data:/app/data
- ./data/lnd-2:/app/lnd:uid=1000,gid=1000
boltz: boltz:
hostname: boltz hostname: boltz
depends_on: depends_on:
@ -156,6 +131,3 @@ services:
MYSQL_PASSWORD: "mempool" MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin" MYSQL_ROOT_PASSWORD: "admin"
image: mariadb:10.5.8 image: mariadb:10.5.8
volumes:
lnbits-data:

View file

@ -75,7 +75,6 @@ lnbits-regtest-init(){
lnbits-bitcoin-init lnbits-bitcoin-init
lnbits-lightning-sync lnbits-lightning-sync
lnbits-lightning-init lnbits-lightning-init
wait-for-lnbits
} }
lnbits-lightning-sync(){ lnbits-lightning-sync(){
@ -143,18 +142,6 @@ lnbits-lightning-init(){
} }
wait-for-lnbits(){
while true; do
statuscode=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:5000")
if [[ "$statuscode" == "200" ]]; then
break
echo "lnbits is online!"
fi
echo "waiting for lnbits to come online..."
sleep 1
done
}
wait-for-lnd-channel(){ wait-for-lnd-channel(){
while true; do while true; do
pending=$(lncli-sim $1 pendingchannels | jq -r '.pending_open_channels | length') pending=$(lncli-sim $1 pendingchannels | jq -r '.pending_open_channels | length')

1
tests
View file

@ -34,7 +34,6 @@ echo ""
run "boltz service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:9001/version") run "boltz service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:9001/version")
run "mempool service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:8080/") run "mempool service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:8080/")
run "lnbits service status" "200" $(curl -s -o /dev/null -w "%{http_code}" "http://localhost:5000")
for i in 1 2; do for i in 1 2; do
run "lnd-$i .synced_to_chain" "true" $(lncli-sim $i getinfo | jq -r ".synced_to_chain") run "lnd-$i .synced_to_chain" "true" $(lncli-sim $i getinfo | jq -r ".synced_to_chain")
run "lnd-$i utxo count" $utxos $(lncli-sim $i listunspent | jq -r ".utxos | length") run "lnd-$i utxo count" $utxos $(lncli-sim $i listunspent | jq -r ".utxos | length")