Update Sphinx Relay naming

This commit is contained in:
Taylor Helsper 2021-02-13 00:07:49 -06:00
parent 01918e5cac
commit a31a0fefeb
19 changed files with 203 additions and 57 deletions

View File

@ -17,7 +17,7 @@ ExecStop=/mnt/hdd/mynode/dojo/docker/my-dojo/dojo.sh stop
User=root
Group=root
KillMode=control-group
TimeoutSec=900
TimeoutSec=180
Restart=always
RestartSec=60

View File

@ -1,5 +1,5 @@
# sphinx-relay service
# /etc/systemd/system/sphinx-relay.service
# sphinxrelay service
# /etc/systemd/system/sphinxrelay.service
[Unit]
Description=Sphinx Relay
@ -9,7 +9,7 @@ After=lnd.service
[Service]
ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/wait_on_lnd.sh
WorkingDirectory=/opt/mynode/sphinx-relay
WorkingDirectory=/opt/mynode/sphinxrelay
ExecStart=npm run prod
User=bitcoin
@ -21,7 +21,7 @@ Restart=always
RestartSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sphinx-relay
SyslogIdentifier=sphinxrelay
[Install]
WantedBy=multi-user.target

View File

@ -703,23 +703,23 @@ fi
# Upgrade Sphinx Relay
SPHINX_RELAY_UPGRADE_URL=https://github.com/stakwork/sphinx-relay/archive/$SPHINX_RELAY_VERSION.tar.gz
SPHINXRELAY_UPGRADE_URL=https://github.com/stakwork/sphinx-relay/archive/$SPHINXRELAY_VERSION.tar.gz
CURRENT=""
if [ -f $SPHINX_RELAY_VERSION_FILE ]; then
CURRENT=$(cat $SPHINX_RELAY_VERSION_FILE)
if [ -f $SPHINXRELAY_VERSION_FILE ]; then
CURRENT=$(cat $SPHINXRELAY_VERSION_FILE)
fi
if [ "$CURRENT" != "$SPHINX_RELAY_VERSION" ]; then
if [ "$CURRENT" != "$SPHINXRELAY_VERSION" ]; then
cd /opt/mynode
rm -rf sphinx-relay
sudo -u bitcoin wget $SPHINX_RELAY_UPGRADE_URL -O sphinx-relay.tar.gz
rm -rf sphinxrelay
sudo -u bitcoin wget $SPHINXRELAY_UPGRADE_URL -O sphinx-relay.tar.gz
sudo -u bitcoin tar -xvf sphinx-relay.tar.gz
sudo -u bitcoin rm sphinx-relay.tar.gz
sudo -u bitcoin mv sphinx-relay-* sphinx-relay
cd sphinx-relay
sudo -u bitcoin mv sphinx-relay-* sphinxrelay
cd sphinxrelay
sudo -u bitcoin npm install
echo $SPHINX_RELAY_VERSION > $SPHINX_RELAY_VERSION_FILE
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_VERSION_FILE
fi

View File

@ -57,8 +57,8 @@ elif [ "$APP" = "thunderhub" ]; then
rm -f $THUNDERHUB_VERSION_FILE
elif [ "$APP" = "ckbunker" ]; then
rm -f $CKBUNKER_VERSION_FILE
elif [ "$APP" = "sphinx-relay" ]; then
rm -f $SPHINX_RELAY_VERSION_FILE
elif [ "$APP" = "sphinxrelay" ]; then
rm -f $SPHINXRELAY_VERSION_FILE
elif [ "$APP" = "tor" ]; then
apt-get remove -y tor
apt-get install -y tor

View File

