Merge branch 'feature/update-composev2' into staging
This commit is contained in:
commit
4f58f2caee
@ -377,8 +377,8 @@ services:
|
|||||||
- ./data/conf/rspamd/meta_exporter:/meta_exporter:ro,z
|
- ./data/conf/rspamd/meta_exporter:/meta_exporter:ro,z
|
||||||
- sogo-web-vol-1:/usr/lib/GNUstep/SOGo/
|
- sogo-web-vol-1:/usr/lib/GNUstep/SOGo/
|
||||||
ports:
|
ports:
|
||||||
- "${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
|
- "${HTTPS_BIND:-}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
|
||||||
- "${HTTP_BIND:-0.0.0.0}:${HTTP_PORT:-80}:${HTTP_PORT:-80}"
|
- "${HTTP_BIND:-}:${HTTP_PORT:-80}:${HTTP_PORT:-80}"
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
mailcow-network:
|
mailcow-network:
|
||||||
|
@ -25,29 +25,10 @@ if cp --help 2>&1 | grep -q -i "busybox"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for bin in openssl curl docker git awk sha1sum; do
|
for bin in openssl curl docker docker-compose git awk sha1sum; do
|
||||||
if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi
|
if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "checking docker compose version...";
|
|
||||||
if docker compose >/dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
|
||||||
elif docker-compose version --short | grep -m1 "^2" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
|
||||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
|
||||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo -e "\e[33mContinuing...\e[0m"
|
|
||||||
sleep 3
|
|
||||||
else
|
|
||||||
echo -e "\e[31mCannot find Docker-Compose v1 or v2 on your System. Please install Docker-Compose v2 and re-run the Script.\e[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f mailcow.conf ]; then
|
if [ -f mailcow.conf ]; then
|
||||||
read -r -p "A config file exists and will be overwritten, are you sure you want to continue? [y/N] " response
|
read -r -p "A config file exists and will be overwritten, are you sure you want to continue? [y/N] " response
|
||||||
case $response in
|
case $response in
|
||||||
|
@ -77,33 +77,13 @@ function preflight_local_checks() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for bin in rsync docker grep cut; do
|
for bin in rsync docker docker-compose grep cut; do
|
||||||
if [[ -z $(which ${bin}) ]]; then
|
if [[ -z $(which ${bin}) ]]; then
|
||||||
>&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
|
>&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo "checking docker compose version...";
|
|
||||||
if docker compose >/dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2 on local machine!\e[0m"
|
|
||||||
elif docker-compose version --short | grep -m1 "^2" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
|
||||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
|
||||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo -e "\e[33mContinuing...\e[0m"
|
|
||||||
sleep 3
|
|
||||||
else
|
|
||||||
echo -e "\e[31mCannot find Docker-Compose v1 or v2 on your System. Please install Docker-Compose v2 and re-run the Script.\e[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
|
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
|
||||||
echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
|
echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
|
||||||
exit 1
|
exit 1
|
||||||
@ -131,7 +111,7 @@ function preflight_remote_checks() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for bin in rsync docker; do
|
for bin in rsync docker docker-compose; do
|
||||||
if ! ssh -o StrictHostKeyChecking=no \
|
if ! ssh -o StrictHostKeyChecking=no \
|
||||||
-i "${REMOTE_SSH_KEY}" \
|
-i "${REMOTE_SSH_KEY}" \
|
||||||
${REMOTE_SSH_HOST} \
|
${REMOTE_SSH_HOST} \
|
||||||
@ -141,39 +121,6 @@ function preflight_remote_checks() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "checking docker compose version on remote...";
|
|
||||||
if ssh -q -o StrictHostKeyChecking=no \
|
|
||||||
-i "${REMOTE_SSH_KEY}" \
|
|
||||||
${REMOTE_SSH_HOST} \
|
|
||||||
-p ${REMOTE_SSH_PORT} \
|
|
||||||
-t 'docker compose' >/dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2 on remote!\e[0m"
|
|
||||||
COMPOSE_COMMAND="docker compose"
|
|
||||||
elif ssh -q -o StrictHostKeyChecking=no \
|
|
||||||
-i "${REMOTE_SSH_KEY}" \
|
|
||||||
${REMOTE_SSH_HOST} \
|
|
||||||
-p ${REMOTE_SSH_PORT} \
|
|
||||||
-t 'docker-compose version --short' | grep -m1 "^2" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
elif ssh -q -o StrictHostKeyChecking=no \
|
|
||||||
-i "${REMOTE_SSH_KEY}" \
|
|
||||||
${REMOTE_SSH_HOST} \
|
|
||||||
-p ${REMOTE_SSH_PORT} \
|
|
||||||
-t 'docker-compose version --short' | grep -m1 "^1" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[33mWARN: The remote is using Docker-Compose v1!\e[0m"
|
|
||||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
|
||||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2 on remote.\e[0m"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo -e "\e[33mContinuing...\e[0m"
|
|
||||||
sleep 3
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
else
|
|
||||||
echo -e "\e[31mCannot find Docker-Compose v1 or v2 on the Remote Machine! Please install Docker-Compose v2 on that and re-run the script.\e[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preflight_local_checks
|
preflight_local_checks
|
||||||
@ -311,7 +258,7 @@ echo "OK"
|
|||||||
-i "${REMOTE_SSH_KEY}" \
|
-i "${REMOTE_SSH_KEY}" \
|
||||||
${REMOTE_SSH_HOST} \
|
${REMOTE_SSH_HOST} \
|
||||||
-p ${REMOTE_SSH_PORT} \
|
-p ${REMOTE_SSH_PORT} \
|
||||||
$COMPOSE_COMMAND -f "${SCRIPT_DIR}/../docker-compose.yml" pull --no-parallel --quiet 2>&1 ; then
|
docker-compose -f "${SCRIPT_DIR}/../docker-compose.yml" pull --no-parallel --quiet 2>&1 ; then
|
||||||
>&2 echo -e "\e[31m[ERR]\e[0m - Could not pull images on remote"
|
>&2 echo -e "\e[31m[ERR]\e[0m - Could not pull images on remote"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -76,26 +76,12 @@ else
|
|||||||
CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd "[0-9A-Za-z-_]")
|
CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd "[0-9A-Za-z-_]")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "checking docker compose version...";
|
for bin in docker docker-compose; do
|
||||||
if docker compose >/dev/null 2>&1; then
|
if [[ -z $(which ${bin}) ]]; then
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
>&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
|
||||||
COMPOSE_COMMAND="docker compose"
|
exit 1
|
||||||
elif docker-compose version --short | grep -m1 "^2" > /dev/null 2>&1; then
|
fi
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
done
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
|
||||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
|
||||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo -e "\e[33mContinuing...\e[0m"
|
|
||||||
sleep 3
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
else
|
|
||||||
echo -e "\e[31mCannot find Docker-Compose v1 or v2 on your System. Please install Docker-Compose v2 and re-run the Script.\e[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
|
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
|
||||||
>&2 echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
|
>&2 echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
|
||||||
@ -253,7 +239,7 @@ function restore() {
|
|||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
echo "Stopping mailcow..."
|
echo "Stopping mailcow..."
|
||||||
${COMPOSE_COMMAND} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down
|
docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down
|
||||||
fi
|
fi
|
||||||
#docker stop $(docker ps -qf name=mysql-mailcow)
|
#docker stop $(docker ps -qf name=mysql-mailcow)
|
||||||
if [[ -d "${RESTORE_LOCATION}/mysql" ]]; then
|
if [[ -d "${RESTORE_LOCATION}/mysql" ]]; then
|
||||||
@ -291,7 +277,7 @@ function restore() {
|
|||||||
sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf
|
sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf
|
||||||
source ${SCRIPT_DIR}/../mailcow.conf
|
source ${SCRIPT_DIR}/../mailcow.conf
|
||||||
echo "Starting mailcow..."
|
echo "Starting mailcow..."
|
||||||
${COMPOSE_COMMAND} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d
|
docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d
|
||||||
#docker start $(docker ps -aqf name=mysql-mailcow)
|
#docker start $(docker ps -aqf name=mysql-mailcow)
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
140
update.sh
140
update.sh
@ -41,30 +41,21 @@ PATH=$PATH:/opt/bin
|
|||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
for bin in curl docker git awk sha1sum; do
|
for bin in curl docker git awk sha1sum; do
|
||||||
if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi
|
if [[ -z $(which ${bin}) ]]; then
|
||||||
|
echo "Cannot find ${bin}, exiting..."
|
||||||
|
exit 1;
|
||||||
|
elif [[ -z $(which docker-compose) ]]; then
|
||||||
|
echo "Cannot find docker-compose Standalone. Installing..."
|
||||||
|
sleep 3
|
||||||
|
if [[ -e /etc/alpine-release ]]; then
|
||||||
|
echo -e "\e[33mNot installing latest docker-compose, because you are using Alpine Linux without glibc support. Install docker-compose via apk!\e[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
curl -#L https://github.com/docker/compose/releases/download/v$(curl -Ls https://www.servercow.de/docker-compose/latest.php)/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose
|
||||||
|
chmod +x /usr/local/bin/docker-compose
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo "checking docker compose version...";
|
|
||||||
if docker compose >/dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
|
||||||
COMPOSE_COMMAND="docker compose"
|
|
||||||
elif docker-compose version --short | grep -m1 "^2" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
|
|
||||||
echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
|
||||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
|
||||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo -e "\e[33mContinuing...\e[0m"
|
|
||||||
sleep 3
|
|
||||||
COMPOSE_COMMAND="docker-compose"
|
|
||||||
else
|
|
||||||
echo -e "\e[31mCannot find Docker-Compose v1 or v2 on your System. Please install Docker-Compose v2 and re-run the Script.\e[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
DATE=$(date +%Y-%m-%d_%H_%M_%S)
|
DATE=$(date +%Y-%m-%d_%H_%M_%S)
|
||||||
BRANCH=$(cd ${SCRIPT_DIR}; git rev-parse --abbrev-ref HEAD)
|
BRANCH=$(cd ${SCRIPT_DIR}; git rev-parse --abbrev-ref HEAD)
|
||||||
@ -218,6 +209,70 @@ migrate_docker_nat() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_obsolete_nginx_ports() {
|
||||||
|
# Removing obsolete docker-compose.override.yml
|
||||||
|
for override in docker-compose.override.yml docker-compose.override.yaml; do
|
||||||
|
if [ -s $override ] ; then
|
||||||
|
if cat $override | grep nginx-mailcow > /dev/null 2>&1; then
|
||||||
|
if cat $override | grep -w [::] > /dev/null 2>&1; then
|
||||||
|
if cat $override | grep -w 80:80 > /dev/null 2>&1 && cat $override | grep -w 443:443 > /dev/null 2>&1 ; then
|
||||||
|
sed -i '/nginx-mailcow:$/,/^$/d' $override
|
||||||
|
echo -e "\e[33mRemoved obsolete NGINX IPv6 Bind from override File.\e[0m"
|
||||||
|
if [[ "$(cat $override | sed '/^\s*$/d' | wc -l)" == "2" ]]; then
|
||||||
|
mv $override ${override}_backup
|
||||||
|
echo -e "\e[31m${override} is empty. Renamed it to ensure mailcow is startable.\e[0m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
update_compose(){
|
||||||
|
if [[ ${NO_UPDATE_COMPOSE} == "y" ]]; then
|
||||||
|
echo -e "\e[33mNot fetching latest docker-compose, please check for updates manually!\e[0m"
|
||||||
|
return 0
|
||||||
|
elif [[ -e /etc/alpine-release ]]; then
|
||||||
|
echo -e "\e[33mNot fetching latest docker-compose, because you are using Alpine Linux without glibc support. Please update docker-compose via apk!\e[0m"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo -e "\e[32mFetching new docker-compose version...\e[0m"
|
||||||
|
echo -e "\e[32mTrying to determine GLIBC version...\e[0m"
|
||||||
|
if ldd --version > /dev/null; then
|
||||||
|
GLIBC_V=$(ldd --version | grep -E '(GLIBC|GNU libc)' | rev | cut -d ' ' -f1 | rev | cut -d '.' -f2)
|
||||||
|
if [ ! -z "${GLIBC_V}" ] && [ ${GLIBC_V} -gt 27 ]; then
|
||||||
|
DC_DL_SUFFIX=
|
||||||
|
else
|
||||||
|
DC_DL_SUFFIX=legacy
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
DC_DL_SUFFIX=legacy
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
if [[ ! -z $(which pip) && $(pip list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 ]]; then
|
||||||
|
true
|
||||||
|
#prevent breaking a working docker-compose installed with pip
|
||||||
|
elif [[ $(curl -sL -w "%{http_code}" https://www.servercow.de/docker-compose/latest.php?vers=${DC_DL_SUFFIX} -o /dev/null) == "200" ]]; then
|
||||||
|
LATEST_COMPOSE=$(curl -#L https://www.servercow.de/docker-compose/latest.php)
|
||||||
|
COMPOSE_VERSION=$(docker-compose version --short)
|
||||||
|
if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then
|
||||||
|
COMPOSE_PATH=$(which docker-compose)
|
||||||
|
if [[ -w ${COMPOSE_PATH} ]]; then
|
||||||
|
curl -#L https://github.com/docker/compose/releases/download/v${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $COMPOSE_PATH
|
||||||
|
chmod +x $COMPOSE_PATH
|
||||||
|
else
|
||||||
|
echo -e "\e[33mWARNING: $COMPOSE_PATH is not writable, but new version $LATEST_COMPOSE is available (installed: $COMPOSE_VERSION)\e[0m"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "\e[33mCannot determine latest docker-compose version, skipping...\e[0m"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
while (($#)); do
|
while (($#)); do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
--check|-c)
|
--check|-c)
|
||||||
@ -256,6 +311,9 @@ while (($#)); do
|
|||||||
echo -e "\e[32mRunning in forced mode...\e[0m"
|
echo -e "\e[32mRunning in forced mode...\e[0m"
|
||||||
FORCE=y
|
FORCE=y
|
||||||
;;
|
;;
|
||||||
|
--no-update-compose)
|
||||||
|
NO_UPDATE_COMPOSE=y
|
||||||
|
;;
|
||||||
--skip-ping-check)
|
--skip-ping-check)
|
||||||
SKIP_PING_CHECK=y
|
SKIP_PING_CHECK=y
|
||||||
;;
|
;;
|
||||||
@ -265,6 +323,7 @@ while (($#)); do
|
|||||||
-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
|
||||||
--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).
|
||||||
@ -281,7 +340,7 @@ source mailcow.conf
|
|||||||
DOTS=${MAILCOW_HOSTNAME//[^.]};
|
DOTS=${MAILCOW_HOSTNAME//[^.]};
|
||||||
if [ ${#DOTS} -lt 2 ]; then
|
if [ ${#DOTS} -lt 2 ]; then
|
||||||
echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!"
|
echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!"
|
||||||
echo "Please change it to a FQDN and run ${COMPOSE_COMMAND} down followed by ${COMPOSE_COMMAND} up -d"
|
echo "Please change it to a FQDN and run docker-compose down followed by docker-compose up -d"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -570,7 +629,7 @@ fi
|
|||||||
echo -e "\e[32mChecking for newer update script...\e[0m"
|
echo -e "\e[32mChecking for newer update script...\e[0m"
|
||||||
SHA1_1=$(sha1sum update.sh)
|
SHA1_1=$(sha1sum update.sh)
|
||||||
git fetch origin #${BRANCH}
|
git fetch origin #${BRANCH}
|
||||||
git checkout origin/${BRANCH} update.sh
|
git checkout origin/${BRANCH} update.sh docker-compose.yml
|
||||||
SHA1_2=$(sha1sum update.sh)
|
SHA1_2=$(sha1sum update.sh)
|
||||||
if [[ ${SHA1_1} != ${SHA1_2} ]]; then
|
if [[ ${SHA1_1} != ${SHA1_2} ]]; then
|
||||||
echo "update.sh changed, please run this script again, exiting."
|
echo "update.sh changed, please run this script again, exiting."
|
||||||
@ -594,14 +653,18 @@ if [ ! $FORCE ]; then
|
|||||||
migrate_docker_nat
|
migrate_docker_nat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
update_compose
|
||||||
|
|
||||||
|
remove_obsolete_nginx_ports
|
||||||
|
|
||||||
echo -e "\e[32mValidating docker-compose stack configuration...\e[0m"
|
echo -e "\e[32mValidating docker-compose stack configuration...\e[0m"
|
||||||
if ! ${COMPOSE_COMMAND} config -q; then
|
if ! docker-compose config -q; then
|
||||||
echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m"
|
echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\e[32mChecking for conflicting bridges...\e[0m"
|
echo -e "\e[32mChecking for conflicting bridges...\e[0m"
|
||||||
MAILCOW_BRIDGE=$(${COMPOSE_COMMAND} config | grep -i com.docker.network.bridge.name | cut -d':' -f2)
|
MAILCOW_BRIDGE=$(docker-compose config | grep -i com.docker.network.bridge.name | cut -d':' -f2)
|
||||||
while read NAT_ID; do
|
while read NAT_ID; do
|
||||||
iptables -t nat -D POSTROUTING $NAT_ID
|
iptables -t nat -D POSTROUTING $NAT_ID
|
||||||
done < <(iptables -L -vn -t nat --line-numbers | grep $IPV4_NETWORK | grep -E 'MASQUERADE.*all' | grep -v ${MAILCOW_BRIDGE} | cut -d' ' -f1)
|
done < <(iptables -L -vn -t nat --line-numbers | grep $IPV4_NETWORK | grep -E 'MASQUERADE.*all' | grep -v ${MAILCOW_BRIDGE} | cut -d' ' -f1)
|
||||||
@ -621,8 +684,8 @@ prefetch_images
|
|||||||
|
|
||||||
echo -e "\e[32mStopping mailcow...\e[0m"
|
echo -e "\e[32mStopping mailcow...\e[0m"
|
||||||
sleep 2
|
sleep 2
|
||||||
MAILCOW_CONTAINERS=($(${COMPOSE_COMMAND} ps -q))
|
MAILCOW_CONTAINERS=($(docker-compose ps -q))
|
||||||
${COMPOSE_COMMAND} down
|
docker-compose down
|
||||||
echo -e "\e[32mChecking for remaining containers...\e[0m"
|
echo -e "\e[32mChecking for remaining containers...\e[0m"
|
||||||
sleep 2
|
sleep 2
|
||||||
for container in "${MAILCOW_CONTAINERS[@]}"; do
|
for container in "${MAILCOW_CONTAINERS[@]}"; do
|
||||||
@ -659,16 +722,13 @@ elif [[ ${MERGE_RETURN} == 1 ]]; then
|
|||||||
elif [[ ${MERGE_RETURN} != 0 ]]; then
|
elif [[ ${MERGE_RETURN} != 0 ]]; then
|
||||||
echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m"
|
echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m"
|
||||||
echo
|
echo
|
||||||
echo "Run ${COMPOSE_COMMAND} up -d to restart your stack without updates or try again after fixing the mentioned errors."
|
echo "Run docker-compose up -d to restart your stack without updates or try again after fixing the mentioned errors."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\e[33mNot fetching latest docker-compose, please check for updates manually!\e[0m"
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
echo -e "\e[32mFetching new images, if any...\e[0m"
|
echo -e "\e[32mFetching new images, if any...\e[0m"
|
||||||
sleep 2
|
sleep 2
|
||||||
${COMPOSE_COMMAND} pull
|
docker-compose pull
|
||||||
|
|
||||||
# Fix missing SSL, does not overwrite existing files
|
# Fix missing SSL, does not overwrite existing files
|
||||||
[[ ! -d data/assets/ssl ]] && mkdir -p data/assets/ssl
|
[[ ! -d data/assets/ssl ]] && mkdir -p data/assets/ssl
|
||||||
@ -723,11 +783,11 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${SKIP_START} == "y" ]]; then
|
if [[ ${SKIP_START} == "y" ]]; then
|
||||||
echo -e "\e[33mNot starting mailcow, please run \"${COMPOSE_COMMAND} up -d --remove-orphans\" to start mailcow.\e[0m"
|
echo -e "\e[33mNot starting mailcow, please run \"docker-compose up -d --remove-orphans\" to start mailcow.\e[0m"
|
||||||
else
|
else
|
||||||
echo -e "\e[32mStarting mailcow...\e[0m"
|
echo -e "\e[32mStarting mailcow...\e[0m"
|
||||||
sleep 2
|
sleep 2
|
||||||
${COMPOSE_COMMAND} up -d --remove-orphans
|
docker-compose up -d --remove-orphans
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\e[32mCollecting garbage...\e[0m"
|
echo -e "\e[32mCollecting garbage...\e[0m"
|
||||||
@ -738,8 +798,8 @@ if [ -f "${SCRIPT_DIR}/post_update_hook.sh" ]; then
|
|||||||
bash "${SCRIPT_DIR}/post_update_hook.sh"
|
bash "${SCRIPT_DIR}/post_update_hook.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#echo "In case you encounter any problem, hard-reset to a state before updating mailcow:"
|
# echo "In case you encounter any problem, hard-reset to a state before updating mailcow:"
|
||||||
#echo
|
# echo
|
||||||
#git reflog --color=always | grep "Before update on "
|
# git reflog --color=always | grep "Before update on "
|
||||||
#echo
|
# echo
|
||||||
#echo "Use \"git reset --hard hash-on-the-left\" and run ${COMPOSE_COMMAND} up -d afterwards."
|
# echo "Use \"git reset --hard hash-on-the-left\" and run docker-compose up -d afterwards."
|
Loading…
Reference in New Issue
Block a user