From 7d72ae3449366fb2f317fd49edf906eb7e669f9d Mon Sep 17 00:00:00 2001 From: DerLinkman Date: Thu, 14 Jul 2022 11:29:38 +0200 Subject: [PATCH] Added update-compose to update.sh and create-coldstandby --- helper-scripts/_cold-standby.sh | 9 +++++++++ update.sh | 20 +++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/helper-scripts/_cold-standby.sh b/helper-scripts/_cold-standby.sh index 7fc5a4957..fadee6f61 100755 --- a/helper-scripts/_cold-standby.sh +++ b/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" 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" diff --git a/update.sh b/update.sh index e3f3ad094..cd9d4fb63 100755 --- a/update.sh +++ b/update.sh @@ -344,19 +344,33 @@ while (($#)); do --no-update-compose) 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=y ;; --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) --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 - --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) --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 ' exit 1