diff --git a/Containers/apache/Caddyfile b/Containers/apache/Caddyfile index 51a11604..c593df6b 100644 --- a/Containers/apache/Caddyfile +++ b/Containers/apache/Caddyfile @@ -10,7 +10,7 @@ } log { - level ERROR + level {$CADDY_LOG_LEVEL} } } diff --git a/Containers/apache/healthcheck.sh b/Containers/apache/healthcheck.sh index e9c1fad4..d67a794a 100644 --- a/Containers/apache/healthcheck.sh +++ b/Containers/apache/healthcheck.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [ "$AIO_LOG_LEVEL" = 'debug' ]; then + set -x +fi + nc -z "$NEXTCLOUD_HOST" 9000 || exit 0 nc -z 127.0.0.1 8000 || exit 1 nc -z 127.0.0.1 "$APACHE_PORT" || exit 1 diff --git a/Containers/apache/nextcloud.conf b/Containers/apache/nextcloud.conf index fea0c08a..58773e44 100644 --- a/Containers/apache/nextcloud.conf +++ b/Containers/apache/nextcloud.conf @@ -7,7 +7,7 @@ Listen 8000 LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy ErrorLog /proc/self/fd/2 ErrorLogFormat "[%t] [%l] [%E] [client: %{X-Forwarded-For}i] [%M] [%{User-Agent}i]" - LogLevel warn + LogLevel ${AIO_LOG_LEVEL} # KeepAlive On: allow the same TCP connection to carry multiple HTTP requests. # Without this each asset (JS, CSS, image) would require a full TCP handshake, diff --git a/Containers/apache/start.sh b/Containers/apache/start.sh index 02a2f2ad..27a0afaa 100644 --- a/Containers/apache/start.sh +++ b/Containers/apache/start.sh @@ -1,10 +1,22 @@ #!/bin/bash +if [ "$AIO_LOG_LEVEL" = 'debug' ]; then + set -x +fi + if [ -z "$NC_DOMAIN" ]; then echo "NC_DOMAIN and NEXTCLOUD_HOST need to be provided. Exiting!" exit 1 fi +CADDY_LOG_LEVEL="$(echo "$AIO_LOG_LEVEL" | tr '[:lower:]' '[:upper:]')" +export CADDY_LOG_LEVEL +if [ "$AIO_LOG_LEVEL" = 'debug' ]; then + export SUPERVISORD_STDOUT=/dev/stdout +else + export SUPERVISORD_STDOUT=NONE +fi + # Need write access to /mnt/data if ! [ -w /mnt/data ]; then echo "Cannot write to /mnt/data" diff --git a/Containers/apache/supervisord.conf b/Containers/apache/supervisord.conf index 693b0021..25f80079 100644 --- a/Containers/apache/supervisord.conf +++ b/Containers/apache/supervisord.conf @@ -5,11 +5,11 @@ pidfile=/var/run/supervisord/supervisord.pid childlogdir=/var/log/supervisord/ logfile_maxbytes=50MB logfile_backups=10 -loglevel=error +loglevel=%(ENV_AIO_LOG_LEVEL)s [program:apache] # Stdout logging is disabled as otherwise the logs are spammed -stdout_logfile=NONE +stdout_logfile=%(ENV_SUPERVISORD_STDOUT)s stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 command=apachectl -DFOREGROUND