mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-03-04 22:06:23 +00:00
Compare commits
4 Commits
copilot/fi
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d371293e0 | ||
|
|
215a8addff | ||
|
|
8f58ba8bc8 | ||
|
|
70affa0f69 |
@@ -139,9 +139,13 @@ docker_daemon_edit(){
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}User declined Docker update – please insert these changes manually:${NC}"
|
echo -e "${YELLOW}User declined Docker update – skipping Docker daemon configuration.${NC}"
|
||||||
|
echo -e "${YELLOW}IPv6 will be disabled for mailcow.${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${YELLOW}If you change your mind later, please insert these changes manually to $DOCKER_DAEMON_CONFIG:${NC}"
|
||||||
echo "${MISSING[*]}"
|
echo "${MISSING[*]}"
|
||||||
exit 1
|
echo ""
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -185,9 +189,23 @@ EOF
|
|||||||
(command -v systemctl &>/dev/null && systemctl restart docker) || service docker restart
|
(command -v systemctl &>/dev/null && systemctl restart docker) || service docker restart
|
||||||
echo "Docker restarted."
|
echo "Docker restarted."
|
||||||
else
|
else
|
||||||
echo "User declined to create daemon.json – please manually merge the docker daemon with these configs:"
|
echo -e "${YELLOW}User declined to create daemon.json – skipping Docker daemon configuration.${NC}"
|
||||||
echo "${MISSING[*]}"
|
echo -e "${YELLOW}IPv6 will be disabled for mailcow.${NC}"
|
||||||
exit 1
|
echo ""
|
||||||
|
echo -e "${YELLOW}If you change your mind later, please create $DOCKER_DAEMON_CONFIG with these settings:${NC}"
|
||||||
|
if [[ -n "$DOCKER_MAJOR" && "$DOCKER_MAJOR" -lt 27 ]]; then
|
||||||
|
echo ' "ipv6": true,'
|
||||||
|
echo ' "fixed-cidr-v6": "fd00:dead:beef:c0::/80",'
|
||||||
|
echo ' "ip6tables": true,'
|
||||||
|
echo ' "experimental": true'
|
||||||
|
elif [[ -n "$DOCKER_MAJOR" && "$DOCKER_MAJOR" -lt 28 ]]; then
|
||||||
|
echo ' "ipv6": true,'
|
||||||
|
echo ' "fixed-cidr-v6": "fd00:dead:beef:c0::/80"'
|
||||||
|
else
|
||||||
|
echo ' "ipv6": true'
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -223,7 +241,22 @@ configure_ipv6() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker_daemon_edit
|
if ! docker_daemon_edit; then
|
||||||
|
# User declined Docker daemon configuration
|
||||||
|
# When called from update.sh, MAILCOW_CONF is set and we modify the existing file
|
||||||
|
# When called from generate_config.sh, MAILCOW_CONF is not set and we export IPV6_BOOL
|
||||||
|
if [[ -n "$MAILCOW_CONF" && -f "$MAILCOW_CONF" ]]; then
|
||||||
|
if grep -q '^ENABLE_IPV6=' "$MAILCOW_CONF"; then
|
||||||
|
sed -i 's/^ENABLE_IPV6=.*/ENABLE_IPV6=false/' "$MAILCOW_CONF"
|
||||||
|
else
|
||||||
|
echo "ENABLE_IPV6=false" >> "$MAILCOW_CONF"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
export IPV6_BOOL=false
|
||||||
|
fi
|
||||||
|
echo "IPv6 configuration complete: ENABLE_IPV6=false"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "$MAILCOW_CONF" && -f "$MAILCOW_CONF" ]]; then
|
if [[ -n "$MAILCOW_CONF" && -f "$MAILCOW_CONF" ]]; then
|
||||||
if grep -q '^ENABLE_IPV6=' "$MAILCOW_CONF"; then
|
if grep -q '^ENABLE_IPV6=' "$MAILCOW_CONF"; then
|
||||||
|
|||||||
@@ -95,51 +95,6 @@ echo "$(clamd -V) is starting... please wait a moment."
|
|||||||
nice -n10 clamd &
|
nice -n10 clamd &
|
||||||
BACKGROUND_TASKS+=($!)
|
BACKGROUND_TASKS+=($!)
|
||||||
|
|
||||||
# Give clamd time to start up, especially with limited resources
|
|
||||||
# This grace period allows clamd to initialize fully before health checks begin
|
|
||||||
# Can be configured via CLAMD_STARTUP_TIMEOUT environment variable
|
|
||||||
STARTUP_GRACE_PERIOD=${CLAMD_STARTUP_TIMEOUT:-600} # Default: 10 minutes in seconds
|
|
||||||
echo "Waiting up to ${STARTUP_GRACE_PERIOD} seconds for clamd to start up..."
|
|
||||||
|
|
||||||
# Helper function to check if clamd is ready
|
|
||||||
clamd_is_ready() {
|
|
||||||
[ "$(echo "PING" | nc -w 1 localhost 3310 2>/dev/null)" = "PONG" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Wait for clamd to be ready or until timeout
|
|
||||||
START_TIME=$(date +%s)
|
|
||||||
POLL_INTERVAL=10
|
|
||||||
CLAMD_READY=0
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
CURRENT_TIME=$(date +%s)
|
|
||||||
ELAPSED=$((CURRENT_TIME - START_TIME))
|
|
||||||
|
|
||||||
# Check if clamd is responsive by attempting to connect on localhost
|
|
||||||
# clamd listens on 0.0.0.0:3310 (configured in Dockerfile)
|
|
||||||
if clamd_is_ready; then
|
|
||||||
echo "clamd is ready after ${ELAPSED} seconds"
|
|
||||||
CLAMD_READY=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if we've exceeded the timeout
|
|
||||||
if [ ${ELAPSED} -ge ${STARTUP_GRACE_PERIOD} ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep ${POLL_INTERVAL}
|
|
||||||
done
|
|
||||||
|
|
||||||
# Report final status only if not already reported as ready
|
|
||||||
if [ ${CLAMD_READY} -eq 0 ]; then
|
|
||||||
if clamd_is_ready; then
|
|
||||||
echo "clamd is now ready (started during final check)"
|
|
||||||
else
|
|
||||||
echo "Warning: clamd did not respond to PING within ${STARTUP_GRACE_PERIOD} seconds - it may still be starting up"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
for bg_task in ${BACKGROUND_TASKS[*]}; do
|
for bg_task in ${BACKGROUND_TASKS[*]}; do
|
||||||
if ! kill -0 ${bg_task} 1>&2; then
|
if ! kill -0 ${bg_task} 1>&2; then
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- TZ=${TZ}
|
- TZ=${TZ}
|
||||||
- SKIP_CLAMD=${SKIP_CLAMD:-n}
|
- SKIP_CLAMD=${SKIP_CLAMD:-n}
|
||||||
- CLAMD_STARTUP_TIMEOUT=${CLAMD_STARTUP_TIMEOUT:-600}
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/conf/clamav/:/etc/clamav/:Z
|
- ./data/conf/clamav/:/etc/clamav/:Z
|
||||||
- clamd-db-vol-1:/var/lib/clamav
|
- clamd-db-vol-1:/var/lib/clamav
|
||||||
|
|||||||
Reference in New Issue
Block a user