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.
This commit is contained in:
Daniel LaForce 2023-09-28 15:23:27 -06:00
parent ee4db2273f
commit a4e9b9316b
36 changed files with 16 additions and 10 deletions

0
config-updater.sh Executable file → Normal file
View File

0
config/tools.sh Executable file → Normal file
View File

0
init.sh Executable file → Normal file
View File

View File

@ -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

24
run-seedbox.sh Executable file → Normal file
View File

@ -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

0
services/bazarr.yaml Executable file → Normal file
View File

0
services/deluge.yaml Executable file → Normal file
View File

0
services/duplicati.yaml Executable file → Normal file
View File

0
services/flaresolverr.yaml Executable file → Normal file
View File

0
services/flood.yaml Executable file → Normal file
View File

0
services/gluetun.yaml Executable file → Normal file
View File

0
services/jackett.yaml Executable file → Normal file
View File

0
services/jdownloader.yaml Executable file → Normal file
View File

0
services/kavita.yaml Executable file → Normal file
View File

0
services/komga.yaml Executable file → Normal file
View File

0
services/lidarr.yaml Executable file → Normal file
View File

0
services/netdata.yaml Executable file → Normal file
View File

0
services/nextcloud.yaml Executable file → Normal file
View File

0
services/ombi.yaml Executable file → Normal file
View File

0
services/overseerr.yaml Executable file → Normal file
View File

0
services/plex-hardware-transcoding.yaml Executable file → Normal file
View File

0
services/plex.yaml Executable file → Normal file
View File

0
services/portainer.yaml Executable file → Normal file
View File

0
services/prowlarr.yaml Executable file → Normal file
View File

0
services/radarr.yaml Executable file → Normal file
View File

0
services/readarr.yaml Executable file → Normal file
View File

0
services/sonarr.yaml Executable file → Normal file
View File

0
services/tautulli.yaml Executable file → Normal file
View File

0
services/tdarr.yaml Executable file → Normal file
View File

0
services/traefik.yaml Executable file → Normal file
View File

0
tools/aliases.sh Executable file → Normal file
View File

0
tools/init-setup-nextcloud.sh Executable file → Normal file
View File

0
tools/legacy/docker-plex/init Executable file → Normal file
View File

0
tools/legacy/open-tunnel.sh Executable file → Normal file
View File

0
tools/wip/clean-fs.sh Executable file → Normal file
View File

0
update-nextcloud.sh Executable file → Normal file
View File