#3326 Reduce Logs & Misc (#3511)

* #3326 set loglevel of mempool to warn
* #3326 set mempool loglevel thru systemd service
* fix pint out of isSMART
* #3326 set LogLevel ins systemd
* #3268 fix helipad db owner
* check mempool install success
* fix mempool success detection
* add mempool db socks
* lnserver localhost to 127.0.0.1
This commit is contained in:
/rootzoll 2022-12-12 14:29:51 +01:00 committed by GitHub
parent 5184044faf
commit e3ffe5dc61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 10 deletions

View file

@ -407,7 +407,7 @@ if [ "$1" = "status" ]; then
# try to detect if its an SSD # try to detect if its an SSD
isSMART=$(sudo smartctl -a /dev/${hdd} | grep -c "Rotation Rate:") isSMART=$(sudo smartctl -a /dev/${hdd} | grep -c "Rotation Rate:")
echo "isSMART=$(isSMART)" echo "isSMART=${isSMART}"
if [ ${isSMART} -gt 0 ]; then if [ ${isSMART} -gt 0 ]; then
#detect using smartmontools (preferred) #detect using smartmontools (preferred)
isSSD=$(sudo smartctl -a /dev/${hdd} | grep 'Rotation Rate:' | grep -c "Solid State") isSSD=$(sudo smartctl -a /dev/${hdd} | grep 'Rotation Rate:' | grep -c "Solid State")

View file

@ -308,6 +308,7 @@ WorkingDirectory=/home/btcrpcexplorer/btc-rpc-explorer
ExecStart=/usr/bin/npm start ExecStart=/usr/bin/npm start
Restart=on-failure Restart=on-failure
RestartSec=20 RestartSec=20
LogLevelMax=4
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true

View file

@ -415,6 +415,7 @@ Type=simple
TimeoutSec=60 TimeoutSec=60
Restart=always Restart=always
RestartSec=60 RestartSec=60
LogLevelMax=5
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true

View file

@ -116,8 +116,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# persist settings in app-data # persist settings in app-data
sudo mkdir -p $HELIPAD_DATA_DIR sudo mkdir -p $HELIPAD_DATA_DIR
sudo chown $HELIPAD_USER: $HELIPAD_DATA_DIR sudo chown $HELIPAD_USER:$HELIPAD_USER $HELIPAD_DATA_DIR
sudo -u $HELIPAD_USER touch $HELIPAD_DB sudo -u $HELIPAD_USER touch $HELIPAD_DB
sudo chown $HELIPAD_USER:$HELIPAD_USER $HELIPAD_DB
################## ##################
# NGINX # NGINX
@ -170,6 +171,7 @@ RestartSec=30
Environment="LND_TLSCERT=$HELIPAD_CERT" Environment="LND_TLSCERT=$HELIPAD_CERT"
Environment="LND_ADMINMACAROON=$HELIPAD_MACAROON" Environment="LND_ADMINMACAROON=$HELIPAD_MACAROON"
Environment="HELIPAD_DATABASE_DIR=$HELIPAD_DB" Environment="HELIPAD_DATABASE_DIR=$HELIPAD_DB"
LogLevelMax=4
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/helipad.service " | sudo tee /etc/systemd/system/helipad.service

View file

@ -341,6 +341,7 @@ TimeoutSec=120
RestartSec=30 RestartSec=30
StandardOutput=null StandardOutput=null
StandardError=journal StandardError=journal
LogLevelMax=4
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true

View file

@ -155,6 +155,8 @@ Group=joinmarket
Restart=always Restart=always
TimeoutSec=120 TimeoutSec=120
RestartSec=60 RestartSec=60
LogLevelMax=4
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true
ProtectSystem=full ProtectSystem=full

View file

@ -295,6 +295,7 @@ Restart=on-failure
RestartSec=60 RestartSec=60
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal
LogLevelMax=4
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true

View file

@ -205,6 +205,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
"ENABLED": true, "ENABLED": true,
"HOST": "localhost", "HOST": "localhost",
"PORT": 3306, "PORT": 3306,
"SOCKET": "/var/run/mysqld/mysqld.sock",
"USERNAME": "mempool", "USERNAME": "mempool",
"PASSWORD": "mempool", "PASSWORD": "mempool",
"DATABASE": "mempool" "DATABASE": "mempool"
@ -269,6 +270,7 @@ User=mempool
# Restart on failure but no more than default times (DefaultStartLimitBurst=5) every 10 minutes (600 seconds). Otherwise stop # Restart on failure but no more than default times (DefaultStartLimitBurst=5) every 10 minutes (600 seconds). Otherwise stop
Restart=on-failure Restart=on-failure
RestartSec=600 RestartSec=600
LogLevelMax=4
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true
@ -303,16 +305,26 @@ EOF
echo "# needs to finish creating txindex to be functional" echo "# needs to finish creating txindex to be functional"
echo "# monitor with: sudo tail -n 20 -f /mnt/hdd/bitcoin/debug.log" echo "# monitor with: sudo tail -n 20 -f /mnt/hdd/bitcoin/debug.log"
# Hidden Service for Mempool if Tor is active # Hidden Service for Mempool if Tor is active
if [ "${runBehindTor}" = "on" ]; then if [ "${runBehindTor}" = "on" ]; then
# make sure to keep in sync with tor.network.sh script # make sure to keep in sync with tor.network.sh script
/home/admin/config.scripts/tor.onion-service.sh mempool 80 4082 443 4083 /home/admin/config.scripts/tor.onion-service.sh mempool 80 4082 443 4083
fi fi
# needed for API/WebUI as signal that install ran thru # check install success by testing backend
echo "result='OK'" localIP=$(hostname -I | awk '{print $1}')
exit 0 httpResponseCode=$(curl -s -o /dev/null -w "%{http_code}" http://${localIP}:4080/api/v1/statistics/2h)
if [ "${httpResponseCode}" != "200" ]; then
# signal an error to WebUI
echo "result='${httpResponseCode}'"
echo "# HTTP error code ${httpResponseCode} calling backend: http://${localIP}:4080/api/v1/statistics/2h"
exit 1
else
# needed for API/WebUI as signal that install ran thru
echo "result='OK'"
exit 0
fi
fi fi
# switch off # switch off

View file

@ -220,6 +220,7 @@ TimeoutSec=120
RestartSec=30 RestartSec=30
StandardOutput=null StandardOutput=null
StandardError=journal StandardError=journal
LogLevelMax=4
# Hardening measures # Hardening measures
PrivateTmp=true PrivateTmp=true
@ -406,9 +407,9 @@ if [ "$1" = "prestart" ]; then
jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \ jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \ jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \ jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
jq ".nodes[0].Settings.lnServerUrl = \"https://localhost:${portprefix}8080\"" | \ jq ".nodes[0].Settings.lnServerUrl = \"https://127.0.0.1:${portprefix}8080\"" | \
jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \ jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \
jq ".nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp jq ".nodes[0].Settings.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
fi fi
@ -427,9 +428,9 @@ if [ "$1" = "prestart" ]; then
jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \ jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \ jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \ jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
jq ".nodes[0].Settings.lnServerUrl = \"https://localhost:${portprefix}6100\"" | \ jq ".nodes[0].Settings.lnServerUrl = \"https://127.0.0.1:${portprefix}6100\"" | \
jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \ jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \
jq ".nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp jq ".nodes[0].Settings.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
fi fi