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:
		
							parent
							
								
									ee4db2273f
								
							
						
					
					
						commit
						a4e9b9316b
					
				|  | @ -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 | ||||
|  | @ -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') | ||||
|  | @ -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 | ||||
		Loading…
	
		Reference in New Issue