diff --git a/.gitignore b/.gitignore index ac8c265..08b009f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ test-reports *.pyc *.env .env +.venv venv *.sqlite3 diff --git a/Dockerfile b/Dockerfile index 997b53e..b9ef23d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.7 +FROM python:3.8-slim WORKDIR /app COPY requirements.txt /app/ RUN pip install --no-cache-dir -q -r requirements.txt +RUN pip install --no-cache-dir -q gunicorn gevent COPY . /app EXPOSE 5000 diff --git a/Pipfile b/Pipfile index 5794da8..5c5ff97 100644 --- a/Pipfile +++ b/Pipfile @@ -16,14 +16,12 @@ flask-assets = "*" flask-compress = "*" flask-cors = "*" flask-talisman = "*" -gevent = "==20.5.0" -gunicorn = "*" pyscss = "*" requests = "*" shortuuid = "*" [dev-packages] -black = "==19.10b0" +black = "==20.8b1" flake8 = "*" flake8-mypy = "*" pytest = "*" diff --git a/Pipfile.lock b/Pipfile.lock index c6debfc..2b7566c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "23cccdbeebec7b62d7e7d1c9975bc21d4ad6683d9c24c37c10120a3ed7a44d96" + "sha256": "d21f745fb8f799aaca868b4c97000f31e455063a8241366b1e0b0cd381489a0e" }, "pipfile-spec": 6, "requires": { @@ -139,65 +139,6 @@ "index": "pypi", "version": "==0.7.0" }, - "gevent": { - "hashes": [ - "sha256:00b03601b8dd1ee2aa07811cb60a4befe36173b15d91c6e207e37f8d77dd6fac", - "sha256:0acc15ba2ac2a555529ad82d5a28fc85dbb6b2ff947657d67bebfd352e2b5c14", - "sha256:15eae3cd450dac7dae7f4ac59e01db1378965c9ef565c39c5ae78c5a888f9ac9", - "sha256:1dc7f1f6bc1f67d625e4272b01e717eba0b4fa024d2ff7934c8d320674d6f7fa", - "sha256:1dd95433be45e1115053878366e3f5332ae99c39cb345be23851327c062b9f4a", - "sha256:28b7d83b4327ceb79668eca2049bf4b9ce66d5ace18a88335e3035b573f889fd", - "sha256:31dc5d4ab8172cc00c4ff17cb18edee633babd961f64bf54214244d769bc3a74", - "sha256:38db524ea88d81d596b2cbb6948fced26654a15fec40ea4529224e239a6f45e8", - "sha256:3ff477b6d275396123faf8ce2d5b82f96d85ba264e0b9d4b56a2bac49d1b9adc", - "sha256:4d2729dd4bf9c4d0f29482f53cdf9fc90a498aebb5cd7ae8b45d35657437d2ac", - "sha256:52e5cd607749ed3b8aa0272cacf2c11deec61fca4c3bec57a9fea8c49316627d", - "sha256:5c604179cebcc57f10505d8db177b92a715907815a464b066e7eba322d1c33ac", - "sha256:88c76df4967c5229f853aa67ad1b394d9e4f985b0359c9bc9879416bba3e7c68", - "sha256:929c33df8e9bcbe31906024fcd21580bd018196dbd3249eb5b2f19d63e11092d", - "sha256:92edc18a357473e01a4e4a82c073ed3c99ceca6e3ce93c23668dd4a2401f07dc", - "sha256:937d36730f2b0dee3387712074b1f15b802e2e074a3d7c6dcaf70521236d607c", - "sha256:9b4e940fc6071afebb86ba5f48dbb5f1fc3cb96ebeb8cf145eb5b499e9c6ee33", - "sha256:a7805934e8ce81610b61f806572c3d504cedd698cc8c9460d78d2893ba598c4a", - "sha256:d07a2afe4215731eb57d5b257a2e7e7e170d8a7ae1f02f6d0682cd3403debea9", - "sha256:e01d5373528e4ebdde66dc47a608d225fa3c4408ccd828d26c49b7ff75d82bd9", - "sha256:efd9546468502a30ddd4699c3124ccb9d3099130f9b5ae1e2a54ad5b46e86120", - "sha256:fcb64f3a28420d1b872b7ef41b12e8a1a4dcadfc8eff3c09993ab0cdf52584a1" - ], - "index": "pypi", - "version": "==20.5.0" - }, - "greenlet": { - "hashes": [ - "sha256:1000038ba0ea9032948e2156a9c15f5686f36945e8f9906e6b8db49f358e7b52", - "sha256:133ba06bad4e5f2f8bf6a0ac434e0fd686df749a86b3478903b92ec3a9c0c90b", - "sha256:1429dc183b36ec972055e13250d96e174491559433eb3061691b446899b87384", - "sha256:1b805231bfb7b2900a16638c3c8b45c694334c811f84463e52451e00c9412691", - "sha256:3a35e33902b2e6079949feed7a2dafa5ac6f019da97bd255842bb22de3c11bf5", - "sha256:5ea034d040e6ab1d2ae04ab05a3f37dbd719c4dee3804b13903d4cc794b1336e", - "sha256:682328aa576ec393c1872615bcb877cf32d800d4a2f150e1a5dc7e56644010b1", - "sha256:6e06eac722676797e8fce4adb8ad3dc57a1bb3adfb0dd3fdf8306c055a38456c", - "sha256:7eed31f4efc8356e200568ba05ad645525f1fbd8674f1e5be61a493e715e3873", - "sha256:80cb0380838bf4e48da6adedb0c7cd060c187bb4a75f67a5aa9ec33689b84872", - "sha256:b0b2a984bbfc543d144d88caad6cc7ff4a71be77102014bd617bd88cfb038727", - "sha256:c196a5394c56352e21cb7224739c6dd0075b69dd56f758505951d1d8d68cf8a9", - "sha256:d83c1d38658b0f81c282b41238092ed89d8f93c6e342224ab73fb39e16848721", - "sha256:df7de669cbf21de4b04a3ffc9920bc8426cab4c61365fa84d79bf97401a8bef7", - "sha256:e5db19d4a7d41bbeb3dd89b49fc1bc7e6e515b51bbf32589c618655a0ebe0bf0", - "sha256:e695ac8c3efe124d998230b219eb51afb6ef10524a50b3c45109c4b77a8a3a92", - "sha256:eac2a3f659d5f41d6bbfb6a97733bc7800ea5e906dc873732e00cebb98cec9e4" - ], - "markers": "platform_python_implementation == 'CPython'", - "version": "==0.4.16" - }, - "gunicorn": { - "hashes": [ - "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", - "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" - ], - "index": "pypi", - "version": "==20.0.4" - }, "idna": { "hashes": [ "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6", @@ -364,11 +305,11 @@ }, "black": { "hashes": [ - "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b", - "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539" + "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea", + "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b" ], "index": "pypi", - "version": "==19.10b0" + "version": "==20.8b1" }, "click": { "hashes": [ @@ -627,7 +568,6 @@ "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f" ], - "markers": "python_version < '3.8'", "version": "==3.7.4.3" } } diff --git a/README.md b/README.md index dc70c3b..2eb4899 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ LNbits [![github-actions-badge]][github-actions] [![codecov-badge]][codecov] [![license-badge]](LICENSE) +[![docs-badge]][docs] + ![Lightning network wallet](https://i.imgur.com/EHvK6Lq.png) @@ -65,6 +67,9 @@ See the [development docs](docs/devs/installation.md) for details on installatio If you like this project and might even use or extend it, why not [send some tip love](https://lnbits.com/paywall/GAqKguK5S8f6w5VNjS9DfK)! + +[docs]: https://lnbits.org/ +[docs-badge]: https://img.shields.io/badge/docs-lnbits.org-673ab7.svg [github-actions]: https://github.com/lnbits/lnbits/actions [github-actions-badge]: https://github.com/lnbits/lnbits/workflows/test%20suite/badge.svg [codecov]: https://codecov.io/gh/lnbits/lnbits diff --git a/docs/devs/development.md b/docs/devs/development.md index b5db7c7..5a8cd21 100644 --- a/docs/devs/development.md +++ b/docs/devs/development.md @@ -1,7 +1,7 @@ --- layout: default title: For developers -nav_order: 3 +nav_order: 4 has_children: true --- diff --git a/docs/devs/installation.md b/docs/devs/installation.md index e28bc95..a81b6e0 100644 --- a/docs/devs/installation.md +++ b/docs/devs/installation.md @@ -22,24 +22,27 @@ While in development, you will need to install all dependencies: $ pipenv shell $ pipenv install --dev ``` + If you wish to use a version of Python higher than 3.7: + ```sh $ pipenv --python 3.8 install --dev ``` + You will need to set the variables in `.env.example`, and rename the file to `.env`. ![Files](https://i.imgur.com/ri2zOe8.png) -You might also need to install additional packages, depending on the [backend wallets](../guide/wallets.md) you configured. +You might also need to install additional packages, depending on the [backend wallet](../guide/wallets.md) you use. E.g. when you want to use LND you have to `pipenv run pip install lnd-grpc`. -Take a look at [Polar](https://lightningpolar.com/) for an excellent way of spinning up a Lightning Network dev environment. +Take a look at [Polar][polar] for an excellent way of spinning up a Lightning Network dev environment. Running the server ------------------ -LNbits uses [Flask](http://flask.pocoo.org/) as an application server. +LNbits uses [Flask][flask] as an application server. ```sh $ pipenv run flask migrate @@ -49,10 +52,14 @@ $ pipenv run flask run There is an environment variable called `FLASK_ENV` that has to be set to `development` if you want to run Flask in debug mode with autoreload -[pipenv]: https://pipenv.pypa.io/ - Frontend -------- -The views are build using [Vue.js and Quasar](https://quasar.dev/start/how-to-use-vue). +The frontend uses [Vue.js and Quasar][quasar]. + + +[flask]: http://flask.pocoo.org/ +[pipenv]: https://pipenv.pypa.io/ +[polar]: https://lightningpolar.com/ +[quasar]: https://quasar.dev/start/how-to-use-vue diff --git a/docs/guide/installation.md b/docs/guide/installation.md new file mode 100644 index 0000000..0b19ce1 --- /dev/null +++ b/docs/guide/installation.md @@ -0,0 +1,34 @@ +--- +layout: default +title: Basic installation +nav_order: 2 +--- + + +Basic installation +================== + +Download this repo and install the dependencies: + +```sh +$ git clone https://github.com/lnbits/lnbits.git +$ python3 -m venv .venv +$ source ./.venv/bin/activate +(.venv) $ pip install -r requirements.txt +``` + +You will need to set the variables in `.env.example`, and rename the file to `.env`. + +Run the migrations and the Flask server: + +```sh +(.venv) $ flask migrate +(.venv) $ flask run +``` + +You might also need to install additional packages, depending on the [backend wallet](./wallets.md) you use. +E.g. when you want to use LND you have to run: + +```sh +(.venv) $ pip install lnd-grpc +``` diff --git a/docs/guide/wallets.md b/docs/guide/wallets.md index 3eb5ea8..986711f 100644 --- a/docs/guide/wallets.md +++ b/docs/guide/wallets.md @@ -1,7 +1,7 @@ --- layout: default title: Backend wallets -nav_order: 2 +nav_order: 3 --- @@ -53,7 +53,7 @@ Using this wallet requires the installation of the `lnd-grpc` Python package. ### LNbits - `LNBITS_BACKEND_WALLET_CLASS`: **LNbitsWallet** -- `LNBITS_ENDPOINT`: ex. https://lnbits.com +- `LNBITS_ENDPOINT`: e.g. https://lnbits.com - `LNBITS_ADMIN_KEY`: apiKey - `LNBITS_INVOICE_KEY`: apiKey @@ -61,7 +61,7 @@ Using this wallet requires the installation of the `lnd-grpc` Python package. ### LNPay - `LNBITS_BACKEND_WALLET_CLASS`: **LNPayWallet** -- `LNPAY_API_ENDPOINT`: ex. https://lnpay.co/v1/ +- `LNPAY_API_ENDPOINT`: https://lnpay.co/v1/ - `LNPAY_API_KEY`: apiKey - `LNPAY_ADMIN_KEY`: apiKey - `LNPAY_INVOICE_KEY`: apiKey @@ -71,7 +71,7 @@ Using this wallet requires the installation of the `lnd-grpc` Python package. ### lntxbot - `LNBITS_BACKEND_WALLET_CLASS`: **LntxbotWallet** -- `LNTXBOT_API_ENDPOINT`: ex. https://lntxbot.bigsun.xyz/ +- `LNTXBOT_API_ENDPOINT`: https://lntxbot.bigsun.xyz/ - `LNTXBOT_ADMIN_KEY`: apiKey - `LNTXBOT_INVOICE_KEY`: apiKey @@ -79,6 +79,6 @@ Using this wallet requires the installation of the `lnd-grpc` Python package. ### OpenNode - `LNBITS_BACKEND_WALLET_CLASS`: **OpenNodeWallet** -- `OPENNODE_API_ENDPOINT`: ex. https://api.opennode.com/ +- `OPENNODE_API_ENDPOINT`: https://api.opennode.com/ - `OPENNODE_ADMIN_KEY`: apiKey - `OPENNODE_INVOICE_KEY`: apiKey diff --git a/lnbits/app.json b/lnbits/app.json deleted file mode 100644 index 72575c6..0000000 --- a/lnbits/app.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "scripts": { - "dokku": { - "predeploy": "flask migrate" - } - } -} diff --git a/requirements.txt b/requirements.txt index 1818b58..e81d766 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,9 +11,6 @@ flask-compress==1.5.0 flask-cors==3.0.9 flask-talisman==0.7.0 flask==1.1.2 -gevent==20.5.0 -greenlet==0.4.16; platform_python_implementation == 'CPython' -gunicorn==20.0.4 idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' itsdangerous==1.1.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' jinja2==2.11.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'