From dee50f8630f773c500cd5831eaf5426a4b01ce20 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:28:10 +0000 Subject: [PATCH 01/25] Adding temporary _disable and _tail executables for testing --- overlay/usr/local/bin/_disable | 7 +++++++ overlay/usr/local/bin/_tail | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 overlay/usr/local/bin/_disable create mode 100644 overlay/usr/local/bin/_tail diff --git a/overlay/usr/local/bin/_disable b/overlay/usr/local/bin/_disable new file mode 100644 index 0000000..382d28f --- /dev/null +++ b/overlay/usr/local/bin/_disable @@ -0,0 +1,7 @@ +#!/bin/sh +set -euo pipefail +[[ -z ${1+x} ]] && _error "_tail: You must supply a log file." + +_echo "Disabling ${1} service..." +s6-svc -d /var/run/s6/services/${1} +_done \ No newline at end of file diff --git a/overlay/usr/local/bin/_tail b/overlay/usr/local/bin/_tail new file mode 100644 index 0000000..52c9a34 --- /dev/null +++ b/overlay/usr/local/bin/_tail @@ -0,0 +1,8 @@ +#!/bin/sh +set -euo pipefail +[[ -z ${1+x} ]] && _error "_tail: You must supply a log file." + +if [[ -e ${1} ]] ; then + _echo "Forwarding ${1} to Docker" + exec tail -F ${1} +fi \ No newline at end of file From 95338fb960f35360d5b3ffb6aace0ba14b22e275 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:28:26 +0000 Subject: [PATCH 02/25] Adding support for sending PHP errors to log file --- 7.3/Dockerfile | 3 ++- 7.4/Dockerfile | 3 ++- 8.0/Dockerfile | 3 ++- Dockerfile-automated | 1 + overlay/etc/cont-init.d/22-php-ini-config | 1 + overlay/etc/fix-attrs.d/21-bin | 2 ++ overlay/etc/services.d/php-error-log/run | 12 ++++++++++++ 7 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 overlay/etc/services.d/php-error-log/run diff --git a/7.3/Dockerfile b/7.3/Dockerfile index ed00078..1050a5d 100644 --- a/7.3/Dockerfile +++ b/7.3/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.12-1.2.2 +FROM bcgdesign/nginx:alpine-3.12-1.2.4 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/7.4/Dockerfile b/7.4/Dockerfile index 5310a27..cf7f699 100644 --- a/7.4/Dockerfile +++ b/7.4/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.13-1.2.2 +FROM bcgdesign/nginx:alpine-3.13-1.2.4 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 986daba..01320f7 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.13-1.2.2 +FROM bcgdesign/nginx:alpine-3.13-1.2.4 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/Dockerfile-automated b/Dockerfile-automated index e5a56d7..0bb4aa9 100644 --- a/Dockerfile-automated +++ b/Dockerfile-automated @@ -10,6 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ + PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/overlay/etc/cont-init.d/22-php-ini-config b/overlay/etc/cont-init.d/22-php-ini-config index 7c7f941..327e7a8 100644 --- a/overlay/etc/cont-init.d/22-php-ini-config +++ b/overlay/etc/cont-init.d/22-php-ini-config @@ -12,6 +12,7 @@ _echo "Setting php.ini configuration values..." declare -A VALUES VALUES["display_errors"]="${PHP_INI_DISPLAY_ERRORS}" VALUES["display_startup_errors"]="${PHP_INI_DISPLAY_STARTUP_ERRORS}" +VALUES["error_log"]="${PHP_INI_ERROR_LOG}" VALUES["error_reporting"]="${PHP_INI_ERROR_REPORTING}" VALUES["memory_limit"]="${PHP_INI_MEMORY_LIMIT}" VALUES["post_max_size"]="${PHP_INI_MAX_POST}" diff --git a/overlay/etc/fix-attrs.d/21-bin b/overlay/etc/fix-attrs.d/21-bin index 4d25dd1..bca93e6 100644 --- a/overlay/etc/fix-attrs.d/21-bin +++ b/overlay/etc/fix-attrs.d/21-bin @@ -1 +1,3 @@ /usr/local/bin/php-clean-sessions false www:www 0500 0500 +/usr/local/bin/_disable false root:root 0500 0500 +/usr/local/bin/_tail false root:root 0500 0500 diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run new file mode 100644 index 0000000..b3b8df1 --- /dev/null +++ b/overlay/etc/services.d/php-error-log/run @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv bash +_echo "Starting PHP in FPM mode" +set -euo pipefail + +[[ -z "${PHP_INI_ERROR_LOG}" ]] && _disable "php-error-log" + +if [ -e ${PHP_INI_ERROR_LOG} ]; then + _tail "${PHP_INI_ERROR_LOG}" +else + # wait for service to start and create log file + exec sleep 5 +fi \ No newline at end of file From 47ddb79949dbcae478a85f2c0ad6ebbb2eaec4ca Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:30:40 +0000 Subject: [PATCH 03/25] Adding additional _disable check --- overlay/usr/local/bin/_disable | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/overlay/usr/local/bin/_disable b/overlay/usr/local/bin/_disable index 382d28f..317abd3 100644 --- a/overlay/usr/local/bin/_disable +++ b/overlay/usr/local/bin/_disable @@ -1,7 +1,10 @@ #!/bin/sh set -euo pipefail -[[ -z ${1+x} ]] && _error "_tail: You must supply a log file." +[[ -z ${1+x} ]] && _error "_disable: You must supply the name of a service." -_echo "Disabling ${1} service..." -s6-svc -d /var/run/s6/services/${1} +SVC=/var/run/s6/services/${1} +[[ ! -e ${SVC} ]] && _error "_disable: Service '${SVC}' does not exist." + +_echo "_disable: Disabling ${1} service..." +s6-svc -d ${SVC} _done \ No newline at end of file From 1d2c5aafc99f69333d7c7255b5adce3c0c1dee5b Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:36:20 +0000 Subject: [PATCH 04/25] Renaming _tail to _forward --- overlay/etc/fix-attrs.d/21-bin | 2 +- overlay/etc/services.d/php-error-log/run | 3 +-- overlay/usr/local/bin/_forward | 8 ++++++++ overlay/usr/local/bin/_tail | 8 -------- 4 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 overlay/usr/local/bin/_forward delete mode 100644 overlay/usr/local/bin/_tail diff --git a/overlay/etc/fix-attrs.d/21-bin b/overlay/etc/fix-attrs.d/21-bin index bca93e6..27a7033 100644 --- a/overlay/etc/fix-attrs.d/21-bin +++ b/overlay/etc/fix-attrs.d/21-bin @@ -1,3 +1,3 @@ /usr/local/bin/php-clean-sessions false www:www 0500 0500 /usr/local/bin/_disable false root:root 0500 0500 -/usr/local/bin/_tail false root:root 0500 0500 +/usr/local/bin/_forward false root:root 0500 0500 diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run index b3b8df1..ad3347f 100644 --- a/overlay/etc/services.d/php-error-log/run +++ b/overlay/etc/services.d/php-error-log/run @@ -1,11 +1,10 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" set -euo pipefail [[ -z "${PHP_INI_ERROR_LOG}" ]] && _disable "php-error-log" if [ -e ${PHP_INI_ERROR_LOG} ]; then - _tail "${PHP_INI_ERROR_LOG}" + _forward "${PHP_INI_ERROR_LOG}" else # wait for service to start and create log file exec sleep 5 diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward new file mode 100644 index 0000000..13abbcb --- /dev/null +++ b/overlay/usr/local/bin/_forward @@ -0,0 +1,8 @@ +#!/bin/sh +set -euo pipefail +[[ -z ${1+x} ]] && _error "_forward: You must supply a log file." + +if [[ -e ${1} ]] ; then + _echo "_forward: Forwarding log file '${1}' to Docker" + exec tail -F ${1} +fi \ No newline at end of file diff --git a/overlay/usr/local/bin/_tail b/overlay/usr/local/bin/_tail deleted file mode 100644 index 52c9a34..0000000 --- a/overlay/usr/local/bin/_tail +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -euo pipefail -[[ -z ${1+x} ]] && _error "_tail: You must supply a log file." - -if [[ -e ${1} ]] ; then - _echo "Forwarding ${1} to Docker" - exec tail -F ${1} -fi \ No newline at end of file From 360a89de827755d5ce3c88189f032ea06aebf504 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:36:30 +0000 Subject: [PATCH 05/25] Renaming default PHP error log file --- 7.3/Dockerfile | 2 +- 7.4/Dockerfile | 2 +- 8.0/Dockerfile | 2 +- Dockerfile-automated | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/7.3/Dockerfile b/7.3/Dockerfile index 1050a5d..9874b4b 100644 --- a/7.3/Dockerfile +++ b/7.3/Dockerfile @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ + PHP_INI_ERROR_LOG="/var/log/php/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/7.4/Dockerfile b/7.4/Dockerfile index cf7f699..cf6bcae 100644 --- a/7.4/Dockerfile +++ b/7.4/Dockerfile @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ + PHP_INI_ERROR_LOG="/var/log/php/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 01320f7..cb4756c 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ + PHP_INI_ERROR_LOG="/var/log/php/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/Dockerfile-automated b/Dockerfile-automated index 0bb4aa9..5488a37 100644 --- a/Dockerfile-automated +++ b/Dockerfile-automated @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/errors.log" \ + PHP_INI_ERROR_LOG="/var/log/php/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ From 87a41f31994b197d4b2cdfa993c31ce95b2dca75 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:41:45 +0000 Subject: [PATCH 06/25] Add PHP version to default error log file --- 7.3/Dockerfile | 2 +- 7.4/Dockerfile | 2 +- 8.0/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/7.3/Dockerfile b/7.3/Dockerfile index 9874b4b..74d0d3e 100644 --- a/7.3/Dockerfile +++ b/7.3/Dockerfile @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/error.log" \ + PHP_INI_ERROR_LOG="/var/log/php7/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/7.4/Dockerfile b/7.4/Dockerfile index cf6bcae..9bc717f 100644 --- a/7.4/Dockerfile +++ b/7.4/Dockerfile @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/error.log" \ + PHP_INI_ERROR_LOG="/var/log/php7/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ diff --git a/8.0/Dockerfile b/8.0/Dockerfile index cb4756c..e69f848 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -10,7 +10,7 @@ ENV PHP_FPM_LOG_LEVEL="notice" \ PHP_INI="production" \ PHP_INI_DISPLAY_ERRORS= \ PHP_INI_DISPLAY_STARTUP_ERRORS= \ - PHP_INI_ERROR_LOG="/var/log/php/error.log" \ + PHP_INI_ERROR_LOG="/var/log/php8/error.log" \ PHP_INI_ERROR_REPORTING= \ PHP_INI_MEMORY_LIMIT="256M" \ PHP_INI_MAX_POST="64M" \ From b3ce87cf8e310fc77a8880d94c3fec3c366011bc Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:42:01 +0000 Subject: [PATCH 07/25] Add log output to log forward service --- overlay/etc/services.d/php-error-log/run | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run index ad3347f..b070682 100644 --- a/overlay/etc/services.d/php-error-log/run +++ b/overlay/etc/services.d/php-error-log/run @@ -3,9 +3,6 @@ set -euo pipefail [[ -z "${PHP_INI_ERROR_LOG}" ]] && _disable "php-error-log" -if [ -e ${PHP_INI_ERROR_LOG} ]; then - _forward "${PHP_INI_ERROR_LOG}" -else - # wait for service to start and create log file - exec sleep 5 -fi \ No newline at end of file +_echo "Forwarding PHP log file" +_forward "${PHP_INI_ERROR_LOG}" +exec sleep 5 From 09a84f9946c5dc8bd85539a4fbb2dd4c90c4a5a0 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:48:43 +0000 Subject: [PATCH 08/25] Testing log forward sleeping --- overlay/etc/services.d/php-error-log/run | 2 +- overlay/usr/local/bin/_forward | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run index b070682..53c3f2e 100644 --- a/overlay/etc/services.d/php-error-log/run +++ b/overlay/etc/services.d/php-error-log/run @@ -4,5 +4,5 @@ set -euo pipefail [[ -z "${PHP_INI_ERROR_LOG}" ]] && _disable "php-error-log" _echo "Forwarding PHP log file" -_forward "${PHP_INI_ERROR_LOG}" +_forward "${PHP_INI_ERROR_LOG}s" exec sleep 5 diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward index 13abbcb..478d7c4 100644 --- a/overlay/usr/local/bin/_forward +++ b/overlay/usr/local/bin/_forward @@ -3,6 +3,6 @@ set -euo pipefail [[ -z ${1+x} ]] && _error "_forward: You must supply a log file." if [[ -e ${1} ]] ; then - _echo "_forward: Forwarding log file '${1}' to Docker" + _echo "_forward: ${1}" exec tail -F ${1} fi \ No newline at end of file From 7086301e675d418d13f5eddd1f41c43a6ade861f Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 11:56:57 +0000 Subject: [PATCH 09/25] Moving more code to _forward --- overlay/etc/services.d/php-error-log/run | 7 +------ overlay/usr/local/bin/_disable | 4 ++-- overlay/usr/local/bin/_forward | 14 ++++++++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run index 53c3f2e..c2bc44a 100644 --- a/overlay/etc/services.d/php-error-log/run +++ b/overlay/etc/services.d/php-error-log/run @@ -1,8 +1,3 @@ #!/usr/bin/with-contenv bash set -euo pipefail - -[[ -z "${PHP_INI_ERROR_LOG}" ]] && _disable "php-error-log" - -_echo "Forwarding PHP log file" -_forward "${PHP_INI_ERROR_LOG}s" -exec sleep 5 +_forward "php-error-log" "${PHP_INI_ERROR_LOG}" diff --git a/overlay/usr/local/bin/_disable b/overlay/usr/local/bin/_disable index 317abd3..63e89f6 100644 --- a/overlay/usr/local/bin/_disable +++ b/overlay/usr/local/bin/_disable @@ -3,8 +3,8 @@ set -euo pipefail [[ -z ${1+x} ]] && _error "_disable: You must supply the name of a service." SVC=/var/run/s6/services/${1} -[[ ! -e ${SVC} ]] && _error "_disable: Service '${SVC}' does not exist." +[[ ! -e ${SVC} ]] && _error "_disable: Service ${1} does not exist." -_echo "_disable: Disabling ${1} service..." +_echo "Disabling ${1} service..." s6-svc -d ${SVC} _done \ No newline at end of file diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward index 478d7c4..759956b 100644 --- a/overlay/usr/local/bin/_forward +++ b/overlay/usr/local/bin/_forward @@ -1,8 +1,14 @@ #!/bin/sh set -euo pipefail -[[ -z ${1+x} ]] && _error "_forward: You must supply a log file." +[[ -z ${1+x} ]] && _error "_forward: You must supply the name of the log service." +[[ -z ${2+x} ]] && _error "_forward: Log file not defined, disabling ${1}" && _disable "${1}" -if [[ -e ${1} ]] ; then - _echo "_forward: ${1}" - exec tail -F ${1} +_echo "Forwarding ${1}" + +if [[ -e ${2} ]] ; then + _echo "_forward: ${2}" + exec tail -F ${2} +else + _echo "_forward: ${2} not found, sleeping" + sleep 5 fi \ No newline at end of file From 1424f5130616047dc5e3d61824f0b009e7099999 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 12:03:23 +0000 Subject: [PATCH 10/25] Test for empty log file and exit _forward when empty --- overlay/usr/local/bin/_forward | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward index 759956b..6401880 100644 --- a/overlay/usr/local/bin/_forward +++ b/overlay/usr/local/bin/_forward @@ -1,7 +1,7 @@ #!/bin/sh set -euo pipefail [[ -z ${1+x} ]] && _error "_forward: You must supply the name of the log service." -[[ -z ${2+x} ]] && _error "_forward: Log file not defined, disabling ${1}" && _disable "${1}" +[[ -z ${2+x} || -z "${2}" ]] && _echo "_forward: Log file not defined, disabling ${1}" && _disable "${1}" && exit 0 _echo "Forwarding ${1}" From dfd1561413129444c95f89e633d1ec8dabef2dc5 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 12:05:11 +0000 Subject: [PATCH 11/25] Updating PHP 7.3 to 7.3.27 --- 7.3/PHP_BUILD | 2 +- 7.3/PHP_REVISION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/7.3/PHP_BUILD b/7.3/PHP_BUILD index fceaf5c..c839e12 100644 --- a/7.3/PHP_BUILD +++ b/7.3/PHP_BUILD @@ -1 +1 @@ -7.3.26-r0 \ No newline at end of file +7.3.27-r0 \ No newline at end of file diff --git a/7.3/PHP_REVISION b/7.3/PHP_REVISION index bd6fc59..b9ece44 100644 --- a/7.3/PHP_REVISION +++ b/7.3/PHP_REVISION @@ -1 +1 @@ -7.3.26 \ No newline at end of file +7.3.27 \ No newline at end of file From 01887b91283057b83acd8c4363568c2fdd60e29c Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 12:05:22 +0000 Subject: [PATCH 12/25] Use variable for sleep seconds --- overlay/usr/local/bin/_forward | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward index 6401880..4a41a02 100644 --- a/overlay/usr/local/bin/_forward +++ b/overlay/usr/local/bin/_forward @@ -9,6 +9,7 @@ if [[ -e ${2} ]] ; then _echo "_forward: ${2}" exec tail -F ${2} else - _echo "_forward: ${2} not found, sleeping" - sleep 5 + SLEEP=5 + _echo "_forward: ${2} not found, sleeping for ${SLEEP}s" + sleep ${SLEEP} fi \ No newline at end of file From 6dd625d9c74a0341da1f081f59fdf22e941163f4 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 12:06:47 +0000 Subject: [PATCH 13/25] Disable PHP 7.3 on all platforms except AMD/64 temporarily --- .github/workflows/build_7_3-dev.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_7_3-dev.yml b/.github/workflows/build_7_3-dev.yml index d0be842..0e47986 100644 --- a/.github/workflows/build_7_3-dev.yml +++ b/.github/workflows/build_7_3-dev.yml @@ -26,7 +26,7 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -38,9 +38,8 @@ jobs: context: . file: ./7.3/Dockerfile push: true - platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 + #platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64 tags: | bcgdesign/nginx-php:dev-php-7.3 - From fdd5449a28794a3e2dda578a894b69ff65892d08 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 6 Feb 2021 12:10:46 +0000 Subject: [PATCH 14/25] Changing _forward test --- overlay/usr/local/bin/_forward | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward index 4a41a02..758c8a7 100644 --- a/overlay/usr/local/bin/_forward +++ b/overlay/usr/local/bin/_forward @@ -1,7 +1,8 @@ #!/bin/sh set -euo pipefail [[ -z ${1+x} ]] && _error "_forward: You must supply the name of the log service." -[[ -z ${2+x} || -z "${2}" ]] && _echo "_forward: Log file not defined, disabling ${1}" && _disable "${1}" && exit 0 +[[ -z ${2+x} ]] && _error "_forward: You must supply the path to the log file." +[[ -z "${2}" ]] && _echo "_forward: Log file not defined, disabling ${1}" && _disable "${1}" && exit 0 _echo "Forwarding ${1}" From 6d74bbfe41aaeca6647053ca29985c6d0f9d1c18 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:43:38 +0000 Subject: [PATCH 15/25] Updating Alpine base image --- 7.3/Dockerfile | 2 +- 7.4/Dockerfile | 2 +- 8.0/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/7.3/Dockerfile b/7.3/Dockerfile index 74d0d3e..feafcd9 100644 --- a/7.3/Dockerfile +++ b/7.3/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.12-1.2.4 +FROM bcgdesign/nginx:alpine-3.12-1.3.0 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ diff --git a/7.4/Dockerfile b/7.4/Dockerfile index 9bc717f..b583819 100644 --- a/7.4/Dockerfile +++ b/7.4/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.13-1.2.4 +FROM bcgdesign/nginx:alpine-3.13-1.3.0 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ diff --git a/8.0/Dockerfile b/8.0/Dockerfile index e69f848..89706b4 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM bcgdesign/nginx:alpine-3.13-1.2.4 +FROM bcgdesign/nginx:alpine-3.13-1.3.0 LABEL maintainer="Ben Green " \ org.label-schema.name="Nginx + PHP" \ From a31f48a26bb4864c999df4e4af4367988d8daaf0 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:45:31 +0000 Subject: [PATCH 16/25] Restore all architecture builds --- .github/workflows/build_7_3-dev.yml | 3 +-- .github/workflows/build_7_3-main.yml | 2 -- .github/workflows/build_7_4-dev.yml | 2 -- .github/workflows/build_7_4-main.yml | 2 -- .github/workflows/build_8_0-dev.yml | 2 -- .github/workflows/build_8_0-main.yml | 2 -- 6 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/build_7_3-dev.yml b/.github/workflows/build_7_3-dev.yml index 0e47986..7b76704 100644 --- a/.github/workflows/build_7_3-dev.yml +++ b/.github/workflows/build_7_3-dev.yml @@ -38,8 +38,7 @@ jobs: context: . file: ./7.3/Dockerfile push: true - #platforms: linux/amd64,linux/arm/v7,linux/arm64 - platforms: linux/amd64 + platforms: linux/amd64,linux/arm/v7,linux/arm64 tags: | bcgdesign/nginx-php:dev-php-7.3 - diff --git a/.github/workflows/build_7_3-main.yml b/.github/workflows/build_7_3-main.yml index b605c31..deddb42 100644 --- a/.github/workflows/build_7_3-main.yml +++ b/.github/workflows/build_7_3-main.yml @@ -58,8 +58,6 @@ jobs: file: ./7.3/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:php-7.3 bcgdesign/nginx-php:php-7.3-${{ steps.version.outputs.content }} diff --git a/.github/workflows/build_7_4-dev.yml b/.github/workflows/build_7_4-dev.yml index 0681307..95da9af 100644 --- a/.github/workflows/build_7_4-dev.yml +++ b/.github/workflows/build_7_4-dev.yml @@ -39,8 +39,6 @@ jobs: file: ./7.4/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:dev-php-7 bcgdesign/nginx-php:dev-php-7.4 diff --git a/.github/workflows/build_7_4-main.yml b/.github/workflows/build_7_4-main.yml index ef39f9d..7bd7be3 100644 --- a/.github/workflows/build_7_4-main.yml +++ b/.github/workflows/build_7_4-main.yml @@ -58,8 +58,6 @@ jobs: file: ./7.4/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:latest bcgdesign/nginx-php:${{ steps.version.outputs.content }} diff --git a/.github/workflows/build_8_0-dev.yml b/.github/workflows/build_8_0-dev.yml index e12666c..90c98e3 100644 --- a/.github/workflows/build_8_0-dev.yml +++ b/.github/workflows/build_8_0-dev.yml @@ -39,8 +39,6 @@ jobs: file: ./8.0/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:dev bcgdesign/nginx-php:dev-php-8 diff --git a/.github/workflows/build_8_0-main.yml b/.github/workflows/build_8_0-main.yml index ddd88c6..abe1177 100644 --- a/.github/workflows/build_8_0-main.yml +++ b/.github/workflows/build_8_0-main.yml @@ -58,8 +58,6 @@ jobs: file: ./8.0/Dockerfile push: true platforms: linux/amd64,linux/arm/v7,linux/arm64 - #platforms: linux/amd64,linux/arm/v7 - #platforms: linux/amd64,linux/arm64 tags: | bcgdesign/nginx-php:php-8 bcgdesign/nginx-php:php-8-${{ steps.version.outputs.content }} From 1ced9855d399f1f5537d3a259ceb1da236b9c855 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:45:48 +0000 Subject: [PATCH 17/25] Setting flags and adding documentation comments --- 7.3/php-fpm/run | 11 ++++++++++- 7.4/php-fpm/run | 11 ++++++++++- 8.0/php-fpm/run | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/7.3/php-fpm/run b/7.3/php-fpm/run index 33af069..ef6798a 100644 --- a/7.3/php-fpm/run +++ b/7.3/php-fpm/run @@ -1,3 +1,12 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" + +set -euo pipefail + + +#====================================================================================================================== +# Start PHP FastCGI Process Manager +# -F run in foreground mode (allows S6 to supervise the service) +#====================================================================================================================== + +_echo "Starting PHP FastCGI Process Manager" php-fpm7 -F diff --git a/7.4/php-fpm/run b/7.4/php-fpm/run index 33af069..ef6798a 100644 --- a/7.4/php-fpm/run +++ b/7.4/php-fpm/run @@ -1,3 +1,12 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" + +set -euo pipefail + + +#====================================================================================================================== +# Start PHP FastCGI Process Manager +# -F run in foreground mode (allows S6 to supervise the service) +#====================================================================================================================== + +_echo "Starting PHP FastCGI Process Manager" php-fpm7 -F diff --git a/8.0/php-fpm/run b/8.0/php-fpm/run index 591156d..906bd93 100644 --- a/8.0/php-fpm/run +++ b/8.0/php-fpm/run @@ -1,3 +1,12 @@ #!/usr/bin/with-contenv bash -_echo "Starting PHP in FPM mode" + +set -euo pipefail + + +#====================================================================================================================== +# Start PHP FastCGI Process Manager +# -F run in foreground mode (allows S6 to supervise the service) +#====================================================================================================================== + +_echo "Starting PHP FastCGI Process Manager" php-fpm8 -F From 414e8ebf387de0cdca8630fe910d2a14bb690a89 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:46:07 +0000 Subject: [PATCH 18/25] Show error when unsupported PHP_INI value is set --- overlay/etc/cont-init.d/21-php-ini-download | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/overlay/etc/cont-init.d/21-php-ini-download b/overlay/etc/cont-init.d/21-php-ini-download index 98013bf..8046e09 100644 --- a/overlay/etc/cont-init.d/21-php-ini-download +++ b/overlay/etc/cont-init.d/21-php-ini-download @@ -4,7 +4,7 @@ set -euo pipefail #====================================================================================================================== -# Get php.ini +# Get php.ini #====================================================================================================================== DOWNLOADED="${PHP_DIR}/php.ini-${PHP_INI}.downloaded" @@ -14,9 +14,15 @@ if [ -e ${DOWNLOADED} ] ; then fi if [ "${PHP_INI}" = "development" ] || [ "${PHP_INI}" = "production" ] ; then + URL="https://raw.githubusercontent.com/php/php-src/master/php.ini-${PHP_INI}" _echo "Downloading php.ini from ${URL}..." wget -O "${PHP_DIR}/php.ini" ${URL} \ && touch ${DOWNLOADED} _done + +else + + _error "Unsupported PHP_INI value: '${PHP_INI}'." + fi From dcc006d7a5d45ad306e4994f1245bcdeb8b0fad9 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:46:21 +0000 Subject: [PATCH 19/25] Handling unset envirionment variables --- overlay/etc/cont-init.d/20-php-fpm-config | 2 +- overlay/etc/cont-init.d/22-php-ini-config | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/overlay/etc/cont-init.d/20-php-fpm-config b/overlay/etc/cont-init.d/20-php-fpm-config index cb92484..46cc7be 100644 --- a/overlay/etc/cont-init.d/20-php-fpm-config +++ b/overlay/etc/cont-init.d/20-php-fpm-config @@ -12,7 +12,7 @@ _echo "Setting www.conf configuration values..." declare -A VALUES VALUES["user"]="www" VALUES["group"]="www" -VALUES["log_level"]="${PHP_FPM_LOG_LEVEL}" +VALUES["log_level"]="${PHP_FPM_LOG_LEVEL-}" source /etc/functions/replace.sh replace VALUES "${PHP_DIR}/php-fpm.d/www.conf" diff --git a/overlay/etc/cont-init.d/22-php-ini-config b/overlay/etc/cont-init.d/22-php-ini-config index 327e7a8..1a421f9 100644 --- a/overlay/etc/cont-init.d/22-php-ini-config +++ b/overlay/etc/cont-init.d/22-php-ini-config @@ -10,14 +10,14 @@ set -euo pipefail _echo "Setting php.ini configuration values..." declare -A VALUES -VALUES["display_errors"]="${PHP_INI_DISPLAY_ERRORS}" -VALUES["display_startup_errors"]="${PHP_INI_DISPLAY_STARTUP_ERRORS}" -VALUES["error_log"]="${PHP_INI_ERROR_LOG}" -VALUES["error_reporting"]="${PHP_INI_ERROR_REPORTING}" -VALUES["memory_limit"]="${PHP_INI_MEMORY_LIMIT}" -VALUES["post_max_size"]="${PHP_INI_MAX_POST}" -VALUES["session.gc_maxlifetime"]="${PHP_SESSION_MAX_LIFETIME}" -VALUES["upload_max_filesize"]="${PHP_INI_MAX_UPLOAD}" +VALUES["display_errors"]="${PHP_INI_DISPLAY_ERRORS-}" +VALUES["display_startup_errors"]="${PHP_INI_DISPLAY_STARTUP_ERRORS-}" +VALUES["error_log"]="${PHP_INI_ERROR_LOG-}" +VALUES["error_reporting"]="${PHP_INI_ERROR_REPORTING-}" +VALUES["memory_limit"]="${PHP_INI_MEMORY_LIMIT-}" +VALUES["post_max_size"]="${PHP_INI_MAX_POST-}" +VALUES["session.gc_maxlifetime"]="${PHP_SESSION_MAX_LIFETIME-}" +VALUES["upload_max_filesize"]="${PHP_INI_MAX_UPLOAD-}" source /etc/functions/replace.sh replace VALUES "${PHP_DIR}/php.ini" From 88d6691caaff8bfe90e09a294c07033c921e8f68 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:46:31 +0000 Subject: [PATCH 20/25] Adding documentation comment to replace function --- overlay/etc/functions/replace.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/overlay/etc/functions/replace.sh b/overlay/etc/functions/replace.sh index 35cd736..3ee7dd5 100644 --- a/overlay/etc/functions/replace.sh +++ b/overlay/etc/functions/replace.sh @@ -1,5 +1,13 @@ #!/bin/bash +#====================================================================================================================== +# Replace configuration values in a file. +# +# Arguments: +# 1 array of key/value pairs +# 2 path to the configuration file +#====================================================================================================================== + replace () { # get array and file From d562c24cc528e116376f23c6cb87f88302345bcd Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:46:50 +0000 Subject: [PATCH 21/25] Removing test ezxecutables --- overlay/etc/fix-attrs.d/21-bin | 2 -- overlay/usr/local/bin/_disable | 10 ---------- overlay/usr/local/bin/_forward | 16 ---------------- 3 files changed, 28 deletions(-) delete mode 100644 overlay/usr/local/bin/_disable delete mode 100644 overlay/usr/local/bin/_forward diff --git a/overlay/etc/fix-attrs.d/21-bin b/overlay/etc/fix-attrs.d/21-bin index 27a7033..4d25dd1 100644 --- a/overlay/etc/fix-attrs.d/21-bin +++ b/overlay/etc/fix-attrs.d/21-bin @@ -1,3 +1 @@ /usr/local/bin/php-clean-sessions false www:www 0500 0500 -/usr/local/bin/_disable false root:root 0500 0500 -/usr/local/bin/_forward false root:root 0500 0500 diff --git a/overlay/usr/local/bin/_disable b/overlay/usr/local/bin/_disable deleted file mode 100644 index 63e89f6..0000000 --- a/overlay/usr/local/bin/_disable +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -euo pipefail -[[ -z ${1+x} ]] && _error "_disable: You must supply the name of a service." - -SVC=/var/run/s6/services/${1} -[[ ! -e ${SVC} ]] && _error "_disable: Service ${1} does not exist." - -_echo "Disabling ${1} service..." -s6-svc -d ${SVC} -_done \ No newline at end of file diff --git a/overlay/usr/local/bin/_forward b/overlay/usr/local/bin/_forward deleted file mode 100644 index 758c8a7..0000000 --- a/overlay/usr/local/bin/_forward +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -set -euo pipefail -[[ -z ${1+x} ]] && _error "_forward: You must supply the name of the log service." -[[ -z ${2+x} ]] && _error "_forward: You must supply the path to the log file." -[[ -z "${2}" ]] && _echo "_forward: Log file not defined, disabling ${1}" && _disable "${1}" && exit 0 - -_echo "Forwarding ${1}" - -if [[ -e ${2} ]] ; then - _echo "_forward: ${2}" - exec tail -F ${2} -else - SLEEP=5 - _echo "_forward: ${2} not found, sleeping for ${SLEEP}s" - sleep ${SLEEP} -fi \ No newline at end of file From 9222b6402649a3c10249aace57dd020414622eb1 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:47:04 +0000 Subject: [PATCH 22/25] Adding comments and flags --- overlay/etc/services.d/php-error-log/run | 7 +++++++ overlay/etc/services.d/php-fpm/finish | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/overlay/etc/services.d/php-error-log/run b/overlay/etc/services.d/php-error-log/run index c2bc44a..19d724d 100644 --- a/overlay/etc/services.d/php-error-log/run +++ b/overlay/etc/services.d/php-error-log/run @@ -1,3 +1,10 @@ #!/usr/bin/with-contenv bash + set -euo pipefail + + +#====================================================================================================================== +# Forward PHP errors to Docker +#====================================================================================================================== + _forward "php-error-log" "${PHP_INI_ERROR_LOG}" diff --git a/overlay/etc/services.d/php-fpm/finish b/overlay/etc/services.d/php-fpm/finish index 1706b72..6b1e755 100644 --- a/overlay/etc/services.d/php-fpm/finish +++ b/overlay/etc/services.d/php-fpm/finish @@ -1,2 +1,10 @@ #!/usr/bin/with-contenv bash + +set -euo pipefail + + +#====================================================================================================================== +# Use base executable to terminate all services +#====================================================================================================================== + _terminate From aee37530d27e484f6951243a28b37e8504bc77f8 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:47:16 +0000 Subject: [PATCH 23/25] Adding ignore-favicon.conf to default Nginx configuration --- overlay/etc/nginx/sites/localhost.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/overlay/etc/nginx/sites/localhost.conf b/overlay/etc/nginx/sites/localhost.conf index d8d1e78..70088f4 100644 --- a/overlay/etc/nginx/sites/localhost.conf +++ b/overlay/etc/nginx/sites/localhost.conf @@ -4,5 +4,6 @@ server { include helpers/nginx-error-pages.conf; include helpers/php-try-all.conf; include helpers/php-try-php.conf; + include helpers/ignore-favicon.conf; include helpers/static-files.conf; } \ No newline at end of file From 609fadc22d15aae1355b8fb6292a8280f592fc6c Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:47:27 +0000 Subject: [PATCH 24/25] Adding flags and documentation comments --- overlay/etc/periodic/hourly/php-clean-sessions | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/overlay/etc/periodic/hourly/php-clean-sessions b/overlay/etc/periodic/hourly/php-clean-sessions index 354a2e6..73a4912 100644 --- a/overlay/etc/periodic/hourly/php-clean-sessions +++ b/overlay/etc/periodic/hourly/php-clean-sessions @@ -1,2 +1,10 @@ #!/usr/bin/with-contenv bash + +set -euo pipefail + + +#====================================================================================================================== +# Call php-clean-sessions executable +#====================================================================================================================== + s6-setuidgid www php-clean-sessions From 82626cf6ab3bdee1fde6bd552ede61abfa6bd762 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 7 Feb 2021 13:49:21 +0000 Subject: [PATCH 25/25] Bumping version to 1.3.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d2d61a7..589268e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2 \ No newline at end of file +1.3.0 \ No newline at end of file