diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a765d82 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,42 @@ +--- +name: Bug report +about: Create a report to help us improve +title: +labels: +assignees: +--- + + + + +**Describe the bug** + + + +**To Reproduce** + + + +**Expected behavior** + + + +**Screenshots** + + + +**DAppNode version:** + + + +- Package version: +- OS: +- Browser + +**Additional context** + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..11bbebf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,26 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "" +labels: "" +assignees: "" +--- + + + + +**Is your feature request related to a problem? Please describe.** + + + +**Describe the solution you'd like** + + + +**Describe alternatives you've considered** + + + +**Additional context** + + diff --git a/.github/workflows/CODEOWNERS b/.github/workflows/CODEOWNERS new file mode 100644 index 0000000..3d8973b --- /dev/null +++ b/.github/workflows/CODEOWNERS @@ -0,0 +1,7 @@ +# These owners will be the default owners for everything in the repo. Unless a later match takes precedence, +# They will be requested for review when someone opens a pull request. +* @dapplion @eduadiez @pablomendezroyo + +# Order is important; the last matching pattern takes the most precedence. When someone opens a pull request that only +# modifies md files, only md owners and not the global owner(s) will be requested for a review. +*.md @Pol-Lanski @dapplion @eduadiez @pablomendezroyo \ No newline at end of file diff --git a/.gitignore b/.gitignore index cc73833..874d8d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.tar.xz -build_* \ No newline at end of file +build_* +build \ No newline at end of file diff --git a/README.md b/README.md index e086964..4631391 100644 --- a/README.md +++ b/README.md @@ -18,74 +18,22 @@ For many reasons we don't save any seed to restore the wallet, and having an up # Backup LND data LND data is stored permanently in a docker volume, but it is recommended to save it apart in case of an update or migration. -Follow this steps: -``` -docker run --rm --volumes-from DAppNodePackage-lightning-network.dnp.dappnode.eth -v $(pwd):/backup alpine tar cvzf /backup/backup_lnd.tar.gz /root/.lnd -``` -A file named `backup_lnd.tar.gz` will be created in your current path. - -To restore it, proceed as follows: -``` -docker run --rm --volumes-from DAppNodePackage-lightning-network.dnp.dappnode.eth -v $(pwd):/backup alpine sh -c "cd /root/.lnd && tar xvzf /backup/backup_lnd.tar.gz --strip 2" - -``` -then restart the package from the admin interface. - - -# Prerequisites - -- git - - Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) commandline tool. - -- docker - - Install [docker](https://docs.docker.com/engine/installation). The community edition (docker-ce) will work. In Linux make sure you grant permissions to the current user to use docker by adding current user to docker group, `sudo usermod -aG docker $USER`. Once you update the users group, exit from the current terminal and open a new one to make effect. - -- docker-compose - - Install [docker-compose](https://docs.docker.com/compose/install) - -**Note**: Make sure you can run `git`, `docker ps`, `docker-compose` without any issue and without sudo command. - - -## Building - -`docker-compose build` - -## Running - -### Start - -`docker-compose up -d` - -### View logs - -`docker-compose logs -f` - -### Stop +When you enter the LN package (under Packages/ My Packages) you will see a Backup tab -`docker-compose down` +

-## Environment variables +Hit the "Backup now" button and select where do you want to keep your backup file safe. A tar.xz file will be downloaded to the selected path. -You can edit the `docker-compose.yml` and add extra options, such a: +# Restore LND data -| name | default | -| ---- | ------- | -| RPCUSER | dappnode | -| RPCPASS | dappnode | -| BITCOIND_HOST | my.bitcoin.dnp.dappnode.eth | -| NETWORK | mainnet | -| ALIAS | | -| COLOR | | -| EXT_IP | | +If anything happens with your LN node and you have your backup you can always restore it from the ADMIN UI. Just go to Packages / My Packages and select the LN package and the backup tab. Aside the backup button you will see a "Restore" button. -## License +Just hit that sweet restore button, select your tar.xz backup file and confirm. -This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details +

