Upgrade to Python 3.7.7; More lnbits foundation

This commit is contained in:
Taylor Helsper 2020-06-25 23:30:17 -05:00
parent a30fbc8402
commit 0390a7b559
7 changed files with 86 additions and 9 deletions

View File

@ -0,0 +1,31 @@
# RTL service
# /etc/systemd/system/rtl.service
[Unit]
Description=LNBits
Wants=bitcoind.service lnd.service
After=bitcoind.service lnd.service
[Service]
ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/wait_on_lnd.sh
Environment=FLASK_ENV=development
WorkingDirectory=/opt/mynode/lnbits
#ExecStart=/usr/local/bin/pipenv run flask run --host 0.0.0.0
ExecStart=/bin/sh -c 'cd /opt/mynode/lnbits && /usr/local/bin/pipenv --python 3.7 run flask run --host 0.0.0.0'
#ExecStart=/bin/sh -c 'cd /opt/mynode/lnbits && python3 /usr/local/bin/pipenv --python 3.7 run gunicorn -b :5000 lnbits:app -k gevent'
User=bitcoin
Group=bitcoin
Type=simple
LimitNOFILE=128000
TimeoutSec=240
Restart=always
RestartSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=lnbits
[Install]
WantedBy=multi-user.target

View File

@ -36,6 +36,7 @@ ufw allow 3002 comment 'allow BTC RPC Explorer'
ufw allow 3010 comment 'allow RTL'
ufw allow 3020 comment 'allow Caravan'
ufw allow 4080 comment 'allow Mempool'
ufw allow 5000 comment 'allow LNBits'
ufw allow 5353 comment 'allow Avahi'
ufw allow 8899 comment 'allow Whirlpool'
ufw allow 50001 comment 'allow Electrum Server'

View File

