From 7ad75cb1a47e817bfcc54204e3700264c6a92b01 Mon Sep 17 00:00:00 2001 From: Tiago vasconcelos Date: Fri, 12 Nov 2021 11:38:07 +0000 Subject: [PATCH] update install guide to postgres --- docs/guide/installation.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 3051176ed..adebcdc83 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -5,6 +5,19 @@ nav_order: 2 --- # Basic installation +Install Postgres and setup a database for LNbits: +```sh +# on debian/ubuntu 'sudo apt-get -y install postgresql' +# or follow instructions at https://www.postgresql.org/download/linux/ + +# Postgres doesn't have a default password, so we'll create one. +sudo -i -u postgres psql +# on psql +ALTER USER postgres PASSWORD 'myPassword'; # choose whatever password you want +createdb lnbits +\q +exit +``` Download this repo and install the dependencies: @@ -16,7 +29,10 @@ cd lnbits/ python3 -m venv venv ./venv/bin/pip install -r requirements.txt cp .env.example .env -mkdir data +# add the database connection string to .env 'nano .env' LNBITS_DATABASE_URL= +# postgres://:@/ - alter line bellow with your user, password and db name +LNBITS_DATABASE_URL="postgres://postgres:postgres@localhost/lnbits" +# save and exit ./venv/bin/uvicorn lnbits.__main__:app --port 5000 ``` @@ -28,6 +44,10 @@ Then you can restart it and it will be using the new settings. You might also need to install additional packages or perform additional setup steps, depending on the chosen backend. See [the short guide](./wallets.md) on each different funding source. +## Important note +If you already have LNbits installed and running, we **HIGHLY** recommend you migrate to postgres! +You can use the script and instructions on [this guide](https://github.com/talvasconcelos/lnbits-sqlite-to-postgres) to migrate your SQLite database to Postgres. + # Additional guides ### LNbits running on Umbrel behind Tor