diff --git a/.dockerignore b/.dockerignore index edbbf189..e34785c0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,6 @@ data docker docs tests -venv lnbits/static/css/* lnbits/static/bundle.js diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cb56341..20072ccf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,29 +3,6 @@ name: tests on: [push, pull_request] jobs: - venv-sqlite: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9"] - poetry-version: ["1.3.1"] - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - env: - VIRTUAL_ENV: ./venv - PATH: ${{ env.VIRTUAL_ENV }}/bin:${{ env.PATH }} - run: | - python -m venv ${{ env.VIRTUAL_ENV }} - ./venv/bin/python -m pip install --upgrade pip - ./venv/bin/pip install -r requirements.txt - ./venv/bin/pip install pytest pytest-asyncio pytest-cov requests mock - - name: Run tests - run: make test-venv sqlite: runs-on: ubuntu-latest strategy: diff --git a/.gitignore b/.gitignore index e33b1579..3957a62c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,6 @@ tests/data/*.sqlite3 *.pyc *.env .env -.venv -venv data *.sqlite3 diff --git a/Makefile b/Makefile index 67f9c250..771f9911 100644 --- a/Makefile +++ b/Makefile @@ -50,14 +50,6 @@ test-real-wallet: DEBUG=true \ poetry run pytest -test-venv: - LNBITS_BACKEND_WALLET_CLASS="FakeWallet" \ - FAKE_WALLET_SECRET="ToTheMoon1" \ - LNBITS_DATA_FOLDER="./tests/data" \ - PYTHONUNBUFFERED=1 \ - DEBUG=true \ - ./venv/bin/pytest --durations=1 -s --cov=lnbits --cov-report=xml tests - test-migration: rm -rf ./migration-data mkdir -p ./migration-data diff --git a/docs/devs/extensions.md b/docs/devs/extensions.md index 0dc75ddd..83ad1cb4 100644 --- a/docs/devs/extensions.md +++ b/docs/devs/extensions.md @@ -31,18 +31,16 @@ Going over the example extension's structure: Adding new dependencies ----------------------- -DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are available in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others. +DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are availabe in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others. -If for some reason your extensions must have a new python package to work, and its needs are not met in `pyproject.toml`, you can add a new package using `venv`, or `poerty`: +If for some reason your extensions must have a new python package to work, and its nees are not met in `pyproject.toml`, you can add a new package using `poerty`: ```sh $ poetry add -# or -$ ./venv/bin/pip install ``` **But we need an extra step to make sure LNbits doesn't break in production.** -Dependencies need to be added to `pyproject.toml` and `requirements.txt`, then tested by running on `venv` and `poetry` compatibility can be tested with `nix build .#checks.x86_64-linux.vmTest`. +Dependencies need to be added to `pyproject.toml`, then tested by running on `poetry` compatability can be tested with `nix build .#checks.x86_64-linux.vmTest`. SQLite to PostgreSQL migration diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 9653f801..04e77746 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -6,7 +6,7 @@ nav_order: 2 # Basic installation -You can choose between four package managers, `poetry`, `nix` and `venv`. +You can choose between four package managers, `poetry` and `nix` By default, LNbits will use SQLite as its database. You can also use PostgreSQL which is recommended for applications with a high load (see guide below). @@ -80,30 +80,8 @@ mkdir data LNBITS_DATA_FOLDER=data LNBITS_BACKEND_WALLET_CLASS=LNbitsWallet LNBITS_ENDPOINT=https://legend.lnbits.com LNBITS_KEY=7b1a78d6c78f48b09a202f2dcb2d22eb ./result/bin/lnbits --port 9000 ``` -## Option 3: venv -```sh -git clone https://github.com/lnbits/lnbits.git -cd lnbits -# ensure you have virtualenv installed, on debian/ubuntu 'apt install python3.9-venv' -python3.9 -m venv venv -# If you have problems here, try `sudo apt install -y pkg-config libpq-dev` -./venv/bin/pip install -r requirements.txt -# create the data folder and the .env file -mkdir data && cp .env.example .env -# build the static files -./venv/bin/python tools/build.py -``` - -#### Running the server - -```sh -./venv/bin/uvicorn lnbits.__main__:app --port 5000 -``` - -If you want to host LNbits on the internet, run with the option `--host 0.0.0.0`. - -## Option 4: Docker +## Option 3: Docker use latest version from docker hub ```sh @@ -122,7 +100,7 @@ mkdir data docker run --detach --publish 5000:5000 --name lnbits --volume ${PWD}/.env:/app/.env --volume ${PWD}/data/:/app/data lnbitsdocker/lnbits-legend ``` -## Option 5: Fly.io +## Option 4: Fly.io Fly.io is a docker container hosting platform that has a generous free tier. You can host LNbits for free on Fly.io for personal use. @@ -210,9 +188,6 @@ sudo apt install python3.9-dev gcc build-essential # if the secp256k1 build fails: # if you used poetry poetry add setuptools wheel - -# if you used venv -./venv/bin/pip install setuptools wheel ``` #### Poetry @@ -433,7 +408,7 @@ mkcert localhost 127.0.0.1 ::1 You can then pass the certificate files to uvicorn when you start LNbits: ```sh -./venv/bin/uvicorn lnbits.__main__:app --host 0.0.0.0 --port 5000 --ssl-keyfile ./key.pem --ssl-certfile ./cert.pem +poetry run uvicorn lnbits.__main__:app --host 0.0.0.0 --port 5000 --ssl-keyfile ./key.pem --ssl-certfile ./cert.pem ``` diff --git a/docs/guide/wallets.md b/docs/guide/wallets.md index a10e09a9..4997bbcd 100644 --- a/docs/guide/wallets.md +++ b/docs/guide/wallets.md @@ -47,7 +47,7 @@ You can also use an AES-encrypted macaroon (more info) instead by using - `LND_GRPC_MACAROON_ENCRYPTED`: eNcRyPtEdMaCaRoOn -To encrypt your macaroon, run `./venv/bin/python lnbits/wallets/macaroon/macaroon.py`. +To encrypt your macaroon, run `poetry run python lnbits/wallets/macaroon/macaroon.py`. ### LNbits @@ -57,7 +57,7 @@ To encrypt your macaroon, run `./venv/bin/python lnbits/wallets/macaroon/macaroo ### LNPay -For the invoice listener to work you have a publicly accessible URL in your LNbits and must set up [LNPay webhooks](https://dashboard.lnpay.co/webhook/) pointing to `/wallet/webhook` with the "Wallet Receive" event and no secret. For example, `https://mylnbits/wallet/webhook` will be the Endpoint Url that gets notified about the payment. +For the invoice listener to work you have a publicly accessible URL in your LNbits and must set up [LNPay webhooks](https://dashboard.lnpay.co/webhook/) pointing to `/wallet/webhook` with the "Wallet Receive" event and no secret. For example, `https://mylnbits/wallet/webhook` will be the Endpoint Url that gets notified about the payment. - `LNBITS_BACKEND_WALLET_CLASS`: **LNPayWallet** - `LNPAY_API_ENDPOINT`: https://api.lnpay.co/v1/ diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8c751fff..00000000 --- a/requirements.txt +++ /dev/null @@ -1,76 +0,0 @@ -anyio==3.6.2 ; python_version >= "3.7" and python_version < "4.0" -asn1crypto==1.5.1 ; python_version >= "3.7" and python_version < "4.0" -async-timeout==4.0.2 ; python_version >= "3.7" and python_version < "4.0" -attrs==22.2.0 ; python_version >= "3.7" and python_version < "4.0" -base58==2.1.1 ; python_version >= "3.7" and python_version < "4.0" -bech32==1.2.0 ; python_version >= "3.7" and python_version < "4.0" -bitstring==3.1.9 ; python_version >= "3.7" and python_version < "4.0" -boltz-client==0.1.3 ; python_version >= "3.7" and python_version < "4.0" -cashu==0.9.0 ; python_version >= "3.7" and python_version < "4.0" -cerberus==1.3.4 ; python_version >= "3.7" and python_version < "4.0" -certifi==2022.12.7 ; python_version >= "3.7" and python_version < "4.0" -cffi==1.15.1 ; python_version >= "3.7" and python_version < "4.0" -charset-normalizer==2.0.12 ; python_version >= "3.7" and python_version < "4.0" -click==8.0.4 ; python_version >= "3.7" and python_version < "4.0" -coincurve==17.0.0 ; python_version >= "3.7" and python_version < "4.0" -colorama==0.4.6 ; python_version >= "3.7" and python_version < "4.0" and platform_system == "Windows" or python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32" -cryptography==36.0.2 ; python_version >= "3.7" and python_version < "4.0" -ecdsa==0.18.0 ; python_version >= "3.7" and python_version < "4.0" -embit==0.4.9 ; python_version >= "3.7" and python_version < "4.0" -enum34==1.1.10 ; python_version >= "3.7" and python_version < "4.0" -environs==9.5.0 ; python_version >= "3.7" and python_version < "4.0" -exceptiongroup==1.1.0 ; python_version >= "3.7" and python_version < "3.11" -fastapi==0.83.0 ; python_version >= "3.7" and python_version < "4.0" -grpcio==1.51.1 ; python_version >= "3.7" and python_version < "4.0" -h11==0.12.0 ; python_version >= "3.7" and python_version < "4.0" -httpcore==0.15.0 ; python_version >= "3.7" and python_version < "4.0" -httpx==0.23.0 ; python_version >= "3.7" and python_version < "4.0" -idna==3.4 ; python_version >= "3.7" and python_version < "4.0" -importlib-metadata==5.2.0 ; python_version >= "3.7" and python_version < "4.0" -iniconfig==2.0.0 ; python_version >= "3.7" and python_version < "4.0" -jinja2==3.0.1 ; python_version >= "3.7" and python_version < "4.0" -lnurl==0.3.6 ; python_version >= "3.7" and python_version < "4.0" -loguru==0.6.0 ; python_version >= "3.7" and python_version < "4.0" -markupsafe==2.1.2 ; python_version >= "3.7" and python_version < "4.0" -marshmallow==3.19.0 ; python_version >= "3.7" and python_version < "4.0" -outcome==1.2.0 ; python_version >= "3.7" and python_version < "4.0" -packaging==23.0 ; python_version >= "3.7" and python_version < "4.0" -pathlib2==2.3.7.post1 ; python_version >= "3.7" and python_version < "4.0" -pluggy==1.0.0 ; python_version >= "3.7" and python_version < "4.0" -protobuf==4.21.12 ; python_version >= "3.7" and python_version < "4.0" -psycopg2-binary==2.9.1 ; python_version >= "3.7" and python_version < "4.0" -pycparser==2.21 ; python_version >= "3.7" and python_version < "4.0" -pycryptodomex==3.16.0 ; python_version >= "3.7" and python_version < "4.0" -pydantic==1.10.4 ; python_version >= "3.7" and python_version < "4.0" -pyln-bolt7==1.0.246 ; python_version >= "3.7" and python_version < "4.0" -pyln-client==0.11.1 ; python_version >= "3.7" and python_version < "4.0" -pyln-proto==0.11.1 ; python_version >= "3.7" and python_version < "4.0" -pyqrcode==1.2.1 ; python_version >= "3.7" and python_version < "4.0" -pyscss==1.4.0 ; python_version >= "3.7" and python_version < "4.0" -pysocks==1.7.1 ; python_version >= "3.7" and python_version < "4.0" -pytest-asyncio==0.19.0 ; python_version >= "3.7" and python_version < "4.0" -pytest==7.2.1 ; python_version >= "3.7" and python_version < "4.0" -python-bitcoinlib==0.11.2 ; python_version >= "3.7" and python_version < "4.0" -python-dotenv==0.21.0 ; python_version >= "3.7" and python_version < "4.0" -represent==1.6.0.post0 ; python_version >= "3.7" and python_version < "4.0" -requests==2.27.1 ; python_version >= "3.7" and python_version < "4.0" -rfc3986[idna2008]==1.5.0 ; python_version >= "3.7" and python_version < "4.0" -secp256k1==0.14.0 ; python_version >= "3.7" and python_version < "4.0" -setuptools==65.7.0 ; python_version >= "3.7" and python_version < "4.0" -shortuuid==1.0.1 ; python_version >= "3.7" and python_version < "4.0" -six==1.16.0 ; python_version >= "3.7" and python_version < "4.0" -sniffio==1.3.0 ; python_version >= "3.7" and python_version < "4.0" -sqlalchemy-aio==0.17.0 ; python_version >= "3.7" and python_version < "4.0" -sqlalchemy==1.3.24 ; python_version >= "3.7" and python_version < "4.0" -sse-starlette==0.6.2 ; python_version >= "3.7" and python_version < "4.0" -starlette==0.19.1 ; python_version >= "3.7" and python_version < "4.0" -tomli==2.0.1 ; python_version >= "3.7" and python_version < "3.11" -typing-extensions==4.4.0 ; python_version >= "3.7" and python_version < "4.0" -urllib3==1.26.14 ; python_version >= "3.7" and python_version < "4.0" -uvicorn==0.18.3 ; python_version >= "3.7" and python_version < "4.0" -uvloop==0.16.0 ; python_version >= "3.7" and python_version < "4.0" -websocket-client==1.3.3 ; python_version >= "3.7" and python_version < "4.0" -websockets==10.0 ; python_version >= "3.7" and python_version < "4.0" -wheel==0.38.4 ; python_version >= "3.7" and python_version < "4.0" -win32-setctime==1.1.0 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32" -zipp==3.11.0 ; python_version >= "3.7" and python_version < "4.0"