From 9805f55872e985c6c478b7198b406fc55f85a9b8 Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 09:07:17 +0100 Subject: [PATCH 1/8] Update apache2-foreground --- utils/apache2-foreground | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/utils/apache2-foreground b/utils/apache2-foreground index 5fe22e26..ad2c8526 100755 --- a/utils/apache2-foreground +++ b/utils/apache2-foreground @@ -37,4 +37,25 @@ for e in "${!APACHE_@}"; do fi done -exec apache2 -DFOREGROUND "$@" +_shutdown() { + echo "Stopping Apache2 graceful..." + + pid=$(cat "/var/run/apache2/apache2.pid") + apachectl graceful-stop + + echo "Waiting for PID $pid to exit..." + tail --pid=$pid -f /dev/null + + echo "Exiting..." + stop=true +} + +stop=false +trap _shutdown SIGTERM + +echo "Starting Apache2 in the background..." +apache2 -k start "$@" + +while [ "$stop" = false ]; do + sleep 0.5; +done From d49ba9bfd08c79c16cfe7bc8aecf1d3e7ecaaeca Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 09:08:19 +0100 Subject: [PATCH 2/8] Update Dockerfile.slim.apache --- Dockerfile.slim.apache | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile.slim.apache b/Dockerfile.slim.apache index 597488d6..a7083445 100644 --- a/Dockerfile.slim.apache +++ b/Dockerfile.slim.apache @@ -194,9 +194,6 @@ RUN a2enconf docker-php ENV PHP_EXTRA_BUILD_DEPS apache2-dev ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi -# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop -STOPSIGNAL SIGWINCH - COPY utils/apache2-foreground /usr/local/bin/ EXPOSE 80 From 8356e34cdb23897fd5fd83302302e9b6e000c4e2 Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 14:48:05 +0100 Subject: [PATCH 3/8] Rename apache2-foreground to apache2-background --- utils/{apache2-foreground => apache2-background} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename utils/{apache2-foreground => apache2-background} (100%) diff --git a/utils/apache2-foreground b/utils/apache2-background similarity index 100% rename from utils/apache2-foreground rename to utils/apache2-background From c67a4573f5308f4ef7fc05eb0f10ab080d2064bb Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 14:49:45 +0100 Subject: [PATCH 4/8] Update Dockerfile.slim.apache --- Dockerfile.slim.apache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.slim.apache b/Dockerfile.slim.apache index a7083445..0a269609 100644 --- a/Dockerfile.slim.apache +++ b/Dockerfile.slim.apache @@ -194,7 +194,7 @@ RUN a2enconf docker-php ENV PHP_EXTRA_BUILD_DEPS apache2-dev ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi -COPY utils/apache2-foreground /usr/local/bin/ +COPY utils/apache2-background /usr/local/bin/ EXPOSE 80 @@ -308,7 +308,7 @@ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf RUN a2enconf servername -CMD ["apache2-foreground"] +CMD ["apache2-background"] # |-------------------------------------------------------------------------- # | Entrypoint From 81deb20c58b1a9093f33127b34df17f3cb4b33ce Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 14:50:19 +0100 Subject: [PATCH 5/8] Update docker-entrypoint-as-root.sh --- utils/docker-entrypoint-as-root.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/docker-entrypoint-as-root.sh b/utils/docker-entrypoint-as-root.sh index f8c6c9ea..0a5ad751 100755 --- a/utils/docker-entrypoint-as-root.sh +++ b/utils/docker-entrypoint-as-root.sh @@ -145,7 +145,7 @@ else fi # We should run the command with the user of the directory... (unless this is Apache, that must run as root...) -if [[ "$@" == "apache2-foreground" ]]; then +if [[ "$@" == "apache2-background" ]]; then /usr/local/bin/apache-expose-envvars.sh; exec "$@"; else From 046c8addfee28b1716b70008a01085475b5a779f Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 14:51:11 +0100 Subject: [PATCH 6/8] Update Dockerfile.slim.blueprint --- utils/Dockerfile.slim.blueprint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/Dockerfile.slim.blueprint b/utils/Dockerfile.slim.blueprint index 3d43ca25..dea4b885 100644 --- a/utils/Dockerfile.slim.blueprint +++ b/utils/Dockerfile.slim.blueprint @@ -199,7 +199,7 @@ ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop STOPSIGNAL SIGWINCH -COPY utils/apache2-foreground /usr/local/bin/ +COPY utils/apache2-background /usr/local/bin/ EXPOSE 80 @@ -329,7 +329,7 @@ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf RUN a2enconf servername -CMD ["apache2-foreground"] +CMD ["apache2-background"] # |-------------------------------------------------------------------------- # | Entrypoint From 125e009762e4bc7d71f7dd500ed0d729e82e8ac1 Mon Sep 17 00:00:00 2001 From: Mario Penterman Date: Mon, 26 Oct 2020 15:02:12 +0100 Subject: [PATCH 7/8] Update Dockerfile.slim.blueprint --- utils/Dockerfile.slim.blueprint | 3 --- 1 file changed, 3 deletions(-) diff --git a/utils/Dockerfile.slim.blueprint b/utils/Dockerfile.slim.blueprint index dea4b885..0211c308 100644 --- a/utils/Dockerfile.slim.blueprint +++ b/utils/Dockerfile.slim.blueprint @@ -196,9 +196,6 @@ RUN a2enconf docker-php ENV PHP_EXTRA_BUILD_DEPS apache2-dev ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi -# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop -STOPSIGNAL SIGWINCH - COPY utils/apache2-background /usr/local/bin/ EXPOSE 80 From a206342b8aaee4164dfee1e5e46a390c2cf6f0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 26 Oct 2020 17:41:38 +0100 Subject: [PATCH 8/8] Update utils/apache2-background --- utils/apache2-background | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/apache2-background b/utils/apache2-background index ad2c8526..901690cc 100755 --- a/utils/apache2-background +++ b/utils/apache2-background @@ -38,7 +38,7 @@ for e in "${!APACHE_@}"; do done _shutdown() { - echo "Stopping Apache2 graceful..." + echo "Stopping Apache2 gracefully..." pid=$(cat "/var/run/apache2/apache2.pid") apachectl graceful-stop