mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-01-07 14:09:19 +00:00
Merge branch 'staging' into feat/valkey
This commit is contained in:
@@ -10,46 +10,6 @@ echo "If this script is run automatically by cron or a timer AND you are using b
|
||||
echo "The snapshots of your backup destination should run AFTER the cold standby script finished to ensure consistent snapshots."
|
||||
echo
|
||||
|
||||
function docker_garbage() {
|
||||
IMGS_TO_DELETE=()
|
||||
|
||||
for container in $(grep -oP "image: \Kmailcow.+" docker-compose.yml); do
|
||||
|
||||
REPOSITORY=${container/:*}
|
||||
TAG=${container/*:}
|
||||
V_MAIN=${container/*.}
|
||||
V_SUB=${container/*.}
|
||||
EXISTING_TAGS=$(docker images | grep ${REPOSITORY} | awk '{ print $2 }')
|
||||
|
||||
for existing_tag in ${EXISTING_TAGS[@]}; do
|
||||
|
||||
V_MAIN_EXISTING=${existing_tag/*.}
|
||||
V_SUB_EXISTING=${existing_tag/*.}
|
||||
|
||||
# Not an integer
|
||||
[[ ! ${V_MAIN_EXISTING} =~ ^[0-9]+$ ]] && continue
|
||||
[[ ! ${V_SUB_EXISTING} =~ ^[0-9]+$ ]] && continue
|
||||
|
||||
if [[ ${V_MAIN_EXISTING} == "latest" ]]; then
|
||||
echo "Found deprecated label \"latest\" for repository ${REPOSITORY}, it should be deleted."
|
||||
IMGS_TO_DELETE+=(${REPOSITORY}:${existing_tag})
|
||||
elif [[ ${V_MAIN_EXISTING} -lt ${V_MAIN} ]]; then
|
||||
echo "Found tag ${existing_tag} for ${REPOSITORY}, which is older than the current tag ${TAG} and should be deleted."
|
||||
IMGS_TO_DELETE+=(${REPOSITORY}:${existing_tag})
|
||||
elif [[ ${V_SUB_EXISTING} -lt ${V_SUB} ]]; then
|
||||
echo "Found tag ${existing_tag} for ${REPOSITORY}, which is older than the current tag ${TAG} and should be deleted."
|
||||
IMGS_TO_DELETE+=(${REPOSITORY}:${existing_tag})
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
if [[ ! -z ${IMGS_TO_DELETE[*]} ]]; then
|
||||
docker rmi ${IMGS_TO_DELETE[*]}
|
||||
fi
|
||||
}
|
||||
|
||||
function preflight_local_checks() {
|
||||
if [[ -z "${REMOTE_SSH_KEY}" ]]; then
|
||||
>&2 echo -e "\e[31mREMOTE_SSH_KEY is not set\e[0m"
|
||||
@@ -139,11 +99,11 @@ EOF
|
||||
|
||||
if [ $? = 0 ]; then
|
||||
COMPOSE_COMMAND="docker compose"
|
||||
echo "DEBUG: Using native docker compose on remote"
|
||||
echo "INFO: Using native docker compose on remote"
|
||||
|
||||
elif [ $? = 1 ]; then
|
||||
COMPOSE_COMMAND="docker-compose"
|
||||
echo "DEBUG: Using standalone docker compose on remote"
|
||||
echo "INFO: Using standalone docker compose on remote"
|
||||
|
||||
else
|
||||
echo -e "\e[31mCannot find any Docker Compose on remote, exiting...\e[0m"
|
||||
@@ -157,7 +117,7 @@ fi
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "${SCRIPT_DIR}/../mailcow.conf"
|
||||
COMPOSE_FILE="${SCRIPT_DIR}/../docker-compose.yml"
|
||||
CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd 'A-Za-z-_')
|
||||
CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd '0-9A-Za-z-_')
|
||||
SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' "${COMPOSE_FILE}")
|
||||
|
||||
preflight_local_checks
|
||||
@@ -209,7 +169,7 @@ if ! ssh -o StrictHostKeyChecking=no \
|
||||
-i "${REMOTE_SSH_KEY}" \
|
||||
${REMOTE_SSH_HOST} \
|
||||
-p ${REMOTE_SSH_PORT} \
|
||||
${COMPOSE_COMMAND} -f "${SCRIPT_DIR}/../docker-compose.yml" create 2>&1 ; then
|
||||
"cd \"${SCRIPT_DIR}/../\" && ${COMPOSE_COMMAND} create 2>&1" ; then
|
||||
>&2 echo -e "\e[31m[ERR]\e[0m - Could not create networks, volumes and containers on remote"
|
||||
fi
|
||||
|
||||
@@ -324,7 +284,7 @@ echo "OK"
|
||||
-i "${REMOTE_SSH_KEY}" \
|
||||
${REMOTE_SSH_HOST} \
|
||||
-p ${REMOTE_SSH_PORT} \
|
||||
${COMPOSE_COMMAND} -f "${SCRIPT_DIR}/../docker-compose.yml" pull --no-parallel --quiet 2>&1 ; then
|
||||
"cd \"${SCRIPT_DIR}/../\" && ${COMPOSE_COMMAND} pull --quiet 2>&1" ; then
|
||||
>&2 echo -e "\e[31m[ERR]\e[0m - Could not pull images on remote"
|
||||
fi
|
||||
|
||||
@@ -333,7 +293,7 @@ if ! ssh -o StrictHostKeyChecking=no \
|
||||
-i "${REMOTE_SSH_KEY}" \
|
||||
${REMOTE_SSH_HOST} \
|
||||
-p ${REMOTE_SSH_PORT} \
|
||||
${SCRIPT_DIR}/../update.sh -f --gc ; then
|
||||
"cd \"${SCRIPT_DIR}/../\" && ./update.sh -f --gc" ; then
|
||||
>&2 echo -e "\e[31m[ERR]\e[0m - Could not cleanup old images on remote"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DEBIAN_DOCKER_IMAGE="mailcow/backup:latest"
|
||||
DEBIAN_DOCKER_IMAGE="ghcr.io/mailcow/backup:latest"
|
||||
|
||||
if [[ ! -z ${MAILCOW_BACKUP_LOCATION} ]]; then
|
||||
BACKUP_LOCATION="${MAILCOW_BACKUP_LOCATION}"
|
||||
@@ -236,7 +236,7 @@ function restore() {
|
||||
if [[ $(find "${RESTORE_LOCATION}" \( -name '*x86*' -o -name '*aarch*' \) -exec basename {} \; | sed 's/^\.//' | sed 's/^\.//') == "" ]]; then
|
||||
echo -e "\e[33mCould not find a architecture signature of the loaded backup... Maybe the backup was done before the multiarch update?"
|
||||
sleep 2
|
||||
echo -e "Continuing anyhow. If rspamd is crashing opon boot try remove the rspamd volume with docker volume rm ${CMPS_PRJ}_rspamd-vol-1 after you've stopped the stack.\e[0m"
|
||||
echo -e "Continuing anyhow. If rspamd is crashing upon boot try remove the rspamd volume with docker volume rm ${CMPS_PRJ}_rspamd-vol-1 after you've stopped the stack.\e[0m"
|
||||
sleep 2
|
||||
docker stop $(docker ps -qf name=rspamd-mailcow)
|
||||
docker run -i --name mailcow-backup --rm \
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
prometheus-exporter-mailcow:
|
||||
image: ghcr.io/mailcow/prometheus-exporter:2
|
||||
ports:
|
||||
- "9099:9099"
|
||||
restart: always
|
||||
environment:
|
||||
MAILCOW_EXPORTER_HOST: "<your-mail-domain>" # Replace with your Mailcow hostname
|
||||
MAILCOW_EXPORTER_API_KEY: "<your-API-Key>" # Replace with your API key
|
||||
MAILCOW_EXPORTER_SECURITY_TOKEN: "<your-secure-token>" # Replace with your secure key
|
||||
# MAILCOW_EXPORTER_SECURITY_DISABLE_ACCESS_PROTECTION: "true" # Uncomment only if it is safe to disable token authentication (e.g., internal network only)
|
||||
dns:
|
||||
- ${IPV4_NETWORK:-172.22.1}.254
|
||||
networks:
|
||||
mailcow-network:
|
||||
ipv4_address: ${IPV4_NETWORK:-172.22.1}.209
|
||||
aliases:
|
||||
- prometheus-exporter
|
||||
@@ -6,9 +6,10 @@ SPFTOOLS_DIR=${WORKING_DIR}/spf-tools
|
||||
POSTWHITE_DIR=${WORKING_DIR}/postwhite
|
||||
POSTWHITE_CONF=${POSTWHITE_DIR}/postwhite.conf
|
||||
|
||||
CUSTOM_HOSTS='"web.de gmx.net mail.de freenet.de arcor.de unity-mail.de"'
|
||||
CUSTOM_HOSTS='"web.de gmx.net mail.de freenet.de arcor.de unity-mail.de protonmail.ch ionos.com strato.com t-online.de"'
|
||||
STATIC_HOSTS=(
|
||||
"194.25.134.0/24 permit # t-online.de"
|
||||
"49.12.4.251 permit # checks.mailcow.email"
|
||||
"2a01:4f8:c17:7906::10 permit # checks.mailcow.email"
|
||||
)
|
||||
|
||||
mkdir ${SCRIPT_DIR}/postwhite_tmp
|
||||
|
||||
Reference in New Issue
Block a user