mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-26 11:56:16 +02:00
systemd guide
This commit is contained in:
@@ -6,6 +6,7 @@ nav_order: 2
|
|||||||
|
|
||||||
# Basic installation
|
# Basic installation
|
||||||
Install Postgres and setup a database for LNbits:
|
Install Postgres and setup a database for LNbits:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# on debian/ubuntu 'sudo apt-get -y install postgresql'
|
# on debian/ubuntu 'sudo apt-get -y install postgresql'
|
||||||
# or follow instructions at https://www.postgresql.org/download/linux/
|
# or follow instructions at https://www.postgresql.org/download/linux/
|
||||||
@@ -50,6 +51,7 @@ You might also need to install additional packages or perform additional setup s
|
|||||||
If you already have LNbits installed and running, on an SQLite database, we **HIGHLY** recommend you migrate to postgres!
|
If you already have LNbits installed and running, on an SQLite database, we **HIGHLY** recommend you migrate to postgres!
|
||||||
|
|
||||||
There's a script included that can do the migration easy. You should have Postgres already installed and there should be a password for the user, check the guide above.
|
There's a script included that can do the migration easy. You should have Postgres already installed and there should be a password for the user, check the guide above.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# STOP LNbits
|
# STOP LNbits
|
||||||
# on the LNBits folder, locate and edit 'conv.py' with the relevant credentials
|
# on the LNBits folder, locate and edit 'conv.py' with the relevant credentials
|
||||||
@@ -67,6 +69,39 @@ Hopefully, everything works and get migrated... Launch LNbits again and check if
|
|||||||
|
|
||||||
# Additional guides
|
# Additional guides
|
||||||
|
|
||||||
|
### LNbits as a systemd service
|
||||||
|
|
||||||
|
Systemd is great for taking care of your LNbits instance. It will start it on boot and restart it in case it crashes. If you want to run LNbits as a systemd service on your Debian/Ubuntu/Raspbian server, create a file at `/etc/systemd/system/lnbits.service` with the following content:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Systemd unit for lnbits
|
||||||
|
# /etc/systemd/system/lnbits.service
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=LNbits
|
||||||
|
#Wants=lnd.service # you can uncomment these lines if you know what you're doing
|
||||||
|
#After=lnd.service # it will make sure that lnbits starts after lnd (replace with your own backend service)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/home/bitcoin/lnbits # replace with the absolute path of your lnbits installation
|
||||||
|
ExecStart=/home/bitcoin/lnbits/venv/bin/uvicorn lnbits.__main__:app --port 5000 # same here
|
||||||
|
User=bitcoin # replace with the user that you're running lnbits on
|
||||||
|
Restart=always
|
||||||
|
TimeoutSec=120
|
||||||
|
RestartSec=30
|
||||||
|
Environment=PYTHONUNBUFFERED=1 # this makes sure that you receive logs in real time
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
Save the file and run the following commands:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl enable lnbits.service
|
||||||
|
sudo systemctl start lnbits.service
|
||||||
|
```
|
||||||
|
|
||||||
### LNbits running on Umbrel behind Tor
|
### LNbits running on Umbrel behind Tor
|
||||||
|
|
||||||
If you want to run LNbits on your Umbrel but want it to be reached through clearnet, _Uxellodunum_ made an extensive [guide](https://community.getumbrel.com/t/guide-lnbits-without-tor/604) on how to do it.
|
If you want to run LNbits on your Umbrel but want it to be reached through clearnet, _Uxellodunum_ made an extensive [guide](https://community.getumbrel.com/t/guide-lnbits-without-tor/604) on how to do it.
|
||||||
|
Reference in New Issue
Block a user