fix TOR and dbcache max

This commit is contained in:
Christian Rotzoll 2019-08-08 17:41:58 +02:00
parent a3c52c784d
commit 8df84fde82
7 changed files with 60 additions and 35 deletions

View File

@ -400,14 +400,30 @@ case $CHOICE in
exit 1; exit 1;
;; ;;
BITCOIN) BITCOIN)
# set network info
sed -i "s/^network=.*/network=bitcoin/g" ${infoFile} sed -i "s/^network=.*/network=bitcoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile} sed -i "s/^chain=.*/chain=main/g" ${infoFile}
###### OPTIMIZE IF RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /home/admin/assets/bitcoin.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /home/admin/assets/bitcoin.conf
fi
/home/admin/10setupBlitz.sh /home/admin/10setupBlitz.sh
exit 1; exit 1;
;; ;;
LITECOIN) LITECOIN)
# set network info
sed -i "s/^network=.*/network=litecoin/g" ${infoFile} sed -i "s/^network=.*/network=litecoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile} sed -i "s/^chain=.*/chain=main/g" ${infoFile}
###### OPTIMIZE IF RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /home/admin/assets/litecoin.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /home/admin/assets/litecoin.conf
fi
/home/admin/10setupBlitz.sh /home/admin/10setupBlitz.sh
exit 1; exit 1;
;; ;;

View File

@ -191,9 +191,6 @@ if [ ${mountOK} -eq 1 ]; then
syncComment="BEST+SLOW" syncComment="BEST+SLOW"
fi fi
# set default dbcache in asset
sudo sed -i "s/^dbcache=.*/dbcache=128/g" /home/admin/assets/${network}.conf
#Bitcoin #Bitcoin
if [ ${network} = "bitcoin" ]; then if [ ${network} = "bitcoin" ]; then
echo "Bitcoin Options" echo "Bitcoin Options"

View File

@ -35,14 +35,6 @@ if [ ${mountOK} -eq 1 ]; then
sudo chown -R bitcoin:bitcoin /home/bitcoin/.lnd sudo chown -R bitcoin:bitcoin /home/bitcoin/.lnd
echo "OK - ${network} setup ready" echo "OK - ${network} setup ready"
###### OPTIMIZE IF RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${network}.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf
fi
###### ACTIVATE TOR IF SET DURING SETUP ###### ACTIVATE TOR IF SET DURING SETUP
if [ "${runBehindTor}" = "on" ]; then if [ "${runBehindTor}" = "on" ]; then
echo "TOR was selected ..." echo "TOR was selected ..."

View File

@ -110,7 +110,7 @@ if [ ${lndRunning} -eq 0 ]; then
###### ACTIVATE TOR IF SET DURING SETUP ###### ACTIVATE TOR IF SET DURING SETUP
if [ "${runBehindTor}" = "on" ]; then if [ "${runBehindTor}" = "on" ]; then
echo "TOR was selected ..." echo "TOR was selected ..."
sudo /home/admin/config.scripts/internet.tor.sh lndconf sudo /home/admin/config.scripts/internet.tor.sh lndconf-on
else else
echo "TOR was not selected" echo "TOR was not selected"
fi fi

View File

@ -274,7 +274,7 @@ do
finishedIBD=$(${network}-cli getblockchaininfo | grep "initialblockdownload" | grep -c "false") finishedIBD=$(${network}-cli getblockchaininfo | grep "initialblockdownload" | grep -c "false")
if [ ${finishedIBD} -eq 1 ]; then if [ ${finishedIBD} -eq 1 ]; then
echo "CHECK FOR END OF IBD --> reduce RAM and restart ${network}d" echo "CHECK FOR END OF IBD --> reduce RAM, check TOR and restart ${network}d"
# remove flag # remove flag
rm /home/admin/selfsync.flag rm /home/admin/selfsync.flag
@ -292,6 +292,14 @@ do
sudo sed -i "s/^dbcache=.*/dbcache=128/g" /mnt/hdd/${network}/${network}.conf sudo sed -i "s/^dbcache=.*/dbcache=128/g" /mnt/hdd/${network}/${network}.conf
fi fi
# if TOR was activated during setup make sure bitcoin runs behind TOR latest from now on
if [ "${runBehindTor}" = "on" ]; then
echo "TOR is ON -> make sure bitcoin is running behind TOR after IBD"
/home/admin/config.scripts/internet.tor.sh btcconf-on
else
echo "TOR is OFF after IBD"
fi
# restart bitcoind # restart bitcoind
sudo systemctl start ${network}d sudo systemctl start ${network}d

View File

