Merge pull request #4 from lnbits/removelnbits

remove lnbits from regtest
This commit is contained in:
dni ⚡ 2022-07-28 11:10:03 +02:00 committed by GitHub
commit 381fead75f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 72 deletions

View file

@ -7,9 +7,5 @@ jobs:
- uses: actions/checkout@v2
- name: Run tests
run: |
git clone https://github.com/lnbits/lnbits-legend
cd lnbits-legend
docker build -t lnbits-legend .
cd ..
chmod +x ./tests
./tests

View file

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

View file

@ -75,7 +75,6 @@ lnbits-regtest-init(){
lnbits-bitcoin-init
lnbits-lightning-sync
lnbits-lightning-init
wait-for-lnbits
}
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(){
while true; do
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 "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
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")