1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2026-07-15 17:26:28 +00:00

[Nginx] use python bootstrapper to start NGINX container

This commit is contained in:
FreddleSpl0it
2025-05-19 09:45:00 +02:00
parent 1d482ed425
commit cde2ba4851
15 changed files with 204 additions and 171 deletions
+7 -21
View File
@@ -1,26 +1,12 @@
#!/bin/sh
PHPFPMHOST=${PHPFPMHOST:-"php-fpm-mailcow"}
SOGOHOST=${SOGOHOST:-"$IPV4_NETWORK.248"}
RSPAMDHOST=${RSPAMDHOST:-"rspamd-mailcow"}
python3 -u /bootstrap/main.py
BOOTSTRAP_EXIT_CODE=$?
until ping ${PHPFPMHOST} -c1 > /dev/null; do
echo "Waiting for PHP..."
sleep 1
done
if ! printf "%s\n" "${SKIP_SOGO}" | grep -E '^([yY][eE][sS]|[yY])+$' >/dev/null; then
until ping ${SOGOHOST} -c1 > /dev/null; do
echo "Waiting for SOGo..."
sleep 1
done
fi
if ! printf "%s\n" "${SKIP_RSPAMD}" | grep -E '^([yY][eE][sS]|[yY])+$' >/dev/null; then
until ping ${RSPAMDHOST} -c1 > /dev/null; do
echo "Waiting for Rspamd..."
sleep 1
done
if [ $BOOTSTRAP_EXIT_CODE -ne 0 ]; then
echo "Bootstrap failed with exit code $BOOTSTRAP_EXIT_CODE. Not starting Nginx."
exit $BOOTSTRAP_EXIT_CODE
fi
python3 /bootstrap.py
exec "$@"
echo "Bootstrap succeeded. Starting Nginx..."
nginx -g "daemon off;"