+After the backup file is uploaded your LN node is restored. # Using the LN package @@ -97,7 +45,7 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI * You need to have the Bitcoin node package (without pruning) installed and fully synced for the package to work properly. You don't need to wait for the Bitcoin Core node to be fully synced to install the LN package, but it won't be functional until the node is synced. -* The private keys of your LN wallet are stored in your LN node data volume. **Please follow the guide about backups below in this document to prevent loss of funds. We don't offer a seed backup mechanism so this is the only way to recover your funds in case something goes wrong**. +* The private keys of your LN wallet are stored in your LN node data volume. **Please follow the guide about backups in this document to prevent loss of funds. We don't offer a seed backup mechanism so this is the only way to recover your funds in case something goes wrong**. * When installing LN in DAppNode there will be two sets of username/password: * One to connect to the Bitcoin node, RPCUSER and RPCPASS (make sure they are the same as the Bitcoin package) and @@ -106,7 +54,7 @@ This project is licensed under the GNU General Public License v3.0 - see the [LI * You can connect your favourite LN mobile wallet by opening a private channel with your node. -* When updating this package, volumes will not be affected. You can access an updated version of your LN node witbout risk of losing any funds. Do not remove the volume though, or you will lose the funds on your node if you have not followed ths instructions for backup. +* When updating this package, volumes will not be affected. You can access an updated version of your LN node witbout risk of losing any funds. Do not remove the volume though, or you will lose the funds on your node if you have not followed the backup instructions. ## Accessing the ADMIN UI @@ -118,7 +66,7 @@ Usually Lightning Network applications require files called *macaroons* for auth To download the admin macaroon, you should go to the Admin panel of DAppnode: -Packages -> lightning-network -> File manager +Packages -> My packages -> Lightning-Network -> File manager Then input in the "Download from DNP" field: @@ -149,5 +97,56 @@ Joule is an extension available for many browsers which lets you use your node t +# Prerequisites + +- git + + Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) commandline tool. + +- docker + + Install [docker](https://docs.docker.com/engine/installation). The community edition (docker-ce) will work. In Linux make sure you grant permissions to the current user to use docker by adding current user to docker group, `sudo usermod -aG docker $USER`. Once you update the users group, exit from the current terminal and open a new one to make effect. + +- docker-compose + + Install [docker-compose](https://docs.docker.com/compose/install) + +**Note**: Make sure you can run `git`, `docker ps`, `docker-compose` without any issue and without sudo command. + + +## Building + +`docker-compose build` + +## Running + +### Start + +`docker-compose up -d` + +### View logs + +`docker-compose logs -f` + +### Stop + +`docker-compose down` + +## Environment variables + +You can edit the `docker-compose.yml` and add extra options, such a: + +| name | default | +| ---- | ------- | +| RPCUSER | dappnode | +| RPCPASS | dappnode | +| BITCOIND_HOST | my.bitcoin.dnp.dappnode.eth | +| NETWORK | mainnet | +| ALIAS | | +| COLOR | | +| EXT_IP | | +## License + +This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details diff --git a/avatar-lightning-network.png b/avatar-lightning-network.png new file mode 100644 index 0000000..a277ca3 Binary files /dev/null and b/avatar-lightning-network.png differ diff --git a/build/src/scripts/start-rtl.sh b/build/src/scripts/start-rtl.sh deleted file mode 100755 index b47bdae..0000000 --- a/build/src/scripts/start-rtl.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Configure settings from env vars -envsubst < "source_RTL.conf" > "RTL.conf" - -node rtl \ No newline at end of file diff --git a/dappnode_package.json b/dappnode_package.json index 4553f12..d372366 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -1,43 +1,54 @@ { "name": "lightning-network.dnp.dappnode.eth", - "version": "0.0.2", - "description": "The Lightning Network DAppNodePackage (lnd + RTL). The Lightning Network is a decentralized system for instant, high-volume micropayments that removes the risk of delegating custody of funds to trusted third parties.", - "avatar": "/ipfs/QmVrjV1ANxjYVqRJzycYKcCUAH8nU337UsMVir1CnZYNa8", + "version": "0.4.4", + "upstreamVersion": "v0.14.1-beta", + "shortDescription": "Scalable, instant Bitcoin transactions", + "description": "The Lightning Network DAppNodePackage (lnd + RTL). The Lightning Network is a decentralized system for instant, high-volume micropayments that remove the risk of delegating custody of funds to trusted third parties. \n\n\n **Getting started** \n\n Go to the [Lightning Network DAppNode Package readme](https://github.com/dappnode/DAppNodePackage-LightningNetwork#readme) to learn how to get started and safely backup your data.", "type": "service", - "image": { - "path": "", - "hash": "", - "size": "", - "ports": [ - "9735:9735" - ], - "volumes": [ - "lndconfig_data:/root/.lnd/" - ], - "restart": "always", - "environment": [ - "RTL_PASSWORD=changeme", - "RPCUSER=dappnode", - "RPCPASS=dappnode", - "BITCOIND_HOST=my.bitcoin.dnp.dappnode.eth", - "NETWORK=mainnet", - "ALIAS=", - "COLOR=#5ACDC5", - "EXT_IP=" - ] + "dependencies": { + "bitcoin.dnp.dappnode.eth": "latest" + }, + "backup": [ + { + "name": "rtl-channel", + "path": "/rtl/backup/" + }, + { + "name": "lnd-channel", + "path": "/root/.lnd/data/chain/bitcoin/mainnet/channel.backup" + }, + { + "name": "wallet", + "path": "/root/.lnd/data/chain/bitcoin/mainnet/wallet.db" + } + ], + "style": { + "featuredBackground": "linear-gradient(67deg, #090909, #2f1354)", + "featuredColor": "#eee" }, "author": "DAppNode Association (https://github.com/dappnode)", "contributors": [ "Abel Boldú (@vdo)", "Eduardo Antuña (https://github.com/eduadiez)" ], - "keywords": ["bitcoin", "btc", "lightning network", "lnd"], - "homepage": { - "homepage": "https://github.com/dappnode/DAppNodePackage-LightningNetwork#readme" + "categories": [ + "Payment channels", + "Economic incentive" + ], + "keywords": [ + "bitcoin", + "btc", + "lightning network", + "lnd" + ], + "links": { + "homepage": "https://github.com/dappnode/DAppNodePackage-LightningNetwork#readme", + "ui": "http://lightning-network.dappnode", + "api": "http://lightning-network.dappnode:8080" }, "repository": { "type": "git", - "url": "git+https://github.com/dappnode/DAppNodePackage-LightningNetwork.git" + "url": "https://github.com/dappnode/DAppNodePackage-LightningNetwork.git" }, "bugs": { "url": "https://github.com/dappnode/DAppNodePackage-LightningNetwork/issues" @@ -45,8 +56,5 @@ "disclaimer": { "message": "This software is experimental, presented 'as is' and inherently carries risks. By installing it, you acknowledge that DAppNode Association has done its best to mitigate these risks and accept to waive any liability or responsibility for DAppNode in case of any shortage, discrepancy, damage, loss or destruction of any digital asset managed within this DAppNode package.\n\nThis package stores private keys, which will be stored in your DAppNode. Neither DAppNode Association nor the developers of this software can have access to your private key, nor help you recover it if you lose it. \n\nYou are solely responsible for keeping your private keys and password safe and to perform secure backups, as well as to restrict access to your computer and other equipment. To the extent permitted by applicable law, you agree to be responsible for all activities that have been conducted from your account. You must take all necessary steps to ensure that your private key, password, and/or recovery phrase remain confidential and secured." }, - "license": "GPL-3.0", - "dependencies": { - "bitcoin.dnp.dappnode.eth": "latest" - } -} \ No newline at end of file + "license": "GPL-3.0" +} diff --git a/docker-compose.yml b/docker-compose.yml index 3b62b53..f92f40f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,23 @@ -version: '3.4' +version: "3.4" services: - lightning-network.dnp.dappnode.eth: - image: 'lightning-network.dnp.dappnode.eth:0.0.1' - build: ./build - volumes: - - 'lndconfig_data:/root/.lnd/' - ports: - - '9735:9735' - environment: - - RTL_PASSWORD=changeme - - RPCUSER=dappnode - - RPCPASS=dappnode - - BITCOIND_HOST=my.bitcoin.dnp.dappnode.eth - - NETWORK=mainnet - - ALIAS= - - COLOR=#5ACDC5 - - EXT_IP= + lightning-network.dnp.dappnode.eth: + image: "lightning-network.dnp.dappnode.eth:0.4.4" + build: ./src + volumes: + - "lndconfig_data:/root/.lnd/" + - "lndconfig_backup:/rtl/backup/" + ports: + - "9735:9735" + environment: + - APP_PASSWORD=changeme + - RPCUSER=dappnode + - RPCPASS=dappnode + - BITCOIND_HOST=bitcoin.dappnode + - NETWORK=mainnet + - ALIAS= + - COLOR=#5ACDC5 + - EXT_IP= + restart: always volumes: - lndconfig_data: {} + lndconfig_data: {} + lndconfig_backup: {} diff --git a/lnd.png b/lnd.png deleted file mode 100644 index bfffd2e..0000000 Binary files a/lnd.png and /dev/null differ diff --git a/setup-target.json b/setup-target.json new file mode 100644 index 0000000..873adb6 --- /dev/null +++ b/setup-target.json @@ -0,0 +1,10 @@ +{ + "rtl_password": { + "type": "environment", + "name": "APP_PASSWORD" + }, + "alias": { + "type": "environment", + "name": "ALIAS" + } +} diff --git a/setup-ui.json b/setup-ui.json new file mode 100644 index 0000000..7d0dd3b --- /dev/null +++ b/setup-ui.json @@ -0,0 +1,6 @@ +{ + "ui:order": ["rtl_password","alias"], + "rtl_password": { + "ui:widget": "password" + } +} diff --git a/setup.schema.json b/setup.schema.json new file mode 100644 index 0000000..ecd2aa2 --- /dev/null +++ b/setup.schema.json @@ -0,0 +1,17 @@ +{ + "description": "# Want to run Lightning Network on DAppNode?\n\nGreat! That's probably why you are here.\n\nThis wizard will help you to configure your node", + "type": "object", + "properties": { + "rtl_password": { + "type": "string", + "title": "Password", + "description": "Your password for Ride The Lightning Web UI" + }, + "alias": { + "type": "string", + "title": "Alias", + "description": "Alias name for your node (will be public)" + } + }, + "required": ["rtl_password"] +} diff --git a/build/Dockerfile b/src/Dockerfile similarity index 62% rename from build/Dockerfile rename to src/Dockerfile index 548922f..25d203d 100644 --- a/build/Dockerfile +++ b/src/Dockerfile @@ -1,7 +1,7 @@ -FROM node:10.15.3-alpine as build +FROM node:10.16.0-alpine as build -ENV LND_VERSION "v0.7.0-beta" -ENV RTL_TAG "v0.4.2" +ENV LND_VERSION "v0.14.1-beta" +ENV RTL_TAG "v0.12.1" RUN apk add --no-cache wget ca-certificates \ && wget https://github.com/lightningnetwork/lnd/releases/download/${LND_VERSION}/lnd-linux-amd64-${LND_VERSION}.tar.gz \ @@ -13,31 +13,35 @@ RUN apk add --no-cache wget ca-certificates \ RUN apk add --no-cache \ bash curl openssl supervisor git make g++ -RUN git clone -b $RTL_TAG https://github.com/ShahanaFarooqui/RTL.git /rtl +RUN git clone -b $RTL_TAG https://github.com/Ride-The-Lightning/RTL.git /rtl WORKDIR /rtl RUN npm install -RUN rm -rf ./node_modules/* && npm install --only=production +RUN rm -rf ./node_modules/* && npm install --only=production && npm install @types/node FROM alpine WORKDIR /rtl +ENV CHANNEL_BACKUP_PATH /root/.lnd + # Add requirements RUN apk add --no-cache supervisor bash curl nodejs openssl gettext COPY --from=build /rtl /rtl COPY --from=build /bin/lnd /bin/lnd +COPY --from=build /bin/lncli /bin/lncli -COPY src/scripts/start-lnd.sh / -COPY src/scripts/start-rtl.sh /rtl -COPY src/config/source_RTL.conf /rtl +COPY scripts/start-lnd.sh / +COPY scripts/start-rtl.sh /rtl +COPY config/source_RTL.conf /rtl +COPY config/source_RTL-Config.json /rtl RUN ln -s /root/.lnd /config RUN mkdir -p /var/log/supervisor -COPY src/config/supervisord.conf / +COPY config/supervisord.conf / # Expose lnd ports (server, rpc). EXPOSE 9735 10009 80 diff --git a/src/config/source_RTL-Config.json b/src/config/source_RTL-Config.json new file mode 100644 index 0000000..9eaa339 --- /dev/null +++ b/src/config/source_RTL-Config.json @@ -0,0 +1,30 @@ +{ + "port": "80", + "defaultNodeIndex": 1, + "SSO": { + "rtlSSO": 0, + "rtlCookiePath": "", + "logoutRedirectLink": "" + }, + "nodes": [ + { + "index": 1, + "lnNode": "Node 1", + "lnImplementation": "LND", + "Authentication": { + "macaroonPath": "/root/.lnd/data/chain/bitcoin/mainnet", + "configPath": "/root/.lnd/lnd.conf" + }, + "Settings": { + "userPersona": "MERCHANT", + "themeMode": "NIGHT", + "themeColor": "TEAL", + "channelBackupPath": "/root/backup/node-1", + "logLevel": "ERROR", + "lnServerUrl": "https://localhost:8080", + "fiatConversion": false + } + } + ], + "multiPassHashed": "" +} diff --git a/build/src/config/source_RTL.conf b/src/config/source_RTL.conf similarity index 100% rename from build/src/config/source_RTL.conf rename to src/config/source_RTL.conf diff --git a/build/src/config/supervisord.conf b/src/config/supervisord.conf similarity index 100% rename from build/src/config/supervisord.conf rename to src/config/supervisord.conf diff --git a/build/src/scripts/start-lnd.sh b/src/scripts/start-lnd.sh similarity index 100% rename from build/src/scripts/start-lnd.sh rename to src/scripts/start-lnd.sh diff --git a/src/scripts/start-rtl.sh b/src/scripts/start-rtl.sh new file mode 100755 index 0000000..d34f4e7 --- /dev/null +++ b/src/scripts/start-rtl.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e + +# Create restore symlink +if [ ! -L /rtl/backup/restore ]; then + ln -s /rtl/backup /rtl/backup/restore +fi + +# Configure settings from env vars +envsubst < "source_RTL-Config.json" > "RTL-Config.json" + +envsubst < "source_RTL.conf" > "RTL.conf" + +exec node rtl