diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 411cbdf..8d6ad84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/README.md b/README.md index 4dae852..2256095 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/docker-compose.yml b/docker-compose.yml index 88d0832..caaffe7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/docker-scripts.sh b/docker-scripts.sh index d72fd37..fe190a6 100644 --- a/docker-scripts.sh +++ b/docker-scripts.sh @@ -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') diff --git a/tests b/tests index 38cb4af..3bb0e22 100755 --- a/tests +++ b/tests @@ -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")