Dojo uses electrum server

This commit is contained in:
Taylor Helsper 2020-04-17 23:00:48 -05:00
parent dfd33190b4
commit a8a5b0399c
5 changed files with 82 additions and 42 deletions

View File

@ -82,6 +82,9 @@ sed -i 's|EXPLORER_INSTALL=on|EXPLORER_INSTALL=off|' /opt/mynode/dojo/docker/my-
# Enable electrs
sed -i 's|INDEXER_IP=.*|INDEXER_IP=172.28.0.1|' /opt/mynode/dojo/docker/my-dojo/conf/docker-indexer.conf.tpl
sed -i 's|INDEXER_BATCH_SUPPORT=.*|INDEXER_BATCH_SUPPORT=active|' /opt/mynode/dojo/docker/my-dojo/conf/docker-indexer.conf.tpl
sed -i 's|NODE_ACTIVE_INDEXER=.*|NODE_ACTIVE_INDEXER=local_indexer|' /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
# check if configuration files have been previously created and skip if yes
if [ -f /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf ]; then

View File

@ -92,44 +92,60 @@ def get_latest_beta_version():
beta_version = ""
return beta_version
def reinstall_app(app):
# Upgrade
os.system("mkdir -p /home/admin/reinstall_logs")
cmd = "/usr/bin/mynode_reinstall_app.sh {} > /home/admin/reinstall_logs/reinstall_{}.txt 2>&1".format(app,app)
subprocess.call(cmd, shell=True)
# Sync
def mark_upgrade_started():
os.system("touch /tmp/upgrade_started")
os.system("sync")
time.sleep(1)
# Reboot
reboot_device()
def is_upgrade_running():
return os.path.isfile("/tmp/upgrade_started")
def reinstall_app(app):
if not is_upgrade_running():
mark_upgrade_started()
# Upgrade
os.system("mkdir -p /home/admin/reinstall_logs")
cmd = "/usr/bin/mynode_reinstall_app.sh {} > /home/admin/reinstall_logs/reinstall_{}.txt 2>&1".format(app,app)
subprocess.call(cmd, shell=True)
# Sync
os.system("sync")
time.sleep(1)
# Reboot
reboot_device()
def upgrade_device():
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
cmd = "/usr/bin/mynode_upgrade.sh > /home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt 2>&1".format(get_current_version())
subprocess.call(cmd, shell=True)
# Sync
os.system("sync")
time.sleep(1)
if not is_upgrade_running():
mark_upgrade_started()
# Reboot
reboot_device()
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
cmd = "/usr/bin/mynode_upgrade.sh > /home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt 2>&1".format(get_current_version())
subprocess.call(cmd, shell=True)
# Sync
os.system("sync")
time.sleep(1)
# Reboot
reboot_device()
def upgrade_device_beta():
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
cmd = "/usr/bin/mynode_upgrade.sh beta > /home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt 2>&1".format(get_current_version())
subprocess.call(cmd, shell=True)
# Sync
os.system("sync")
time.sleep(1)
if not is_upgrade_running():
mark_upgrade_started()
# Reboot
reboot_device()
# Upgrade
os.system("mkdir -p /home/admin/upgrade_logs")
cmd = "/usr/bin/mynode_upgrade.sh beta > /home/admin/upgrade_logs/upgrade_log_from_{}_upgrade.txt 2>&1".format(get_current_version())
subprocess.call(cmd, shell=True)
# Sync
os.system("sync")
time.sleep(1)
# Reboot
reboot_device()
def did_upgrade_fail():
return os.path.isfile("/mnt/hdd/mynode/settings/upgrade_error")

View File

@ -4,6 +4,7 @@ from settings import read_ui_settings
from user_management import check_logged_in
from enable_disable_functions import is_dojo_enabled, enable_dojo, disable_dojo
from bitcoin_info import get_mynode_block_height
from electrum_info import get_electrs_status
import subprocess
import re
import os
@ -86,6 +87,7 @@ def dojo_page():
"dojo_enabled": is_dojo_enabled(),
"dojo_initialized": dojo_initialized,
"dojo_tracker_status": get_dojo_tracker_status(),
"electrs_status": get_electrs_status(),
"NODE_ADMIN_KEY": NODE_ADMIN_KEY,
"DOJO_V3_ADDR": DOJO_V3_ADDR
}

View File

@ -1,5 +1,6 @@
from bitcoin_info import get_bitcoin_block_height
from prometheus_client.parser import text_string_to_metric_families
from enable_disable_functions import is_electrs_enabled
import subprocess
import requests
import socket
@ -41,6 +42,10 @@ def is_electrs_active():
def get_electrs_status():
global electrum_server_current_block
global electrs_active
if not is_electrs_enabled():
return "Disabled"
bitcoin_block_height = get_bitcoin_block_height()
log = ""
try:
@ -54,6 +59,8 @@ def get_electrs_status():
break
elif "Checking if Bitcoin is synced..." in line or "NetworkInfo {" in line or "BlockchainInfo {" in line:
return "Starting..."
elif "opening DB at" in line or "enabling auto-compactions" in line:
return "Starting..."
elif "downloading 100000 block headers" in line:
return "Downloading headers..."
elif "starting full compaction" in line:

View File

@ -21,6 +21,10 @@
<div class="info_tile_header">Tracker Status</div>
<div class="info_tile_contents">{{dojo_tracker_status}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Electrum Server Status</div>
<div class="info_tile_contents">{{electrs_status}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Restart</div>
<div class="info_tile_contents">
@ -30,21 +34,29 @@
{% endif %}
</div>
</br>
<div class="app_tile_row">
{% if dojo_enabled and dojo_initialized %}
<div class="info_tile">
<div class="info_tile_header">Dojo V3 Onion Address</div>
<div class="info_tile_contents">{{DOJO_V3_ADDR}}</div>
{% if dojo_enabled and dojo_initialized and dojo_tracker_status == "Active" and electrs_status == "Running" %}
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">Dojo V3 Onion Address</div>
<div class="info_tile_contents">{{DOJO_V3_ADDR}}</div>
</div>
</div>
</div>
</br>
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">NODE_ADMIN_KEY</div>
<div class="info_tile_contents">{{NODE_ADMIN_KEY}}</div>
</br>
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">NODE_ADMIN_KEY</div>
<div class="info_tile_contents">{{NODE_ADMIN_KEY}}</div>
</div>
</div>
{% elif electrs_status != "Running" %}
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">Note</div>
<div class="info_tile_contents">Please enable electrum server...</div>
</div>
</div>
{% endif %}
</div>
<div class="instructions">
<div class="instructions-header"><u><strong>Instructions to CONNECT Samourai Wallet to Dojo</u></strong></div>
</br>