Improve Dojo install and add re-install option

This commit is contained in:
Taylor Helsper 2020-03-01 12:40:59 -06:00
parent 431ecda6ee
commit a9a039d2ac
8 changed files with 59 additions and 86 deletions

View File

@ -8,7 +8,7 @@ source /usr/share/mynode/mynode_config.sh
echo "Starting mynode_docker_images.sh ..."
# Drive should be mounted, let's still wait a bit
sleep 60s
sleep 10s
echo "Waiting on bitcoin to sync so drive usage is lower..."
/usr/bin/wait_on_bitcoin.sh
@ -68,6 +68,45 @@ while true; do
echo $MEMPOOLSPACE_UPGRADE_URL > $MEMPOOLSPACE_UPGRADE_URL_FILE
fi
# Install Dojo
DOJO_VERSION="v1.4.1"
DOJO_UPGRADE_URL=https://github.com/Samourai-Wallet/samourai-dojo/archive/$DOJO_VERSION.tar.gz
DOJO_UPGRADE_URL_FILE=/mnt/hdd/mynode/settings/dojo_url
CURRENT=""
INSTALL=true
if [ -f $DOJO_UPGRADE_URL_FILE ]; then
INSTALL=false
CURRENT=$(cat $DOJO_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$DOJO_UPGRADE_URL" ]; then
sudo mkdir -p /opt/mynode/.dojo
sudo mkdir -p /opt/mynode/dojo
sudo rm -rf /opt/mynode/.dojo/*
cd /opt/mynode/.dojo
sudo wget -O dojo.tar.gz $DOJO_UPGRADE_URL
sudo tar -zxvf dojo.tar.gz
sudo cp -r samourai-dojo*/* /opt/mynode/dojo
cd /usr/bin
sudo rm -rf /opt/mynode/.dojo/*
# Configure Dojo for MyNode
sudo ./mynode_gen_dojo_config.sh
# Run Dojo Install or Upgrade
cd /opt/mynode/dojo/docker/my-dojo
if [ "$INSTALL" = "true" ]; then
echo 'y' | sudo ./dojo.sh install &
else
echo 'y' | sudo ./dojo.sh upgrade &
fi
#Check for install/upgrade to finish to initialize Dojo mysql db
cd /usr/bin
sudo ./mynode_post_dojo.sh
echo $DOJO_UPGRADE_URL > $DOJO_UPGRADE_URL_FILE
fi
rm -f /tmp/installing_docker_images
# Wait a day

View File

@ -18,7 +18,7 @@ do
# Check if dojo mysql db is running (check the db container)
isRunning=$(docker inspect --format="{{.State.Running}}" db)
if [ $isRunning == "true" ]; then
if [ "$isRunning" == "true" ]; then
sleep 20s
docker exec -i db bash -c "mysql -h db -u root -p$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE" </opt/mynode/dojo/db-scripts/1_db.sql
echo "dojo mysql db initalized"

View File

@ -308,45 +308,6 @@ if [ "$CURRENT" != "$WHIRLPOOL_UPGRADE_URL" ]; then
echo $WHIRLPOOL_UPGRADE_URL > $WHIRLPOOL_UPGRADE_URL_FILE
fi
# Install Dojo
DOJO_VERSION="v1.4.1"
DOJO_UPGRADE_URL=https://github.com/Samourai-Wallet/samourai-dojo/archive/$DOJO_VERSION.tar.gz
DOJO_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.dojo_url
CURRENT=""
INSTALL=true
if [ -f $DOJO_UPGRADE_URL_FILE ]; then
INSTALL=false
CURRENT=$(cat $DOJO_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$DOJO_UPGRADE_URL" ]; then
sudo mkdir -p /opt/mynode/.dojo
sudo mkdir -p /opt/mynode/dojo
sudo rm -rf /opt/mynode/.dojo/*
cd /opt/mynode/.dojo
sudo wget -O dojo.tar.gz $DOJO_UPGRADE_URL
sudo tar -zxvf dojo.tar.gz
sudo cp -r samourai-dojo*/* /opt/mynode/dojo
cd /usr/bin
sudo rm -rf /opt/mynode/.dojo/*
# Configure Dojo for MyNode
sudo ./mynode_gen_dojo_config.sh
# Run Dojo Install or Upgrade
cd /opt/mynode/dojo/docker/my-dojo
if [ "$INSTALL" = "true" ]; then
echo 'y' | sudo ./dojo.sh install &
else
echo 'y' | sudo ./dojo.sh upgrade &
fi
#Check for install/upgrade to finish to initialize Dojo mysql db
cd /usr/bin
sudo ./mynode_post_dojo.sh
echo $DOJO_UPGRADE_URL > $DOJO_UPGRADE_URL_FILE
fi
# Upgrade RTL
RTL_VERSION="v0.6.7"

View File

@ -42,6 +42,10 @@ elif [ "$APP" = "webssh2" ]; then
docker rmi webssh2
elif [ "$APP" = "whirlpool" ]; then
rm -f /home/bitcoin/.mynode/.whirlpool_url
elif [ "$APP" = "dojo" ]; then
rm -f /mnt/hdd/mynode/settings/dojo_url
cd /opt/mynode/dojo/docker/my-dojo/
echo "y" | ./dojo.sh uninstall
else
echo "UNKNOWN APP: $APP"
exit 1

View File

@ -389,6 +389,9 @@ def index():
# Find dojo status
dojo_status, dojo_status_color, dojo_initialized = get_dojo_status()
if is_installing_docker_images():
dojo_status_color = "yellow"
dojo_status = "Installing..."
# Check for new version of software
upgrade_available = False
@ -407,6 +410,7 @@ def index():
"lnd_status": Markup(lnd_status),
"lnd_ready": lnd_ready,
"tor_status_color": tor_status_color,
"is_installing_docker_images": is_installing_docker_images(),
"electrs_status_color": electrs_status_color,
"electrs_status": Markup(electrs_status),
"electrs_enabled": is_electrs_enabled(),

View File

@ -79,12 +79,14 @@
<div class="app_title">Dojo</div>
<div class="app_status">{{ dojo_status }}</div>
<div class="app_contents">
{% if not is_installing_docker_images %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="/dojo">
{% if dojo_initialized %}Info{% else %}Info{% endif %}
</a>
<a class="ui-button ui-widget ui-corner-all mynode_button" href="/toggle-dojo">
{% if dojo_enabled %}Disable{% else %}Enable{% endif %}
</a>
{% endif %}
</div>
</div>
<div class="app_tile">
@ -114,11 +116,13 @@
{% if product_key_skipped %}
Premium Feature
{% else %}
{% if mempoolspace_enabled %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="mempoolspace">View</a>
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-mempoolspace">Disable</a>
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-mempoolspace">Enable</a>
{% if not is_installing_docker_images %}
{% if mempoolspace_enabled %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="mempoolspace">View</a>
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-mempoolspace">Disable</a>
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-mempoolspace">Enable</a>
{% endif %}
{% endif %}
{% endif %}
</div>

View File

@ -928,6 +928,7 @@
<option value="tor">Tor</option>
<option value="webssh2">WebSSH2</option>
<option value="whirlpool">Whirlpool</option>
<option value="dojo">Dojo</option>
</select>
<button id="reinstall_button">Reinstall</button>

View File

@ -399,46 +399,6 @@ if [ "$CURRENT" != "$WHIRLPOOL_UPGRADE_URL" ]; then
fi
# Install Dojo
DOJO_VERSION="v1.4.1"
DOJO_UPGRADE_URL=https://github.com/Samourai-Wallet/samourai-dojo/archive/$DOJO_VERSION.tar.gz
DOJO_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.dojo_url
CURRENT=""
INSTALL=true
if [ -f $DOJO_UPGRADE_URL_FILE ]; then
INSTALL=false
CURRENT=$(cat $DOJO_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$DOJO_UPGRADE_URL" ]; then
sudo mkdir -p /opt/mynode/.dojo
sudo mkdir -p /opt/mynode/dojo
sudo rm -rf /opt/mynode/.dojo/*
cd /opt/mynode/.dojo
sudo wget -O dojo.tar.gz $DOJO_UPGRADE_URL
sudo tar -zxvf dojo.tar.gz
sudo cp -r samourai-dojo*/* /opt/mynode/dojo
cd /usr/bin
sudo rm -rf /opt/mynode/.dojo/*
# Configure Dojo for MyNode
sudo ./mynode_gen_dojo_config.sh
# Run Dojo Install or Upgrade
cd /opt/mynode/dojo/docker/my-dojo
if [ "$INSTALL" = "true" ]; then
echo 'y' | sudo ./dojo.sh install &
else
echo 'y' | sudo ./dojo.sh upgrade &
fi
#Check for install/upgrade to finish to initialize Dojo mysql db
cd /usr/bin
sudo ./mynode_post_dojo.sh
echo $DOJO_UPGRADE_URL > $DOJO_UPGRADE_URL_FILE
fi
# Install RTL
RTL_VERSION="v0.6.7"
RTL_UPGRADE_URL=https://github.com/Ride-The-Lightning/RTL/archive/$RTL_VERSION.tar.gz