This commit is contained in:
rootzoll
2020-01-15 10:57:24 +01:00
7 changed files with 66 additions and 36 deletions

View File

@@ -507,7 +507,7 @@ if [ "${BTCPayServer}" != "${choice}" ]; then
if [ "${choice}" = "on" ]; then if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then if [ ${errorOnInstall} -eq 0 ]; then
source /home/btcpay/.btcpayserver/Main/settings.config source /home/btcpay/.btcpayserver/Main/settings.config
if [ ${externalurl} = "https://" ]; then if [ ${externalurl} = "https://localhost" ]; then
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
externalurl="https://$localip\n externalurl="https://$localip\n
Will need to accept the self-signed certificate in the \ Will need to accept the self-signed certificate in the \
@@ -550,10 +550,8 @@ if [ "${lndmanage}" != "${choice}" ]; then
if [ "${choice}" = "on" ]; then if [ "${choice}" = "on" ]; then
whiptail --title " Installed lndmanage " --msgbox "\ whiptail --title " Installed lndmanage " --msgbox "\
Usage: https://github.com/bitromortac/lndmanage/blob/master/README.md\n Usage: https://github.com/bitromortac/lndmanage/blob/master/README.md\n
Start with the line: To start type: 'manage' in the command line.
'cd lndmanage & source venv/bin/activate & lndmanage'\n " 9 75
To exit: type 'deactivate' and press ENTER
" 12 75
fi fi
needsReboot=0 needsReboot=0
else else

View File

@@ -76,7 +76,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# make sure that txindex of blockchain is switched on # make sure that txindex of blockchain is switched on
/home/admin/config.scripts/network.txindex.sh on /home/admin/config.scripts/network.txindex.sh on
npm install -g btc-rpc-explorer@1.1.3 npm install -g btc-rpc-explorer@1.1.8
# prepare .env file # prepare .env file
echo "getting RPC credentials from the ${network}.conf" echo "getting RPC credentials from the ${network}.conf"

View File

