Delay docker containers until drive is mounted
This commit is contained in:
parent
1c807daec8
commit
172828bd3b
22
rootfs/standard/etc/systemd/system/docker_images.service
Normal file
22
rootfs/standard/etc/systemd/system/docker_images.service
Normal file
|
@ -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
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
[Unit]
|
||||
Description=Netdata
|
||||
After=network.target
|
||||
Wants=mynode.service
|
||||
After=mynode.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/mynode/docker
|
||||
|
|
37
rootfs/standard/usr/bin/mynode_docker_images.sh
Executable file
37
rootfs/standard/usr/bin/mynode_docker_images.sh
Executable file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user