Move Dojo files to HDD
This commit is contained in:
parent
6a2c0caa42
commit
52ba2e766b
|
@ -11,9 +11,9 @@ RemainAfterExit=yes
|
|||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStartPre=/usr/bin/wait_on_docker_image_install.sh
|
||||
WorkingDirectory=/opt/mynode/dojo/docker/my-dojo
|
||||
ExecStart=/opt/mynode/dojo/docker/my-dojo/dojo.sh start
|
||||
ExecStop=/opt/mynode/dojo/docker/my-dojo/dojo.sh stop
|
||||
WorkingDirectory=/mnt/hdd/mynode/dojo/docker/my-dojo
|
||||
ExecStart=/mnt/hdd/mynode/dojo/docker/my-dojo/dojo.sh start
|
||||
ExecStop=/mnt/hdd/mynode/dojo/docker/my-dojo/dojo.sh stop
|
||||
User=root
|
||||
Group=root
|
||||
KillMode=control-group
|
||||
|
|
|
@ -91,10 +91,10 @@ while true; do
|
|||
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 mkdir -p /opt/download/dojo
|
||||
sudo mkdir -p /mnt/hdd/mynode/dojo
|
||||
sudo rm -rf /opt/download/dojo/*
|
||||
cd /opt/download/dojo
|
||||
sudo wget -O dojo.tar.gz $DOJO_UPGRADE_URL
|
||||
|
||||
# verify tar file
|
||||
|
@ -102,15 +102,15 @@ while true; do
|
|||
sha256sum --check /tmp/dojo_hash
|
||||
|
||||
sudo tar -zxvf dojo.tar.gz
|
||||
sudo cp -r samourai-dojo*/* /opt/mynode/dojo
|
||||
sudo cp -r samourai-dojo*/* /mnt/hdd/mynode/dojo
|
||||
cd /usr/bin
|
||||
sudo rm -rf /opt/mynode/.dojo/*
|
||||
sudo rm -rf /opt/download/dojo/*
|
||||
|
||||
# Configure Dojo for MyNode
|
||||
sudo ./mynode_gen_dojo_config.sh
|
||||
|
||||
# Run Dojo Install or Upgrade
|
||||
cd /opt/mynode/dojo/docker/my-dojo
|
||||
cd /mnt/hdd/mynode/dojo/docker/my-dojo
|
||||
INSTALL_PID=0
|
||||
if [ "$INSTALL" = "true" ]; then
|
||||
yes | sudo ./dojo.sh install &
|
||||
|
|
|
@ -6,8 +6,8 @@ set -e
|
|||
source /usr/share/mynode/mynode_config.sh
|
||||
|
||||
# replace Dojo bitcoind.conf.tpl with custom conf for MyNode
|
||||
rm -rf /opt/mynode/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
|
||||
touch /opt/mynode/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
|
||||
rm -rf /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
|
||||
touch /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
|
||||
|
||||
RPC_PASS=$(cat /mnt/hdd/mynode/settings/.btcrpc_environment | cut -c 18- )
|
||||
|
||||
|
@ -75,63 +75,63 @@ BITCOIND_ZMQ_RAWTXS=28333
|
|||
# Port exposing ZMQ notifications for block hashes Set value to 9502 if
|
||||
# BITCOIND_INSTALL is set to 'on' Type: integer
|
||||
BITCOIND_ZMQ_BLK_HASH=28334
|
||||
" | sudo tee -a /opt/mynode/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
|
||||
" | sudo tee -a /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
|
||||
|
||||
# Turn off explorer for MyNode
|
||||
sed -i 's|EXPLORER_INSTALL=on|EXPLORER_INSTALL=off|' /opt/mynode/dojo/docker/my-dojo/conf/docker-explorer.conf.tpl
|
||||
sed -i 's|EXPLORER_INSTALL=on|EXPLORER_INSTALL=off|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-explorer.conf.tpl
|
||||
|
||||
# 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|NODE_ACTIVE_INDEXER=.*|NODE_ACTIVE_INDEXER=local_indexer|' /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
sed -i 's|INDEXER_IP=.*|INDEXER_IP=172.28.0.1|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-indexer.conf.tpl
|
||||
sed -i 's|NODE_ACTIVE_INDEXER=.*|NODE_ACTIVE_INDEXER=local_indexer|' /mnt/hdd/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
|
||||
if [ -f /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-node.conf ]; then
|
||||
echo "File present - skip docker-node.conf"
|
||||
else
|
||||
# Modify node.conf to enter random generated passwords
|
||||
NODE_API_KEY=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | head -c${1:-64})
|
||||
sed -i 's|NODE_API_KEY=.*|NODE_API_KEY='$NODE_API_KEY'|' /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
sed -i 's|NODE_API_KEY=.*|NODE_API_KEY='$NODE_API_KEY'|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
|
||||
NODE_ADMIN_KEY=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | head -c${1:-48})
|
||||
sed -i 's|NODE_ADMIN_KEY=.*|NODE_ADMIN_KEY='$NODE_ADMIN_KEY'|' /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
sed -i 's|NODE_ADMIN_KEY=.*|NODE_ADMIN_KEY='$NODE_ADMIN_KEY'|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
|
||||
NODE_JWT_SECRET=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | head -c${1:-48})
|
||||
sed -i 's|NODE_JWT_SECRET=.*|NODE_JWT_SECRET='$NODE_JWT_SECRET'|' /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
sed -i 's|NODE_JWT_SECRET=.*|NODE_JWT_SECRET='$NODE_JWT_SECRET'|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-node.conf.tpl
|
||||
fi
|
||||
|
||||
# check if configuration files have been previously created and skip if yes
|
||||
if [ -f /opt/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf ]; then
|
||||
if [ -f /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf ]; then
|
||||
echo "File present - skip docker-mysql.conf"
|
||||
else
|
||||
# Modify mysql.conf to enter random generated passwords
|
||||
MYSQL_ROOT_PASSWORD=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | head -c${1:-64})
|
||||
sed -i 's|MYSQL_ROOT_PASSWORD=.*|MYSQL_ROOT_PASSWORD='$MYSQL_ROOT_PASSWORD'|' /opt/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
|
||||
sed -i 's|MYSQL_ROOT_PASSWORD=.*|MYSQL_ROOT_PASSWORD='$MYSQL_ROOT_PASSWORD'|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
|
||||
|
||||
MYSQL_USER=mynode
|
||||
sed -i 's|MYSQL_USER=.*|MYSQL_USER='$MYSQL_USER'|' /opt/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
|
||||
sed -i 's|MYSQL_USER=.*|MYSQL_USER='$MYSQL_USER'|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
|
||||
|
||||
MYSQL_PASSWORD=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | head -c${1:-64})
|
||||
sed -i 's|MYSQL_PASSWORD=.*|MYSQL_PASSWORD='$MYSQL_PASSWORD'|' /opt/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
|
||||
sed -i 's|MYSQL_PASSWORD=.*|MYSQL_PASSWORD='$MYSQL_PASSWORD'|' /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
|
||||
fi
|
||||
|
||||
# Modify for Raspbian devices
|
||||
if [ $IS_RASPI = 1 ]; then
|
||||
# Modify mysql Dockerfile for Raspbian devices
|
||||
sed -i 's|FROM.*|FROM hypriot/rpi-mysql:latest|' /opt/mynode/dojo/docker/my-dojo/mysql/Dockerfile
|
||||
sed -i 's|FROM.*|FROM hypriot/rpi-mysql:latest|' /mnt/hdd/mynode/dojo/docker/my-dojo/mysql/Dockerfile
|
||||
# Modify Tor Dockerfile for ARMv6/7 devices
|
||||
sed -i 's|ENV GOLANG_ARCHIVE.*|ENV GOLANG_ARCHIVE go1.13.6.linux-armv6l.tar.gz|' /opt/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
sed -i 's|ENV GOLANG_SHA256.*|ENV GOLANG_SHA256 37a1a83e363dcf146a67fa839d170fd1afb13009585fdd493d0a3370fbe6f785|' /opt/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
sed -i 's|ENV GOLANG_ARCHIVE.*|ENV GOLANG_ARCHIVE go1.13.6.linux-armv6l.tar.gz|' /mnt/hdd/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
sed -i 's|ENV GOLANG_SHA256.*|ENV GOLANG_SHA256 37a1a83e363dcf146a67fa839d170fd1afb13009585fdd493d0a3370fbe6f785|' /mnt/hdd/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
fi
|
||||
|
||||
# Modify for Rock64 devices
|
||||
if [ $IS_ROCK64 = 1 ] || [ $IS_ROCKPRO64 = 1 ]; then
|
||||
# Modify mysql Dockerfile for Rock64 devices
|
||||
sed -i 's|FROM.*|FROM mariadb:latest|' /opt/mynode/dojo/docker/my-dojo/mysql/Dockerfile
|
||||
sed -i 's|FROM.*|FROM mariadb:latest|' /mnt/hdd/mynode/dojo/docker/my-dojo/mysql/Dockerfile
|
||||
# Modify Tor Dockerfile for ARMv8 devices
|
||||
sed -i 's|ENV GOLANG_ARCHIVE.*|ENV GOLANG_ARCHIVE go1.13.6.linux-arm64.tar.gz|' /opt/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
sed -i 's|ENV GOLANG_SHA256.*|ENV GOLANG_SHA256 0a18125c4ed80f9c3045cf92384670907c4796b43ed63c4307210fe93e5bbca5|' /opt/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
sed -i 's|ENV GOLANG_ARCHIVE.*|ENV GOLANG_ARCHIVE go1.13.6.linux-arm64.tar.gz|' /mnt/hdd/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
sed -i 's|ENV GOLANG_SHA256.*|ENV GOLANG_SHA256 0a18125c4ed80f9c3045cf92384670907c4796b43ed63c4307210fe93e5bbca5|' /mnt/hdd/mynode/dojo/docker/my-dojo/tor/Dockerfile
|
||||
fi
|
||||
|
||||
# Modify restart policy
|
||||
sed -i 's|restart:.*|restart: on-failure|' /opt/mynode/dojo/docker/my-dojo/docker-compose.yaml
|
||||
sed -i 's|restart:.*|restart: on-failure|' /mnt/hdd/mynode/dojo/docker/my-dojo/docker-compose.yaml
|
|
@ -16,19 +16,19 @@ MYSQL_DATABASE=samourai-main
|
|||
while [ $counter != $target ]
|
||||
do
|
||||
|
||||
source /opt/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf || exit 0
|
||||
source /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf || exit 0
|
||||
|
||||
# Check if dojo mysql db is running (check the db container)
|
||||
isRunning=$(docker inspect --format="{{.State.Running}}" db)
|
||||
if [ "$isRunning" == "true" ]; then
|
||||
sleep 60s
|
||||
if [ $IS_RASPI == 1 ]; then
|
||||
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
|
||||
docker exec -i db bash -c "mysql -h db -u root -p$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE" </mnt/hdd/mynode/dojo/db-scripts/1_db.sql
|
||||
fi
|
||||
echo "dojo mysql db initalized"
|
||||
sleep 5s
|
||||
# Stop dojo after install/update and initalization is complete
|
||||
cd /opt/mynode/dojo/docker/my-dojo
|
||||
cd /mnt/hdd/mynode/dojo/docker/my-dojo
|
||||
sudo ./dojo.sh stop
|
||||
counter=$target
|
||||
else
|
||||
|
|
|
@ -69,15 +69,15 @@ elif [ "$APP" = "whirlpool" ]; then
|
|||
rm -f $WHIRLPOOL_VERSION_FILE
|
||||
elif [ "$APP" = "dojo" ]; then
|
||||
rm -f /mnt/hdd/mynode/settings/dojo_url
|
||||
cd /opt/mynode/dojo/docker/my-dojo/
|
||||
cd /mnt/hdd/mynode/dojo/docker/my-dojo/
|
||||
|
||||
# Stop and uninstall
|
||||
yes | ./dojo.sh uninstall
|
||||
|
||||
# Reset config files
|
||||
cd ~
|
||||
rm -rf /opt/mynode/.dojo
|
||||
rm -rf /opt/mynode/dojo
|
||||
rm -rf /opt/download/dojo
|
||||
rm -rf /mnt/hdd/mynode/dojo
|
||||
else
|
||||
echo "UNKNOWN APP: $APP"
|
||||
exit 1
|
||||
|
|
|
@ -249,6 +249,12 @@ if [ ! -L /home/admin/.pool ]; then
|
|||
ln -s /mnt/hdd/mynode/pool /home/admin/.pool
|
||||
fi
|
||||
|
||||
# Dojo - move to HDD
|
||||
if [ -d /opt/mynode/dojo ] && [ ! -d /mnt/hdd/mynode/dojo ] ; then
|
||||
mv /opt/mynode/dojo /mnt/hdd/mynode/dojo
|
||||
fi
|
||||
|
||||
|
||||
# RTL config
|
||||
sudo -u bitcoin mkdir -p /opt/mynode/RTL
|
||||
sudo -u bitcoin mkdir -p /mnt/hdd/mynode/rtl
|
||||
|
|
|
@ -14,7 +14,7 @@ systemctl stop thunderhub mempoolspace
|
|||
|
||||
|
||||
# Manually stop services (backup)
|
||||
/opt/mynode/dojo/docker/my-dojo/dojo.sh stop || true
|
||||
/mnt/hdd/mynode/dojo/docker/my-dojo/dojo.sh stop || true
|
||||
|
||||
|
||||
# Stop core services
|
||||
|
|
|
@ -61,7 +61,7 @@ def is_shutting_down():
|
|||
def factory_reset():
|
||||
# Try and make sure drive is r/w
|
||||
os.system("mount -o remount,rw /mnt/hdd")
|
||||
|
||||
|
||||
# Reset subsystems that have local data
|
||||
delete_quicksync_data()
|
||||
|
||||
|
@ -835,8 +835,8 @@ def reset_docker():
|
|||
os.system("rm -f /mnt/hdd/mynode/settings/dojo_url")
|
||||
|
||||
# Delete Dojo files
|
||||
os.system("rm -rf /opt/mynode/.dojo")
|
||||
os.system("rm -rf /opt/mynode/dojo")
|
||||
os.system("rm -rf /opt/download/dojo")
|
||||
os.system("rm -rf /mnt/hdd/mynode/dojo")
|
||||
|
||||
os.system("sync")
|
||||
reboot_device()
|
||||
|
|
|
@ -68,7 +68,7 @@ def get_dojo_tracker_status():
|
|||
def get_dojo_version():
|
||||
version = "Unknown"
|
||||
try:
|
||||
version = subprocess.check_output("cat /opt/mynode/dojo/docker/my-dojo/.env | grep -i DOJO_VERSION_TAG", shell=True)
|
||||
version = subprocess.check_output("cat /mnt/hdd/mynode/dojo/docker/my-dojo/.env | grep -i DOJO_VERSION_TAG", shell=True)
|
||||
version = version.split("=")[1]
|
||||
version = version.strip()
|
||||
except:
|
||||
|
@ -78,7 +78,7 @@ def get_dojo_version():
|
|||
def get_dojo_admin_key():
|
||||
key = 'Not found'
|
||||
try:
|
||||
key = subprocess.check_output("cat /opt/mynode/dojo/docker/my-dojo/conf/docker-node.conf | grep -i NODE_ADMIN_KEY= | cut -c 16-", shell=True)
|
||||
key = subprocess.check_output("cat /mnt/hdd/mynode/dojo/docker/my-dojo/conf/docker-node.conf | grep -i NODE_ADMIN_KEY= | cut -c 16-", shell=True)
|
||||
key = key.strip()
|
||||
except:
|
||||
key = 'error'
|
||||
|
|
Loading…
Reference in New Issue
Block a user