diff --git a/rootfs/standard/etc/systemd/system/docker_images.service b/rootfs/standard/etc/systemd/system/docker_images.service new file mode 100644 index 00000000..db674b89 --- /dev/null +++ b/rootfs/standard/etc/systemd/system/docker_images.service @@ -0,0 +1,22 @@ +# myNode Install Docker Images +# /etc/systemd/system/docker_images.service + +[Unit] +Description=myNode Install Docker Images +Wants=mynode.service +After=mynode.service + +[Service] +Type=simple +KillMode=control-group +ExecStart=/usr/bin/mynode_docker_images.sh +User=root +Group=root +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=mynode_docker_images +Restart=always +RestartSec=300 + +[Install] +WantedBy=multi-user.target diff --git a/rootfs/standard/etc/systemd/system/netdata.service b/rootfs/standard/etc/systemd/system/netdata.service index 452f9d93..93ed3e25 100644 --- a/rootfs/standard/etc/systemd/system/netdata.service +++ b/rootfs/standard/etc/systemd/system/netdata.service @@ -3,7 +3,8 @@ [Unit] Description=Netdata -After=network.target +Wants=mynode.service +After=mynode.service [Service] WorkingDirectory=/opt/mynode/docker diff --git a/rootfs/standard/usr/bin/mynode_docker_images.sh b/rootfs/standard/usr/bin/mynode_docker_images.sh new file mode 100755 index 00000000..61cfb924 --- /dev/null +++ b/rootfs/standard/usr/bin/mynode_docker_images.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -e +set -x + +source /usr/share/mynode/mynode_config.sh + +# Drive should be mounted, let's still wait a bit +sleep 60s + +# Loop and check every 1 day +while [ 1 ]; do + + # Upgrade WebSSH2 + WEBSSH2_UPGRADE_URL=https://github.com/billchurch/webssh2/archive/v0.2.10-0.tar.gz + WEBSSH2_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.webssh2_url + CURRENT="" + if [ -f $WEBSSH2_UPGRADE_URL_FILE ]; then + CURRENT=$(cat $WEBSSH2_UPGRADE_URL_FILE) + fi + if [ "$CURRENT" != "$WEBSSH2_UPGRADE_URL" ]; then + cd /opt/mynode + rm -rf webssh2 + wget $WEBSSH2_UPGRADE_URL -O webssh2.tar.gz + tar -xvf webssh2.tar.gz + rm webssh2.tar.gz + mv webssh2-* webssh2 + cd webssh2 + mv app/config.json.sample app/config.json + docker build -t webssh2 . + + echo $WEBSSH2_UPGRADE_URL > $WEBSSH2_UPGRADE_URL_FILE + fi + + # Check again in a day + sleep 24h +done diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 031c7a68..9e207cdc 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -250,27 +250,6 @@ if [ "$CURRENT" != "$BTCRPCEXPLORER_UPGRADE_URL" ]; then echo $BTCRPCEXPLORER_UPGRADE_URL > $BTCRPCEXPLORER_UPGRADE_URL_FILE fi -# Upgrade WebSSH2 -WEBSSH2_UPGRADE_URL=https://github.com/billchurch/webssh2/archive/v0.2.10-0.tar.gz -WEBSSH2_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.webssh2_url -CURRENT="" -if [ -f $WEBSSH2_UPGRADE_URL_FILE ]; then - CURRENT=$(cat $WEBSSH2_UPGRADE_URL_FILE) -fi -if [ "$CURRENT" != "$WEBSSH2_UPGRADE_URL" ]; then - cd /opt/mynode - rm -rf webssh2 - wget $WEBSSH2_UPGRADE_URL -O webssh2.tar.gz - tar -xvf webssh2.tar.gz - rm webssh2.tar.gz - mv webssh2-* webssh2 - cd webssh2 - mv app/config.json.sample app/config.json - docker build -t webssh2 . - - echo $WEBSSH2_UPGRADE_URL > $WEBSSH2_UPGRADE_URL_FILE -fi - # Install ngrok for debugging if [ ! -f /usr/bin/ngrok ]; then @@ -290,6 +269,7 @@ systemctl enable firewall systemctl enable invalid_block_check systemctl enable usb_driver_check systemctl enable https +systemctl enable docker_images systemctl enable glances systemctl enable netdata systemctl enable webssh2 diff --git a/setup/setup_device.sh b/setup/setup_device.sh index f908475e..8c5226aa 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -350,27 +350,6 @@ if [ "$CURRENT" != "$LNDCONNECT_UPGRADE_URL" ]; then echo $LNDCONNECT_UPGRADE_URL > $LNDCONNECT_UPGRADE_URL_FILE fi -# Install WebSSH2 -WEBSSH2_UPGRADE_URL=https://github.com/billchurch/webssh2/archive/v0.2.10-0.tar.gz -WEBSSH2_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.webssh2_url -CURRENT="" -if [ -f $WEBSSH2_UPGRADE_URL_FILE ]; then - CURRENT=$(cat $WEBSSH2_UPGRADE_URL_FILE) -fi -if [ "$CURRENT" != "$WEBSSH2_UPGRADE_URL" ]; then - cd /opt/mynode - rm -rf webssh2 - wget $WEBSSH2_UPGRADE_URL -O webssh2.tar.gz - tar -xvf webssh2.tar.gz - rm webssh2.tar.gz - mv webssh2-* webssh2 - cd webssh2 - mv app/config.json.sample app/config.json - docker build -t webssh2 . - - echo $WEBSSH2_UPGRADE_URL > $WEBSSH2_UPGRADE_URL_FILE -fi - # Install ngrok for debugging if [ ! -f /usr/bin/ngrok ]; then @@ -428,6 +407,7 @@ systemctl enable rtl systemctl enable tor systemctl enable invalid_block_check systemctl enable usb_driver_check +systemctl enable docker_images systemctl enable glances systemctl enable netdata systemctl enable webssh2