@ -14,6 +14,9 @@ date
# Delete ramlog to prevent ram issues
rm -rf /var/log/*
# Create any necessary users
sudo adduser --disabled-password --gecos "" lnbits || true
# Check if upgrades use tor
TORIFY=""
if [ -f /mnt/hdd/mynode/settings/torify_apt_get ]; then
@ -56,7 +59,7 @@ $TORIFY apt-get -y install libatlas-base-dev libffi-dev libssl-dev glances pytho
$TORIFY apt-get -y -qq install apt-transport-https ca-certificates
$TORIFY apt-get -y install libgmp-dev automake libtool libltdl-dev libltdl7
$TORIFY apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev
$TORIFY apt-get -y install libudev-dev libusb-1.0-0-dev python3-venv
$TORIFY apt-get -y install libudev-dev libusb-1.0-0-dev python3-venv gunicorn libsqlite3-dev
# Make sure some software is removed
apt-get -y purge ntp # (conflicts with systemd-timedatectl)
@ -67,6 +70,27 @@ apt-get -y purge chrony # (conflicts with systemd-timedatectl)
pip install tzupdate virtualenv --no-cache-dir
# Update Python3 to 3.7.X
PYTHON_VERSION=3.7.7
CURRENT_PYTHON3_VERSION=$(python3 --version)
if [[ "$CURRENT_PYTHON3_VERSION" != *"Python ${PYTHON_VERSION}"* ]]; then
mkdir -p /opt/download
cd /opt/download
rm -rf Python-*
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -O python.tar.xz
tar xf python.tar.xz
cd Python-*
./configure
make -j4
make install
cd ~
else
echo "Python up to date"
fi
# Install any pip3 software
pip3 install python-bitcointx --no-cache-dir
pip3 install gnureadline --no-cache-dir
@ -441,8 +465,12 @@ fi
# sudo -u bitcoin mv lnbits-* lnbits
# cd lnbits
# pipenv install lnd-grpc
# pipenv install --dev
# # Install with python 3.7 (Only use "pipenv install --python 3.7" once or it will rebuild the venv!)
# sudo -u bitcoin pipenv --python 3.7 install --dev
# sudo -u bitcoin pipenv run pip install python-dotenv
# sudo -u bitcoin pipenv run pip install -r requirements.txt
# sudo -u bitcoin pipenv run pip install lnd-grpc
# sudo -u bitcoin pipenv run flask migrate || true
# mkdir -p /home/bitcoin/.mynode/
# chown -R bitcoin:bitcoin /home/bitcoin/.mynode/

View File

@ -28,6 +28,8 @@ elif [ "$APP" = "caravan" ]; then
rm -f /home/bitcoin/.mynode/.caravan_url
elif [ "$APP" = "joinmarket" ]; then
rm -f /home/bitcoin/.mynode/.joinmarket_url
elif [ "$APP" = "lnbits" ]; then
rm -f /home/bitcoin/.mynode/.lnbits_url
elif [ "$APP" = "lndconnect" ]; then
rm -f /home/bitcoin/.mynode/.lndconnect_url
elif [ "$APP" = "lndhub" ]; then

View File

@ -131,6 +131,7 @@ mkdir -p /mnt/hdd/mynode/electrs
mkdir -p /mnt/hdd/mynode/docker
mkdir -p /mnt/hdd/mynode/rtl_backup
mkdir -p /mnt/hdd/mynode/whirlpool
mkdir -p /mnt/hdd/mynode/lnbits
mkdir -p /tmp/flask_uploads
echo "drive_mounted" > $MYNODE_DIR/.mynode_status
chmod 777 $MYNODE_DIR/.mynode_status
@ -308,6 +309,10 @@ USER=$(stat -c '%U' /mnt/hdd/mynode/whirlpool)
if [ "$USER" != "bitcoin" ]; then
chown -R bitcoin:bitcoin /mnt/hdd/mynode/whirlpool
fi
USER=$(stat -c '%U' /mnt/hdd/mynode/lnbits)
if [ "$USER" != "bitcoin" ]; then
chown -R bitcoin:bitcoin /mnt/hdd/mynode/lnbits
fi
USER=$(stat -c '%U' /mnt/hdd/mynode/redis)
if [ "$USER" != "redis" ]; then
chown -R redis:redis /mnt/hdd/mynode/redis

View File

@ -816,6 +816,7 @@
<option value="caravan">Caravan</option>
<option value="dojo">Dojo</option>
<option value="joinmarket">JoinMarket</option>
<option value="lnbits">Lnbits</option>
<option value="loopd">Lightning Loop</option>
<option value="webssh2">Linux Terminal</option>
<option value="lndconnect">LND Connect</option>

View File

@ -83,6 +83,10 @@ fi
wget http://${SERVER_IP}:8000/${TARBALL} -O /tmp/rootfs.tar.gz
# Create any necessary users
sudo adduser --disabled-password --gecos "" lnbits || true
# Add sources
apt-get -y install apt-transport-https
DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }')
@ -121,7 +125,8 @@ apt-get -y install libfreetype6-dev libpng-dev libatlas-base-dev libgmp-dev libl
apt-get -y install libffi-dev libssl-dev glances python3-bottle automake libtool libltdl7
apt -y -qq install apt-transport-https ca-certificates
apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev
apt-get -y install zlib1g-dev libudev-dev libusb-1.0-0-dev python3-venv
apt-get -y install zlib1g-dev libudev-dev libusb-1.0-0-dev python3-venv gunicorn
apt-get -y isntall libsqlite3-dev
# Make sure some software is removed
@ -149,13 +154,17 @@ pip install tzupdate virtualenv
# Update Python3 to 3.7.X
PYTHON3_VERSION=$(python3 --version)
if [[ "$PYTHON3_VERSION" != *"Python 3.7.6"* ]]; then
PYTHON_VERSION=3.7.7
CURRENT_PYTHON3_VERSION=$(python3 --version)
if [[ "$CURRENT_PYTHON3_VERSION" != *"Python ${PYTHON_VERSION}"* ]]; then
mkdir -p /opt/download
cd /opt/download
wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz
tar xf Python-3.7.6.tar.xz
cd Python-3.7.6
rm -rf Python-*
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -O python.tar.xz
tar xf python.tar.xz
cd Python-*
./configure
make -j4
make install