From a4e9b9316be85d12a2bf32403d6518c02a220cf4 Mon Sep 17 00:00:00 2001 From: KeyArgo Date: Thu, 28 Sep 2023 15:23:27 -0600 Subject: [PATCH] Added retries to run-seedbox.sh run-seedbox.sh will fail if during pulling docker images if experiencing network related issues. Added retry feature to allow the images to try again after failing. --- config-updater.sh | 0 config/tools.sh | 0 init.sh | 0 install.sh | 2 +- run-seedbox.sh | 24 +++++++++++++++--------- services/bazarr.yaml | 0 services/deluge.yaml | 0 services/duplicati.yaml | 0 services/flaresolverr.yaml | 0 services/flood.yaml | 0 services/gluetun.yaml | 0 services/jackett.yaml | 0 services/jdownloader.yaml | 0 services/kavita.yaml | 0 services/komga.yaml | 0 services/lidarr.yaml | 0 services/netdata.yaml | 0 services/nextcloud.yaml | 0 services/ombi.yaml | 0 services/overseerr.yaml | 0 services/plex-hardware-transcoding.yaml | 0 services/plex.yaml | 0 services/portainer.yaml | 0 services/prowlarr.yaml | 0 services/radarr.yaml | 0 services/readarr.yaml | 0 services/sonarr.yaml | 0 services/tautulli.yaml | 0 services/tdarr.yaml | 0 services/traefik.yaml | 0 tools/aliases.sh | 0 tools/init-setup-nextcloud.sh | 0 tools/legacy/docker-plex/init | 0 tools/legacy/open-tunnel.sh | 0 tools/wip/clean-fs.sh | 0 update-nextcloud.sh | 0 36 files changed, 16 insertions(+), 10 deletions(-) mode change 100755 => 100644 config-updater.sh mode change 100755 => 100644 config/tools.sh mode change 100755 => 100644 init.sh mode change 100755 => 100644 run-seedbox.sh mode change 100755 => 100644 services/bazarr.yaml mode change 100755 => 100644 services/deluge.yaml mode change 100755 => 100644 services/duplicati.yaml mode change 100755 => 100644 services/flaresolverr.yaml mode change 100755 => 100644 services/flood.yaml mode change 100755 => 100644 services/gluetun.yaml mode change 100755 => 100644 services/jackett.yaml mode change 100755 => 100644 services/jdownloader.yaml mode change 100755 => 100644 services/kavita.yaml mode change 100755 => 100644 services/komga.yaml mode change 100755 => 100644 services/lidarr.yaml mode change 100755 => 100644 services/netdata.yaml mode change 100755 => 100644 services/nextcloud.yaml mode change 100755 => 100644 services/ombi.yaml mode change 100755 => 100644 services/overseerr.yaml mode change 100755 => 100644 services/plex-hardware-transcoding.yaml mode change 100755 => 100644 services/plex.yaml mode change 100755 => 100644 services/portainer.yaml mode change 100755 => 100644 services/prowlarr.yaml mode change 100755 => 100644 services/radarr.yaml mode change 100755 => 100644 services/readarr.yaml mode change 100755 => 100644 services/sonarr.yaml mode change 100755 => 100644 services/tautulli.yaml mode change 100755 => 100644 services/tdarr.yaml mode change 100755 => 100644 services/traefik.yaml mode change 100755 => 100644 tools/aliases.sh mode change 100755 => 100644 tools/init-setup-nextcloud.sh mode change 100755 => 100644 tools/legacy/docker-plex/init mode change 100755 => 100644 tools/legacy/open-tunnel.sh mode change 100755 => 100644 tools/wip/clean-fs.sh mode change 100755 => 100644 update-nextcloud.sh diff --git a/config-updater.sh b/config-updater.sh old mode 100755 new mode 100644 diff --git a/config/tools.sh b/config/tools.sh old mode 100755 new mode 100644 diff --git a/init.sh b/init.sh old mode 100755 new mode 100644 diff --git a/install.sh b/install.sh index f6e7939..f572b35 100644 --- a/install.sh +++ b/install.sh @@ -190,5 +190,5 @@ SEEDBOX_DIR=$(pwd) # Run init.sh from the current directory with sudo sudo bash init.sh -# Make run-seedbox.sh executable and run it +# Run run-seedbox.sh sudo bash run-seedbox.sh \ No newline at end of file diff --git a/run-seedbox.sh b/run-seedbox.sh old mode 100755 new mode 100644 index 96bb827..e88de44 --- a/run-seedbox.sh +++ b/run-seedbox.sh @@ -11,6 +11,8 @@ check_utilities SKIP_PULL=0 DEBUG=0 +max_retries=10 + for i in "$@"; do case $i in --no-pull) @@ -70,7 +72,7 @@ fi echo "[$0] ***** Checking configuration... *****" -yq eval -o json config.yaml > config.json +retry $max_retries yq eval -o json config.yaml > config.json if [[ ${CHECK_FOR_OUTDATED_CONFIG} == true ]]; then nb_services=$(cat config.json | jq '.services | length') @@ -149,7 +151,7 @@ fi ####################################### SERVICES PARSING ###################################### ############################################################################################### -echo "[$0] ***** Generating configuration... *****" +echo "[$0] ***** Generating configuration... *****" # Cleanup files before start, in case there was a change we start from scratch at every script execution rm -f services/generated/*-vpn.yaml @@ -170,11 +172,11 @@ for json in $(yq eval -o json config.yaml | jq -c ".services[]"); do echo-debug "[$0] ➡️ Parsing service: \"$name\"..." - # Default docker-compose filename is the service name + .yaml. + # Default docker-compose filename is the service name + .yaml. # Take into account explicit filename if specified in config customFile=$(echo $json | jq -r .customFile) file="$name.yaml" - if [[ ${customFile} != "null" ]]; then + if [[ ${customFile} != "null" ]]; then file=${customFile} fi echo-debug "[$0] File: \"$file\"..." @@ -268,7 +270,7 @@ rm -f rules.props # Post-transformations on the rules file # sed -i "s/EMPTYMAP/{}/g" traefik/custom/dynamic-rules.yaml -# Add simple quotes around Host rule +# Add simple quotes around Host rule sed -i --regexp-extended "s/^(.*: )(Host.*$)/\1'\2'/g" traefik/custom/dynamic-rules.yaml # Add double quotes around the backend traefik service sed -i --regexp-extended "s/^(.*url: )(.*$)/\1\"\2\"/g" traefik/custom/dynamic-rules.yaml @@ -281,16 +283,20 @@ echo "[$0] ***** Config OK. Launching services... *****" if [[ "${SKIP_PULL}" != "1" ]]; then echo "[$0] ***** Pulling all images... *****" - ${DOCKER_COMPOSE_BINARY} ${ALL_SERVICES} pull + + retry $max_retries ${DOCKER_COMPOSE_BINARY} ${ALL_SERVICES} pull fi echo "[$0] ***** Recreating containers if required... *****" -${DOCKER_COMPOSE_BINARY} ${ALL_SERVICES} up -d --remove-orphans + +retry $max_retries ${DOCKER_COMPOSE_BINARY} ${ALL_SERVICES} up -d --remove-orphans + echo "[$0] ***** Done updating containers *****" echo "[$0] ***** Clean unused images and volumes... *****" -docker image prune -af -docker volume prune -f + +retry $max_retries docker image prune -af +retry $max_retries docker volume prune -f echo "[$0] ***** Done! *****" exit 0 \ No newline at end of file diff --git a/services/bazarr.yaml b/services/bazarr.yaml old mode 100755 new mode 100644 diff --git a/services/deluge.yaml b/services/deluge.yaml old mode 100755 new mode 100644 diff --git a/services/duplicati.yaml b/services/duplicati.yaml old mode 100755 new mode 100644 diff --git a/services/flaresolverr.yaml b/services/flaresolverr.yaml old mode 100755 new mode 100644 diff --git a/services/flood.yaml b/services/flood.yaml old mode 100755 new mode 100644 diff --git a/services/gluetun.yaml b/services/gluetun.yaml old mode 100755 new mode 100644 diff --git a/services/jackett.yaml b/services/jackett.yaml old mode 100755 new mode 100644 diff --git a/services/jdownloader.yaml b/services/jdownloader.yaml old mode 100755 new mode 100644 diff --git a/services/kavita.yaml b/services/kavita.yaml old mode 100755 new mode 100644 diff --git a/services/komga.yaml b/services/komga.yaml old mode 100755 new mode 100644 diff --git a/services/lidarr.yaml b/services/lidarr.yaml old mode 100755 new mode 100644 diff --git a/services/netdata.yaml b/services/netdata.yaml old mode 100755 new mode 100644 diff --git a/services/nextcloud.yaml b/services/nextcloud.yaml old mode 100755 new mode 100644 diff --git a/services/ombi.yaml b/services/ombi.yaml old mode 100755 new mode 100644 diff --git a/services/overseerr.yaml b/services/overseerr.yaml old mode 100755 new mode 100644 diff --git a/services/plex-hardware-transcoding.yaml b/services/plex-hardware-transcoding.yaml old mode 100755 new mode 100644 diff --git a/services/plex.yaml b/services/plex.yaml old mode 100755 new mode 100644 diff --git a/services/portainer.yaml b/services/portainer.yaml old mode 100755 new mode 100644 diff --git a/services/prowlarr.yaml b/services/prowlarr.yaml old mode 100755 new mode 100644 diff --git a/services/radarr.yaml b/services/radarr.yaml old mode 100755 new mode 100644 diff --git a/services/readarr.yaml b/services/readarr.yaml old mode 100755 new mode 100644 diff --git a/services/sonarr.yaml b/services/sonarr.yaml old mode 100755 new mode 100644 diff --git a/services/tautulli.yaml b/services/tautulli.yaml old mode 100755 new mode 100644 diff --git a/services/tdarr.yaml b/services/tdarr.yaml old mode 100755 new mode 100644 diff --git a/services/traefik.yaml b/services/traefik.yaml old mode 100755 new mode 100644 diff --git a/tools/aliases.sh b/tools/aliases.sh old mode 100755 new mode 100644 diff --git a/tools/init-setup-nextcloud.sh b/tools/init-setup-nextcloud.sh old mode 100755 new mode 100644 diff --git a/tools/legacy/docker-plex/init b/tools/legacy/docker-plex/init old mode 100755 new mode 100644 diff --git a/tools/legacy/open-tunnel.sh b/tools/legacy/open-tunnel.sh old mode 100755 new mode 100644 diff --git a/tools/wip/clean-fs.sh b/tools/wip/clean-fs.sh old mode 100755 new mode 100644 diff --git a/update-nextcloud.sh b/update-nextcloud.sh old mode 100755 new mode 100644