Upgrade improvements, netdata improvements

This commit is contained in:
Taylor Helsper 2019-11-15 23:09:15 -06:00
parent 0403c0d340
commit fdb2961ae0
10 changed files with 11393 additions and 2 deletions

View File

@ -1,3 +1,12 @@
=== v0.1.67 ===
- Improve upgrade consistency
- Improve resource usage of netdata
- Add ability to disable netdata
- Fix tor connection issue
- Remove duplicate BTC Explorer
- Handle 404 and 500 errors
- Dark mode fixes
=== v0.1.66 ===
- Add netdata as first docker container
- Improve QS options on settings page when QS is disabled

View File

@ -212,6 +212,8 @@ ControlPort 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1
PidFile /tmp/tor.pid
# Hidden Service for myNode
HiddenServiceDir /var/lib/tor/mynode/
HiddenServiceVersion 2

View File

@ -13,4 +13,5 @@ services:
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /sys:/host/sys:ro
- /opt/mynode/netdata/netdata.conf:/etc/netdata/netdata.conf:ro

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
source /usr/share/mynode/mynode_config.sh
set -x
set -e
# Shut down main services to save memory and CPU
systemctl stop electrs
@ -40,6 +41,7 @@ usermod -aG docker root
# Upgrade BTC
set +e
BTC_VERSION="0.18.1"
ARCH="arm-linux-gnueabihf"
uname -a | grep aarch64
@ -49,6 +51,7 @@ fi
if [ $IS_X86 = 1 ]; then
ARCH="x86_64-linux-gnu"
fi
set -e
BTC_UPGRADE_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/bitcoin-$BTC_VERSION-$ARCH.tar.gz
BTC_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.btc_url
BTC_UPGRADE_SHA256SUM_URL=https://bitcoincore.org/bin/bitcoin-core-$BTC_VERSION/SHA256SUMS.asc

View File

@ -39,5 +39,13 @@ sleep 1
# Run post upgrade script
VERSION=$(cat /usr/share/mynode/version)
/bin/bash /usr/bin/mynode_post_upgrade.sh > /home/admin/upgrade_logs/upgrade_log_${VERSION}_post.txt 2>&1
for i in {1..5}
do
/bin/bash /usr/bin/mynode_post_upgrade.sh > /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_${i}.txt 2>&1
RC=$?
if [ "${RC}" -eq "0" ]; then
break
fi
sleep 10s
done
chown -R admin:admin /home/admin/upgrade_logs

View File

@ -24,3 +24,4 @@ ELECTRS_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_electrs_enabled"
LNDHUB_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_lndhub_enabled"
BTCRPCEXPLORER_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_btcrpceplorer_enabled"
VPN_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_vpn_enabled"
NETDATA_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_netdata_enabled"

View File

@ -1,7 +1,20 @@
import os
import subprocess
from config import *
# Generic service check
def is_service_enabled(service):
cmd = "systemctl status {} --no-pager".format(service)
try:
results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
if "enabled;" in results:
return True
except:
return False
return False
# Enable disable functions on homepage
def is_lndhub_enabled():
if os.path.isfile(LNDHUB_ENABLED_FILE):
@ -73,3 +86,15 @@ def disable_vpn():
os.system("systemctl disable vpn --no-pager")
os.system("systemctl stop openvpn --no-pager")
os.system("systemctl disable openvpn --no-pager")
def is_netdata_enabled():
return is_service_enabled("netdata")
def enable_netdata():
os.system("systemctl enable netdata --no-pager")
os.system("systemctl start netdata --no-pager")
def disable_netdata():
os.system("systemctl stop netdata --no-pager")
os.system("systemctl disable netdata --no-pager")

View File

@ -133,6 +133,7 @@ def page_settings():
"lnd_status": lnd_status,
"electrs_status": electrs_status,
"is_quicksync_disabled": not is_quicksync_enabled(),
"is_netdata_enabled": is_netdata_enabled(),
"is_uploader_device": is_uploader(),
"download_rate": download_rate,
"upload_rate": upload_rate,
@ -467,4 +468,12 @@ def toggle_darkmode_page():
disable_darkmode()
else:
enable_darkmode()
return redirect("/settings")
@mynode_settings.route("/settings/toggle-netdata")
def toggle_netdata_page():
if is_netdata_enabled():
disable_netdata()
else:
enable_netdata()
return redirect("/settings")

View File

@ -361,7 +361,9 @@
<tr>
<td>Details</td>
<td style="padding-left: 20px;">
{% if is_netdata_enabled %}
<a id="netdata" class="ui-button ui-widget ui-corner-all settings_button_small" href="#">Open Netdata</a>
{% endif %}
<a id="glances" class="ui-button ui-widget ui-corner-all settings_button_small" href="#">Open Glances</a>
</td>
</tr>
@ -571,6 +573,20 @@
</div>
<div class="settings_block">
<div class="settings_block_header">Services</div>
<div class="settings_block_subheader">Netdata</div>
This will enable or disable netdata device monitoring.
<br/>
{% if is_netdata_enabled %}
<a href="/settings/toggle-netdata" class="ui-button ui-widget ui-corner-all settings_button">Disable</a>
{% else %}
<a href="/settings/toggle-netdata" class="ui-button ui-widget ui-corner-all settings_button">Enable</a>
{% endif %}
</div>
<div class="settings_block">
<div class="settings_block_header">Advanced</div>