2
0
Эх сурвалжийг харах

Added update-compose to update.sh and create-coldstandby

DerLinkman 3 жил өмнө
parent
commit
7d72ae3449

+ 9 - 0
helper-scripts/_cold-standby.sh

@@ -271,4 +271,13 @@ if ! ssh -o StrictHostKeyChecking=no \
     >&2 echo -e "\e[31m[ERR]\e[0m - Could not cleanup old images on remote"
     >&2 echo -e "\e[31m[ERR]\e[0m - Could not cleanup old images on remote"
 fi
 fi
 
 
+echo -e "\033[1mExecuting update script and checking for new docker-compose Version on remote...\033[0m"
+if ! ssh -o StrictHostKeyChecking=no \
+  -i "${REMOTE_SSH_KEY}" \
+  ${REMOTE_SSH_HOST} \
+  -p ${REMOTE_SSH_PORT} \
+  ${SCRIPT_DIR}/../update.sh -f --update-compose ; then
+    >&2 echo -e "\e[31m[ERR]\e[0m - Could not fetch docker-compose on remote"
+fi
+
 echo -e "\e[32mDone\e[0m"
 echo -e "\e[32mDone\e[0m"

+ 17 - 3
update.sh

@@ -344,19 +344,33 @@ while (($#)); do
     --no-update-compose)
     --no-update-compose)
       NO_UPDATE_COMPOSE=y
       NO_UPDATE_COMPOSE=y
     ;;
     ;;
+    --update-compose)
+      LATEST_COMPOSE=$(curl -#L https://www.servercow.de/docker-compose/latest.php)
+      COMPOSE_VERSION=$(docker-compose version --short) 
+      if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then
+        echo -e "\e[33mA new docker-compose Version is available: $LATEST_COMPOSE\e[0m"
+        echo -e "\e[33mYour Version is: $COMPOSE_VERSION\e[0m"
+        update_compose
+        echo -e "\e[32mYour docker-compose Version is now up to date!\e[0m" 
+      else
+      echo -e "\e[32mYour docker-compose Version is up to date! Not updating it...\e[0m" 
+      fi
+      exit 0
+    ;;
     --skip-ping-check)
     --skip-ping-check)
       SKIP_PING_CHECK=y
       SKIP_PING_CHECK=y
     ;;
     ;;
     --help|-h)
     --help|-h)
-    echo './update.sh [-c|--check, --ours, --gc, --no-update-compose, --prefetch, --skip-start, --skip-ping-check, -f|--force, -h|--help]
+    echo './update.sh [-c|--check, --ours, --gc, --no-update-compose, --update-compose, --prefetch, --skip-start, --skip-ping-check, -f|--force, -h|--help]
 
 
   -c|--check           -   Check for updates and exit (exit codes => 0: update available, 3: no updates)
   -c|--check           -   Check for updates and exit (exit codes => 0: update available, 3: no updates)
   --ours               -   Use merge strategy option "ours" to solve conflicts in favor of non-mailcow code (local changes over remote changes), not recommended!
   --ours               -   Use merge strategy option "ours" to solve conflicts in favor of non-mailcow code (local changes over remote changes), not recommended!
   --gc                 -   Run garbage collector to delete old image tags
   --gc                 -   Run garbage collector to delete old image tags
-  --no-update-compose  -   Do not update docker-compose  
+  --no-update-compose  -   Skip the docker-compose Updates during the mailcow Update process
+  --update-compose     -   Only run the docker-compose Update process (don´t updates your mailcow itself)
   --prefetch           -   Only prefetch new images and exit (useful to prepare updates)
   --prefetch           -   Only prefetch new images and exit (useful to prepare updates)
   --skip-start         -   Do not start mailcow after update
   --skip-start         -   Do not start mailcow after update
-  --skip-ping-check    -   Skip ICMP Check to public DNS resolvers (Use it only if you´ve blocked any ICMP Connections to your mailcow machine).
+  --skip-ping-check    -   Skip ICMP Check to public DNS resolvers (Use it only if you´ve blocked any ICMP Connections to your mailcow machine)
   -f|--force           -   Force update, do not ask questions
   -f|--force           -   Force update, do not ask questions
 '
 '
     exit 1
     exit 1