@@ -32,6 +32,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "exiting as user cancelled BTCPayServer installation" echo "exiting as user cancelled BTCPayServer installation"
exit 1 exit 1
fi fi
# check for $BTCPayDomain
source /mnt/hdd/raspiblitz.conf
isInstalled=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service') isInstalled=$(sudo ls /etc/systemd/system/btcpayserver.service 2>/dev/null | grep -c 'btcpayserver.service')
if [ ${isInstalled} -eq 0 ]; then if [ ${isInstalled} -eq 0 ]; then
@@ -40,14 +42,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
cd /home/btcpay cd /home/btcpay
# store BTCpay data on HDD # store BTCpay data on HDD
sudo mkdir /mnt/hdd/app-data/btcpayserver 2>/dev/null sudo mkdir /mnt/hdd/app-data/.btcpayserver 2>/dev/null
# move old btcpay data to app-data # move old btcpay data to app-data
sudo mv -f /mnt/hdd/.btcpayserver/* /mnt/hdd/app-data/btcpayserver/ 2>/dev/null sudo mv -f /mnt/hdd/.btcpayserver/* /mnt/hdd/app-data/.btcpayserver/ 2>/dev/null
sudo rm -f /mnt/hdd/.btcpayserver 2>/dev/null sudo rm -rf /mnt/hdd/.btcpayserver 2>/dev/null
sudo chown -R btcpay:btcpay /mnt/hdd/app-data/btcpayserver # clean dirty SDcard (from before v1.4)
sudo ln -s /mnt/hdd/app-data/btcpayserver /home/btcpay/ 2>/dev/null sudo mv -f /home/btcpay/.btcpayserver/* /mnt/hdd/app-data/.btcpayserver/ 2>/dev/null
sudo rm -rf /home/btcpay/.btcpayserver 2>/dev/null
sudo chown -R btcpay:btcpay /mnt/hdd/app-data/.btcpayserver
sudo -u btcpay ln -s /mnt/hdd/app-data/.btcpayserver /home/btcpay/ 2>/dev/null
sudo chown -R btcpay:btcpay /home/btcpay/.btcpayserver
echo "" echo ""
echo "***" echo "***"
@@ -81,6 +88,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo -u btcpay mkdir /home/btcpay/dotnet sudo -u btcpay mkdir /home/btcpay/dotnet
sudo -u btcpay tar -xvf ${dotnetName} -C /home/btcpay/dotnet sudo -u btcpay tar -xvf ${dotnetName} -C /home/btcpay/dotnet
sudo -u btcpay tar -xvf ${aspnetcoreName} -C /home/btcpay/dotnet sudo -u btcpay tar -xvf ${aspnetcoreName} -C /home/btcpay/dotnet
sudo rm -f *.tar.gz*
# opt out of telemetry # opt out of telemetry
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | sudo tee -a /etc/environment echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | sudo tee -a /etc/environment
@@ -124,7 +132,7 @@ PrivateDevices=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
" | sudo tee -a /etc/systemd/system/nbxplorer.service " | sudo tee /etc/systemd/system/nbxplorer.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
# restart to create settings.config if was running already # restart to create settings.config if was running already
@@ -173,8 +181,9 @@ EOF
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git
cd btcpayserver cd btcpayserver
# https://github.com/btcpayserver/btcpayserver/releases # https://github.com/btcpayserver/btcpayserver/releases
sudo -u btcpay git reset --hard v1.0.3.144 sudo -u btcpay git reset --hard v1.0.3.150
sudo -u btcpay ./build.sh # sudo -u btcpay ./build.sh
sudo -u btcpay dotnet build -c Release BTCPayServer/BTCPayServer.csproj
echo " echo "
[Unit] [Unit]
@@ -192,7 +201,7 @@ Restart=on-failure
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
" | sudo tee -a /etc/systemd/system/btcpayserver.service " | sudo tee /etc/systemd/system/btcpayserver.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable btcpayserver sudo systemctl enable btcpayserver
@@ -210,7 +219,7 @@ network=mainnet
### Server settings ### ### Server settings ###
port=23000 port=23000
bind=127.0.0.1 bind=127.0.0.1
externalurl=https://$YOUR_DOMAIN externalurl=https://$BTCPayDomain
### NBXplorer settings ### ### NBXplorer settings ###
BTC.explorer.url=http://127.0.0.1:24444/ BTC.explorer.url=http://127.0.0.1:24444/
@@ -244,6 +253,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo systemctl disable btcpayserver sudo systemctl disable btcpayserver
sudo rm /etc/systemd/system/btcpayserver.service sudo rm /etc/systemd/system/btcpayserver.service
sudo -u btcpay dotnet nuget locals all --clear
sudo rm -f /home/btcpay/dotnet-sdk* sudo rm -f /home/btcpay/dotnet-sdk*
sudo rm -f /home/btcpay/aspnetcore* sudo rm -f /home/btcpay/aspnetcore*
sudo rm -rf /home/btcpay/dotnet sudo rm -rf /home/btcpay/dotnet

View File

@@ -56,6 +56,12 @@ if [ ${#ownDomain} -eq 0 ]; then
exit 1 exit 1
fi fi
# add default value to raspi config if needed
if ! grep -Eq "^BTCPayDomain=" /mnt/hdd/raspiblitz.conf; then
echo "BTCPayDomain=off" >> /mnt/hdd/raspiblitz.conf
fi
echo "" echo ""
echo "***" echo "***"
echo "Setting up Nginx and Certbot" echo "Setting up Nginx and Certbot"
@@ -65,12 +71,12 @@ echo ""
if [ $ownDomain -eq 1 ]; then if [ $ownDomain -eq 1 ]; then
echo "" echo ""
echo "***" echo "***"
echo "Confirm that the port 80, 443 and 9735 are forwarded to the IP of your RaspiBlitz by pressing [ENTER] or use [CTRL + C] to exit" echo "Confirm that the ports 80, 443 and 9735 are forwarded to the IP of your RaspiBlitz by pressing [ENTER] or use [CTRL + C] to exit"
read key read key
echo "" echo ""
echo "***" echo "***"
echo "Type your domain/ddns pointing to your public IP and press [ENTER] or use [CTRL + C] to exit" echo "Type your domain or dynamicDNS pointing to your public IP and press [ENTER] or use [CTRL + C] to exit"
echo "example:" echo "example:"
echo "btcpay.example.com" echo "btcpay.example.com"
read YOUR_DOMAIN read YOUR_DOMAIN
@@ -96,7 +102,7 @@ if [ $ownDomain -eq 1 ]; then
# get SSL cert # get SSL cert
sudo systemctl stop certbot 2>/dev/null sudo systemctl stop certbot 2>/dev/null
sudo certbot certonly -a standalone -m $YOUR_EMAIL --agree-tos -d $YOUR_DOMAIN --pre-hook "service nginx stop" --post-hook "service nginx start" sudo certbot certonly -a standalone -m $YOUR_EMAIL --agree-tos -d $YOUR_DOMAIN -n --pre-hook "service nginx stop" --post-hook "service nginx start"
# set nginx # set nginx
sudo rm -f /etc/nginx/sites-enabled/default sudo rm -f /etc/nginx/sites-enabled/default
@@ -337,6 +343,9 @@ server {
sudo systemctl restart nginx sudo systemctl restart nginx
fi fi
# setting value in raspi blitz config
sudo sed -i "s/^BTCPayDomain=.*/BTCPayDomain=$YOUR_DOMAIN/g" /mnt/hdd/raspiblitz.conf
if [ $ownDomain -eq 1 ]; then if [ $ownDomain -eq 1 ]; then
echo "" echo ""
echo "Visit your BTCpayServer instance on https://$YOUR_DOMAIN" echo "Visit your BTCpayServer instance on https://$YOUR_DOMAIN"

View File