@ -157,7 +157,7 @@ mkdir -p /mnt/hdd/mynode/whirlpool
mkdir -p /mnt/hdd/mynode/lnbits
mkdir -p /mnt/hdd/mynode/specter
mkdir -p /mnt/hdd/mynode/ckbunker
mkdir -p /mnt/hdd/mynode/sphinx-relay
mkdir -p /mnt/hdd/mynode/sphinxrelay
mkdir -p /tmp/flask_uploads
echo "drive_mounted" > $MYNODE_STATUS_FILE
chmod 777 $MYNODE_STATUS_FILE
@ -364,22 +364,21 @@ if [ ! -f /mnt/hdd/mynode/ckbunker/update_settings_$CKBUNKER_CONFIG_UPDATE_NUM ]
fi
# Setup Sphinx Relay
SPHINX_RELAY_CONFIG_UPDATE_NUM=1
if [ ! -f /mnt/hdd/mynode/sphinx-relay/update_settings_$SPHINX_RELAY_CONFIG_UPDATE_NUM ]; then
cp -f /usr/share/mynode/sphinx_app.json /mnt/hdd/mynode/sphinx-relay/app.json
cp -f /usr/share/mynode/sphinx_config.json /mnt/hdd/mynode/sphinx-relay/config.json
chown -R bitcoin:bitcoin /opt/mynode/sphinx-relay/config/*
chown -R bitcoin:bitcoin /mnt/hdd/mynode/sphinx-relay
SPHINXRELAY_CONFIG_UPDATE_NUM=1
if [ ! -f /mnt/hdd/mynode/sphinxrelay/update_settings_$SPHINXRELAY_CONFIG_UPDATE_NUM ]; then
cp -f /usr/share/mynode/sphinxrelay_app.json /mnt/hdd/mynode/sphinxrelay/app.json
cp -f /usr/share/mynode/sphinxrelay_config.json /mnt/hdd/mynode/sphinxrelay/config.json
chown -R bitcoin:bitcoin /mnt/hdd/mynode/sphinxrelay
touch /mnt/hdd/mynode/sphinx-relay/update_settings_$SPHINX_RELAY_CONFIG_UPDATE_NUM
touch /mnt/hdd/mynode/sphinxrelay/update_settings_$SPHINXRELAY_CONFIG_UPDATE_NUM
fi
if [ -d /opt/mynode/sphinx-relay/config ]; then
if [ ! -L /opt/mynode/sphinx-relay/config/app.json ] || [ ! -L /opt/mynode/sphinx-relay/config/config.json ]; then
rm -f /opt/mynode/sphinx-relay/config/app.json
rm -f /opt/mynode/sphinx-relay/config/config.json
sudo -u bitcoin ln -s /mnt/hdd/mynode/sphinx-relay/app.json /opt/mynode/sphinx-relay/config/app.json
sudo -u bitcoin ln -s /mnt/hdd/mynode/sphinx-relay/config.json /opt/mynode/sphinx-relay/config/config.json
chown -R bitcoin:bitcoin /opt/mynode/sphinx-relay/config/*
if [ -d /opt/mynode/sphinxrelay/config ]; then
if [ ! -L /opt/mynode/sphinxrelay/config/app.json ] || [ ! -L /opt/mynode/sphinxrelay/config/config.json ]; then
rm -f /opt/mynode/sphinxrelay/config/app.json
rm -f /opt/mynode/sphinxrelay/config/config.json
sudo -u bitcoin ln -s /mnt/hdd/mynode/sphinxrelay/app.json /opt/mynode/sphinxrelay/config/app.json
sudo -u bitcoin ln -s /mnt/hdd/mynode/sphinxrelay/config.json /opt/mynode/sphinxrelay/config/config.json
chown -R bitcoin:bitcoin /opt/mynode/sphinxrelay/config/*
fi
fi
@ -470,9 +469,9 @@ USER=$(stat -c '%U' /mnt/hdd/mynode/ckbunker)
if [ "$USER" != "bitcoin" ]; then
chown -R bitcoin:bitcoin /mnt/hdd/mynode/ckbunker
fi
USER=$(stat -c '%U' /mnt/hdd/mynode/sphinx-relay)
USER=$(stat -c '%U' /mnt/hdd/mynode/sphinxrelay)
if [ "$USER" != "bitcoin" ]; then
chown -R bitcoin:bitcoin /mnt/hdd/mynode/sphinx-relay
chown -R bitcoin:bitcoin /mnt/hdd/mynode/sphinxrelay
fi
USER=$(stat -c '%U' /mnt/hdd/mynode/redis)
if [ "$USER" != "redis" ]; then
@ -592,7 +591,7 @@ echo $SPECTER_VERSION > $SPECTER_LATEST_VERSION_FILE
echo $THUNDERHUB_VERSION > $THUNDERHUB_LATEST_VERSION_FILE
echo $LNDCONNECT_VERSION > $LNDCONNECT_LATEST_VERSION_FILE
echo $CKBUNKER_VERSION > $CKBUNKER_LATEST_VERSION_FILE
echo $SPHINX_RELAY_VERSION > $SPHINX_RELAY_LATEST_VERSION_FILE
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_LATEST_VERSION_FILE
# Weird hacks

View File

@ -8,9 +8,13 @@ touch /tmp/shutting_down
# Stop additional services
date
systemctl stop glances lndhub netdata rtl webssh2 whirlpool dojo
date
systemctl stop btcpayserver btc_rpc_explorer specter caravan lnbits
date
systemctl stop thunderhub mempoolspace
date
# Manually stop services (backup)
@ -20,8 +24,12 @@ fi
# Stop core services
date
systemctl stop electrs loopd lnd quicksync bitcoind
date
# Sync filesystem
sync
echo "Done stopping services."

View File

@ -70,6 +70,6 @@ CKBUNKER_VERSION="v0.9"
CKBUNKER_VERSION_FILE=/home/bitcoin/.mynode/ckbunker_version
CKBUNKER_LATEST_VERSION_FILE=/home/bitcoin/.mynode/ckbunker_version_latest
SPHINX_RELAY_VERSION="v1.3.8"
SPHINX_RELAY_VERSION_FILE=/home/bitcoin/.mynode/sphinx_relay_version
SPHINX_RELAY_LATEST_VERSION_FILE=/home/bitcoin/.mynode/sphinx_relay_version_latest
SPHINXRELAY_VERSION="v1.3.8"
SPHINXRELAY_VERSION_FILE=/home/bitcoin/.mynode/sphinxrelay_version
SPHINXRELAY_LATEST_VERSION_FILE=/home/bitcoin/.mynode/sphinxrelay_version_latest

View File

@ -27,6 +27,7 @@
"macaroon_location": "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
"tls_location": "/home/bitcoin/.lnd/tls.cert",
"lnd_log_location": "/home/bitcoin/.lnd/logs/bitcoin/mainnet/lnd.log",
"lncli_location": "/home/bitcoin/go/bin",
"node_ip": "localhost",
"lnd_ip": "localhost",
"node_http_protocol": "http",

View File

@ -13,6 +13,6 @@
},
"production": {
"dialect": "sqlite",
"storage": "/mnt/hdd/mynode/sphinx-relay/sphinx.db"
"storage": "/mnt/hdd/mynode/sphinxrelay/sphinx.db"
}
}

View File

@ -82,13 +82,13 @@ def disable_ckbunker():
def is_sphinxrelay_enabled():
return is_service_enabled("thunderhub")
return is_service_enabled("sphinxrelay")
def enable_sphinxrelay():
os.system("systemctl enable sphinx-relay --no-pager")
os.system("systemctl start sphinx-relay --no-pager")
os.system("systemctl enable sphinxrelay --no-pager")
os.system("systemctl start sphinxrelay --no-pager")
def disable_sphinxrelay():
os.system("systemctl stop sphinx-relay --no-pager")
os.system("systemctl disable sphinx-relay --no-pager")
os.system("systemctl stop sphinxrelay --no-pager")
os.system("systemctl disable sphinxrelay --no-pager")
def is_btcrpcexplorer_enabled():

View File

@ -7,6 +7,7 @@ from bitcoind import mynode_bitcoind
from whirlpool import mynode_whirlpool, get_whirlpool_status
from dojo import mynode_dojo, get_dojo_status
from caravan import mynode_caravan
from sphinxrelay import mynode_sphinxrelay
from manage_apps import mynode_manage_apps
from tor import mynode_tor
from vpn import mynode_vpn
@ -77,6 +78,7 @@ app.register_blueprint(mynode_api)
app.register_blueprint(mynode_whirlpool)
app.register_blueprint(mynode_dojo)
app.register_blueprint(mynode_caravan)
app.register_blueprint(mynode_sphinxrelay)
app.register_blueprint(mynode_manage_apps)
app.register_blueprint(mynode_tor)
app.register_blueprint(mynode_electrum_server)

View File

@ -241,6 +241,12 @@ def page_status():
"thunderhub_status_log": thunderhub_status_log,
"thunderhub_status": get_service_status_basic_text("thunderhub"),
"thunderhub_status_color": get_service_status_color("thunderhub"),
"ckbunker_status_log": ckbunker_status_log,
"ckbunker_status": get_service_status_basic_text("ckbunker"),
"ckbunker_status_color": get_service_status_color("ckbunker"),
"sphinxrelay_status_log": sphinxrelay_status_log,
"sphinxrelay_status": get_service_status_basic_text("sphinxrelay"),
"sphinxrelay_status_color": get_service_status_color("sphinxrelay"),
"docker_status_log": docker_status_log,
"docker_status": get_service_status_basic_text("docker"),
"docker_status_color": get_service_status_color("docker"),

View File

@ -0,0 +1,32 @@
from flask import Blueprint, render_template, redirect
from user_management import check_logged_in
from device_info import read_ui_settings, get_file_contents
from systemctl_info import *
import subprocess
import os
mynode_sphinxrelay = Blueprint('mynode_sphinxrelay',__name__)
### Functions
def get_connection_string():
s = get_file_contents("/opt/mynode/sphinxrelay/connection_string.txt")
return s
### Page functions
@mynode_sphinxrelay.route("/sphinxrelay")
def sphinxrelay_page():
check_logged_in()
sphinxrelay_status = "Error"
if get_service_status_code("sphinxrelay") == 0:
sphinxrelay_status = "Running"
# Load page
templateData = {
"title": "myNode Sphinx Relay",
"ui_settings": read_ui_settings(),
"sphinxrelay_status": sphinxrelay_status,
"sphinxrelay_connection_string": get_connection_string(),
}
return render_template('sphinxrelay.html', **templateData)

View File

@ -309,10 +309,10 @@ td {
line-height: 130%;
}
.app_beta_tag_image {
width: 40px;
height: 40px;
width: 50px;
height: 50px;
position: absolute;
left: 110px;
left: 100px;
top: 0px;
}
.app_contents {

View File

@ -228,7 +228,6 @@
<div class="app_status_icon {{ ckbunker_status_color }}" id="ckbunker_status_icon"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/ckbunker.png")}}"/></div>
<img class="app_beta_tag_image" src="{{ url_for('static', filename="images/beta.png")}}"/>
<div class="app_title">CKBunker</div>
<div class="app_status" id="ckbunker_status">{{ ckbunker_status }}</div>
<div class="app_contents">
@ -244,6 +243,27 @@
{% endif %}
</div>
</div>
<!--
<div class="app_tile">
<div class="app_status_icon {{ sphinxrelay_status_color }}" id="sphinxrelay_status_icon"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/sphinx.png")}}"/></div>
<img class="app_beta_tag_image" src="{{ url_for('static', filename="images/beta.png")}}"/>
<div class="app_title">Sphinx Relay</div>
<div class="app_status" id="sphinxrelay_status">{{ sphinxrelay_status }}</div>
<div class="app_contents">
{% if product_key_skipped %}
Premium Feature
{% else %}
{% if sphinxrelay_enabled %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="/sphinxrelay">Info</a>
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-sphinxrelay">Disable</a>
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-sphinxrelay">Enable</a>
{% endif %}
{% endif %}
</div>
</div>
-->
</div>
<!-- BETA APPS -->

View File

@ -0,0 +1,48 @@
<!DOCTYPE html lang="en">
<head>
<title>{{ title }}</title>
{% include 'includes/head.html' %}
</head>
<body>
{% include 'includes/logo_header.html' %}
<div class="mynode_back_div">
<a class="ui-button ui-widget ui-corner-all mynode_back" href="/"><span class="ui-icon ui-icon-home"></span>home&nbsp;</a>
</div>
<div class="main_header">Sphinx Relay</div>
<br/>
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">Status</div>
<div class="info_tile_contents">{{sphinxrelay_status}}</div>
</div>
</div>
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">Connection String</div>
<div class="info_tile_contents">{{sphinxrelay_connection_string}}</div>
</div>
</div>
<div class="instructions">
<div class="instructions-header">Instructions to setup Sphinx Relay</div>
<ol class="instructions-steps">
<li>Ensure that Sphinx Relay is enabled and you see "Running" on the status tile.</li>
<li>Download and install Sphinx from <a href="https://sphinx.chat/" target="_blank">sphinx.chat</a>.</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>Enjoy!</li>
</ol>
<br/><br/>
</div>
</body>
</html>

View File

@ -106,6 +106,16 @@
$("#caravan_status").show();
});
$("#show_ckbunker_status").on("click", function() {
$("#show_ckbunker_status").hide(0);
$("#ckbunker_status").show();
});
$("#show_sphinxrelay_status").on("click", function() {
$("#show_sphinxrelay_status").hide(0);
$("#sphinxrelay_status").show();
});
$("#show_upgrade_status").on("click", function() {
$("#show_upgrade_status").hide(0);
$("#upgrade_status").show();
@ -392,6 +402,26 @@
<div id="caravan_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{caravan_status_log}}</pre></div>
<div class="divider"></div>
<div class="settings_block_subheader">CKBunker Status</div>
<div class="settings_block_subheader_status">
<div class="settings_block_subheader_status_icon {{ ckbunker_status_color }}"></div>
{{ ckbunker_status }}
</div>
<button id="show_ckbunker_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show Log</button>
<div id="ckbunker_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{ckbunker_status_log}}</pre></div>
<div class="divider"></div>
{% if lnd_wallet_exists %}
<div class="settings_block_subheader">Sphinx Relay Status</div>
<div class="settings_block_subheader_status">
<div class="settings_block_subheader_status_icon {{ sphinxrelay_status_color }}"></div>
{{ sphinxrelay_status }}
</div>
<button id="show_sphinxrelay_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show Log</button>
<div id="sphinxrelay_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{sphinxrelay_status_log}}</pre></div>
<div class="divider"></div>
{% endif %}
{% if is_netdata_enabled %}
<div class="settings_block_subheader">Netdata Status</div>
<div class="settings_block_subheader_status">

View File

@ -18,7 +18,7 @@ apps = [{"name": "bitcoin/bitcoin", "current_version_var
{"name": "Coldcard/ckbunker", "current_version_variable": "CKBUNKER_VERSION"},
{"name": "lnbits/lnbits", "current_version": "6cf4881"},
{"name": "apotdevin/thunderhub", "current_version_variable": "THUNDERHUB_VERSION"},
{"name": "stakwork/sphinx-relay", "current_version_variable": "SPHINX_RELAY_VERSION"},
{"name": "stakwork/sphinx-relay", "current_version_variable": "SPHINXRELAY_VERSION"},
{"name": "whirlpool/whirlpool-client-cli", "current_version": "v0.10.9"},
{"name": "dojo/samourai-dojo", "current_version": "v1.8.0"},
{"name": "JoinMarket-Org/joinmarket-clientserver", "current_version_variable": "JOINMARKET_VERSION"}

View File

@ -786,23 +786,23 @@ fi
# Upgrade Sphinx Relay
SPHINX_RELAY_UPGRADE_URL=https://github.com/stakwork/sphinx-relay/archive/$SPHINX_RELAY_VERSION.tar.gz
SPHINXRELAY_UPGRADE_URL=https://github.com/stakwork/sphinx-relay/archive/$SPHINXRELAY_VERSION.tar.gz
CURRENT=""
if [ -f $SPHINX_RELAY_VERSION_FILE ]; then
CURRENT=$(cat $SPHINX_RELAY_VERSION_FILE)
if [ -f $SPHINXRELAY_VERSION_FILE ]; then
CURRENT=$(cat $SPHINXRELAY_VERSION_FILE)
fi
if [ "$CURRENT" != "$SPHINX_RELAY_VERSION" ]; then
if [ "$CURRENT" != "$SPHINXRELAY_VERSION" ]; then
cd /opt/mynode
rm -rf sphinx-relay
sudo -u bitcoin wget $SPHINX_RELAY_UPGRADE_URL -O sphinx-relay.tar.gz
rm -rf sphinxrelay
sudo -u bitcoin wget $SPHINXRELAY_UPGRADE_URL -O sphinx-relay.tar.gz
sudo -u bitcoin tar -xvf sphinx-relay.tar.gz
sudo -u bitcoin rm sphinx-relay.tar.gz
sudo -u bitcoin mv sphinx-relay-* sphinx-relay
cd sphinx-relay
sudo -u bitcoin mv sphinx-relay-* sphinxrelay
cd sphinxrelay
sudo -u bitcoin npm install
echo $SPHINX_RELAY_VERSION > $SPHINX_RELAY_VERSION_FILE
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_VERSION_FILE
fi