@ -8,7 +8,16 @@
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "small config script to switch TOR on or off" echo "small config script to switch TOR on or off"
echo "internet.tor.sh [on|off|prepare|btcconf|lndconf]" echo "internet.tor.sh [on|off|prepare|btcconf-on|btcconf-off|lndconf-on]"
exit 1
fi
# check and load raspiblitz config
# to know which network is running
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
exit 1 exit 1
fi fi
@ -114,11 +123,21 @@ activateBitcoinOverTOR()
echo "Chain network already configured for TOR" echo "Chain network already configured for TOR"
fi fi
else else
echo "BTC config does not found (yet) - try with 'internet.tor.sh btcconf' again later" echo "BTC config does not found (yet) - try with 'internet.tor.sh btcconf-on' again later"
fi fi
} }
deactivateBitcoinOverTOR()
{
echo "*** Changing ${network} Config ***"
sudo sed -i "s/^onlynet=.*//g" /home/bitcoin/.${network}/${network}.conf
sudo sed -i "s/^addnode=.*//g" /home/bitcoin/.${network}/${network}.conf
sudo sed -i '/^ *$/d' /home/bitcoin/.${network}/${network}.conf
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${network}/${network}.conf
}
activateLndOverTOR() activateLndOverTOR()
{ {
echo "*** Putting LND behind TOR ***" echo "*** Putting LND behind TOR ***"
@ -139,7 +158,7 @@ activateLndOverTOR()
echo "" echo ""
else else
echo "LND service not found (yet) - try with 'internet.tor.sh lndconf' again later" echo "LND service not found (yet) - try with 'internet.tor.sh lndconf-on' again later"
fi fi
} }
@ -151,24 +170,21 @@ if [ "$1" = "prepare" ] || [ "$1" = "-prepare" ]; then
fi fi
# if started with prepare # if started with prepare
if [ "$1" = "btcconf" ]; then if [ "$1" = "btcconf-on" ]; then
activateBitcoinOverTOR activateBitcoinOverTOR
exit 0 exit 0
fi fi
# if started with prepare # if started with prepare
if [ "$1" = "lndconf" ]; then if [ "$1" = "btcconf-off" ]; then
activateLndOverTOR deactivateBitcoinOverTOR
exit 0 exit 0
fi fi
# check and load raspiblitz config # if started with prepare
# to know which network is running if [ "$1" = "lndconf-on" ]; then
source /home/admin/raspiblitz.info activateLndOverTOR
source /mnt/hdd/raspiblitz.conf exit 0
if [ ${#network} -eq 0 ]; then
echo "FAIL - missing /mnt/hdd/raspiblitz.conf"
exit 1
fi fi
# add default value to raspi config if needed # add default value to raspi config if needed
@ -323,12 +339,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo systemctl disable tor@default sudo systemctl disable tor@default
echo "" echo ""
echo "*** Changing ${network} Config ***" # DEACTIVATE BITCOIN OVER TOR (function call)
sudo sed -i "s/^onlynet=.*//g" /home/bitcoin/.${network}/${network}.conf deactivateBitcoinOverTOR
sudo sed -i "s/^addnode=.*//g" /home/bitcoin/.${network}/${network}.conf
sudo sed -i '/^ *$/d' /home/bitcoin/.${network}/${network}.conf
sudo cp /home/bitcoin/.${network}/${network}.conf /home/admin/.${network}/${network}.conf
sudo chown admin:admin /home/admin/.${network}/${network}.conf
echo "" echo ""
echo "*** Removing TOR from LND ***" echo "*** Removing TOR from LND ***"

View File

@ -1,8 +1,8 @@
## Shopping List: Germany # Shopping List: Germany
The new shopping list comes in three different packages: Minimal, Standard & Maximal: The new shopping list comes in three different packages: Minimal, Standard & Maximal:
### Standard Shopping list (under 200 EUR) ## Standard Shopping list (under 200 EUR)
*The "Standard Package" is most tested and recommended if you can effort it. It aims to give you the best economic value to run all the RaspiBlitz features at a good performance and even allows you to self-validate your blockchain in under 3 days.* *The "Standard Package" is most tested and recommended if you can effort it. It aims to give you the best economic value to run all the RaspiBlitz features at a good performance and even allows you to self-validate your blockchain in under 3 days.*
@ -37,4 +37,4 @@ Or if you order new go with the RaspberryPi 4 1GB and the following parts:
## Package: Maximal ## Package: Maximal
*The maximal package is still in the works ... if you want to prepare for it, take the standard package as a base and choose the RaspberryPi4 with 4GB and a high quality 1TB SSD.* *The maximal package is still in the works ... if you want to prepare for it, take the standard package as a base and choose the RaspberryPi4 with 4GB and a high quality 1TB SSD instead of 500GB.*