@@ -37,8 +37,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo sed -i "s/^lndmanage=.*/lndmanage=on/g" /mnt/hdd/raspiblitz.conf sudo sed -i "s/^lndmanage=.*/lndmanage=on/g" /mnt/hdd/raspiblitz.conf
echo "usage: https://github.com/bitromortac/lndmanage/blob/master/README.md" echo "usage: https://github.com/bitromortac/lndmanage/blob/master/README.md"
echo "to start type on command line: manage" echo "To start type: 'manage' in the command line."
echo "to exit then venv - type 'deactivate' and press ENTER" echo "To exit the venv - type 'deactivate' and press ENTER"
exit 0 exit 0
fi fi

View File

@@ -16,8 +16,9 @@ fi
# check if nodeJS was installed # check if nodeJS was installed
nodeJSInstalled=$(node -v 2>/dev/null | grep -c "v1.") nodeJSInstalled=$(node -v 2>/dev/null | grep -c "v1.")
if [ ${nodeJSInstalled} -eq 0 ]; then if ! [ ${nodeJSInstalled} -eq 0 ]; then
echo "nodeJS is already installed"
else
# determine nodeJS VERSION and DISTRO # determine nodeJS VERSION and DISTRO
echo "Detect CPU architecture ..." echo "Detect CPU architecture ..."
isARM=$(uname -m | grep -c 'arm') isARM=$(uname -m | grep -c 'arm')
@@ -89,8 +90,6 @@ if [ ${nodeJSInstalled} -eq 0 ]; then
echo "ABORT - nodeJs install" echo "ABORT - nodeJs install"
exit 1 exit 1
fi fi
else
echo "nodeJS is already installed"
fi fi
# setting value in raspi blitz config # setting value in raspi blitz config

View File

@@ -16,7 +16,6 @@ if [ ${#network} -eq 0 ]; then
exit 1 exit 1
fi fi
source /mnt/hdd/raspiblitz.conf
# add default value to raspi config if needed # add default value to raspi config if needed
if ! grep -Eq "^rtlWebinterface=" /mnt/hdd/raspiblitz.conf; then if ! grep -Eq "^rtlWebinterface=" /mnt/hdd/raspiblitz.conf; then
@@ -32,20 +31,31 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** INSTALL RTL ***" echo "*** INSTALL RTL ***"
isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service') isInstalled=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
if [ ${isInstalled} -eq 0 ]; then if ! [ ${isInstalled} -eq 0 ]; then
echo "RTL already installed."
else
# check and install NodeJS # check and install NodeJS
/home/admin/config.scripts/bonus.nodejs.sh /home/admin/config.scripts/bonus.nodejs.sh
# check for Python2 (install if missing)
# TODO remove Python2 ASAP!
echo "*** Check for Python2 ***"
/usr/bin/which python2 &>/dev/null
if ! [ $? -eq 0 ]; then
echo "*** Install Python2 ***"
sudo apt-get update
sudo apt-get install -y python2
fi
# download source code and set to tag release # download source code and set to tag release
echo "*** Get the RTL Source Code ***" echo "*** Get the RTL Source Code ***"
rm -r /home/admin/RTL 2>/dev/null rm -r /home/admin/RTL 2>/dev/null
git clone https://github.com/ShahanaFarooqui/RTL.git /home/admin/RTL git clone https://github.com/ShahanaFarooqui/RTL.git /home/admin/RTL
cd /home/admin/RTL cd /home/admin/RTL
# git reset --hard v0.5.4 git reset --hard v0.6.1
# from https://github.com/Ride-The-Lightning/RTL/commits/master # from https://github.com/Ride-The-Lightning/RTL/commits/master
git checkout 917feebfa4fb583360c140e817c266649307ef72 # git checkout 917feebfa4fb583360c140e817c266649307ef72
# check if node_modles exists now
if [ -d "/home/admin/RTL" ]; then if [ -d "/home/admin/RTL" ]; then
echo "OK - RTL code copy looks good" echo "OK - RTL code copy looks good"
else else
@@ -59,9 +69,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# install # install
echo "*** Run: npm install ***" echo "*** Run: npm install ***"
export NG_CLI_ANALYTICS=false export NG_CLI_ANALYTICS=false
npm install npm install --only=production
cd .. cd ..
# check if node_modles exists now # check if node_modules exist now
if [ -d "/home/admin/RTL/node_modules" ]; then if [ -d "/home/admin/RTL/node_modules" ]; then
echo "OK - RTL install looks good" echo "OK - RTL install looks good"
else else
@@ -71,6 +81,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi fi
echo "" echo ""
# now remove Python2 again
echo "*** Now remove Python2 again ***"
sudo apt-get purge -y python2
sudo apt-get autoremove -y
# prepare RTL.conf file # prepare RTL.conf file
echo "*** RTL.conf ***" echo "*** RTL.conf ***"
cp ./RTL/sample-RTL.conf ./RTL/RTL.conf cp ./RTL/sample-RTL.conf ./RTL/RTL.conf
@@ -93,8 +108,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo systemctl enable RTL sudo systemctl enable RTL
echo "OK - the RTL service is now enabled" echo "OK - the RTL service is now enabled"
else
echo "RTL already installed."
fi fi
# setting value in raspi blitz config # setting value in raspi blitz config