From 14308631b1ed9d7cf11b477b5ae7e5607805074c Mon Sep 17 00:00:00 2001 From: James Deathe Date: Thu, 25 Jan 2018 00:23:01 +0000 Subject: [PATCH 1/6] ISSUE 509: Patches back #508. --- CHANGELOG.md | 4 ++++ src/usr/bin/healthcheck | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86482c8..d2eaddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ Summary of release changes for Version 1. CentOS-6 6.9 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1. +### 1.10.4 - Unreleased + +- Fixes issue with unusable healthcheck error messages. + ### 1.10.3 - 2018-01-16 - Updates source image to [1.8.3 tag](https://github.com/jdeathe/centos-ssh/releases/tag/1.8.3). diff --git a/src/usr/bin/healthcheck b/src/usr/bin/healthcheck index 7999c8a..ae79819 100755 --- a/src/usr/bin/healthcheck +++ b/src/usr/bin/healthcheck @@ -41,9 +41,9 @@ function __last_check_passed () function __print_message () { - local -r message="${2:-}" local -r type="${1:-}" local -r quiet=${QUIET:-false} + local message="${2:-}" local prefix="" case "${type}" in From 8c7d5837be06ca638941006ec78de12abf6b526b Mon Sep 17 00:00:00 2001 From: James Deathe Date: Thu, 25 Jan 2018 01:01:20 +0000 Subject: [PATCH 2/6] ISSUE 511: Patches back #507. --- CHANGELOG.md | 1 + README.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2eaddf..8ca121f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ CentOS-6 6.9 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1. ### 1.10.4 - Unreleased - Fixes issue with unusable healthcheck error messages. +- Adds correction to README.md example for usage of `APACHE_ERROR_LOG_LOCATION` and `APACHE_ERROR_LOG_LEVEL`. ### 1.10.3 - 2018-01-16 diff --git a/README.md b/README.md index 07cc802..b9dd27d 100644 --- a/README.md +++ b/README.md @@ -277,8 +277,8 @@ The Apache ErrorLog can be defined using `APACHE_ERROR_LOG_LOCATION` to set a fi ``` ... - --env "APACHE_CUSTOM_LOG_LOCATION=/var/log/httpd/error_log" \ - --env "APACHE_CUSTOM_LOG_FORMAT=error" \ + --env "APACHE_ERROR_LOG_LOCATION=/var/log/httpd/error_log" \ + --env "APACHE_ERROR_LOG_LEVEL=error" \ ... ``` From db7225a2560eb07359de53c97b3e025a3af45686 Mon Sep 17 00:00:00 2001 From: James Deathe Date: Fri, 26 Jan 2018 16:09:52 +0000 Subject: [PATCH 3/6] ISSUE 512: Patches back #510. --- CHANGELOG.md | 1 + src/usr/sbin/httpd-bootstrap | 49 +++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ca121f..2873dda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ CentOS-6 6.9 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1. - Fixes issue with unusable healthcheck error messages. - Adds correction to README.md example for usage of `APACHE_ERROR_LOG_LOCATION` and `APACHE_ERROR_LOG_LEVEL`. +- Fixes issue with environment variables not getting replaced within PHP files in the default scan directory when a app package is installed that contains no custom PHP drop-in configuration files. ### 1.10.3 - 2018-01-16 diff --git a/src/usr/sbin/httpd-bootstrap b/src/usr/sbin/httpd-bootstrap index efa1200..d31e557 100755 --- a/src/usr/sbin/httpd-bootstrap +++ b/src/usr/sbin/httpd-bootstrap @@ -320,24 +320,49 @@ function load_httpd_conf_scan_files () fi } +function load_php_ini_scan_file () +{ + local FILE_PATH="${1:-}" + local SCAN_DIRECTORY="${2:-}" + + if [[ -n ${SCAN_DIRECTORY} ]] \ + && [[ -n ${FILE_PATH} ]] \ + && [[ -s ${FILE_PATH} ]] + then + # Replace environment variables + printf -- \ + '%s' \ + "$( + eval \ + "cat <<-EOF + $(<"${FILE_PATH}") + EOF" 2> /dev/null + )" \ + > "${SCAN_DIRECTORY}/${FILE_PATH##*/}" + fi +} + function load_php_ini_scan_files () { local FILE_PATH local PACKAGE_PATH="${1:-}" + local SCAN_DIRECTORY="/etc/php.d" + + for FILE_PATH in "${SCAN_DIRECTORY}"/*.ini + do + load_php_ini_scan_file \ + "${FILE_PATH}" \ + "${SCAN_DIRECTORY}" + done if [[ -n ${PACKAGE_PATH} ]] \ - && [[ -d ${PACKAGE_PATH}/etc/php.d ]]; then - # Replace environment variables to support fcgid php-wrapper - for FILE_PATH in /etc/php.d/*.ini "${PACKAGE_PATH}"/etc/php.d/*.ini; do - printf -- \ - '%s' \ - "$( - eval \ - "cat <<-EOF - $(<"${FILE_PATH}") - EOF" 2> /dev/null - )" \ - > "/etc/php.d/${FILE_PATH##*/}" + && [[ -d ${PACKAGE_PATH}/etc/php.d ]] + then + for FILE_PATH in "${PACKAGE_PATH}/${SCAN_DIRECTORY}"/*.ini + do + load_php_ini_scan_file \ + "${FILE_PATH}" \ + "${SCAN_DIRECTORY}" done fi } From a17e7ba43324bf6972e7e5429b39451eb807b366 Mon Sep 17 00:00:00 2001 From: James Deathe Date: Fri, 26 Jan 2018 21:29:31 +0000 Subject: [PATCH 4/6] ISSUE 521: Patches back #520. --- CHANGELOG.md | 1 + test/shpec/operation_shpec.sh | 35 ++++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2873dda..ef23d0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CentOS-6 6.9 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1. - Fixes issue with unusable healthcheck error messages. - Adds correction to README.md example for usage of `APACHE_ERROR_LOG_LOCATION` and `APACHE_ERROR_LOG_LEVEL`. - Fixes issue with environment variables not getting replaced within PHP files in the default scan directory when a app package is installed that contains no custom PHP drop-in configuration files. +- Fixes prerequisite test when testing disable wrapper features. ### 1.10.3 - 2018-01-16 diff --git a/test/shpec/operation_shpec.sh b/test/shpec/operation_shpec.sh index cf52b7f..d499552 100644 --- a/test/shpec/operation_shpec.sh +++ b/test/shpec/operation_shpec.sh @@ -686,6 +686,7 @@ function test_custom_configuration () local curl_session_name="" local header_x_service_operating_mode="" local header_x_service_uid="" + local is_up="" local php_date_timezone="" local protocol="" @@ -1987,16 +1988,23 @@ function test_custom_configuration () # Healthcheck should fail unless running PHP-FPM without Apache. it "Can disable httpd-bootstrap." + is_up="1" + docker ps \ - --format "name=apache-php.pool-1.1.1" \ - &> /dev/null \ - && docker top \ + --quiet \ + --filter "name=apache-php.pool-1.1.1" \ + --filter "health=unhealthy" \ + &> /dev/null + is_up="${?}" + + docker top \ apache-php.pool-1.1.1 \ + &> /dev/null \ | grep -qE '/usr/sbin/httpd(\.worker|\.event)? ' assert equal \ - "${?}" \ - "1" + "${is_up}:${?}" \ + "0:1" end __terminate_container \ @@ -2013,17 +2021,22 @@ function test_custom_configuration () sleep ${STARTUP_TIME} it "Can disable httpd-wrapper." + is_up="1" + docker ps \ - --format "name=apache-php.pool-1.1.1" \ - --format "health=healthy" \ - &> /dev/null \ - && docker top \ + --filter "name=apache-php.pool-1.1.1" \ + --filter "health=healthy" \ + &> /dev/null + is_up="${?}" + + docker top \ apache-php.pool-1.1.1 \ + &> /dev/null \ | grep -qE '/usr/sbin/httpd(\.worker|\.event)? ' assert equal \ - "${?}" \ - "1" + "${is_up}:${?}" \ + "0:1" end __terminate_container \ From e964e0a4ce2f764043c976a179de3f7d92aca9e5 Mon Sep 17 00:00:00 2001 From: James Deathe Date: Sat, 27 Jan 2018 01:42:37 +0000 Subject: [PATCH 5/6] ISSUE 524: Patches back #513. --- CHANGELOG.md | 1 + .../httpd/conf.virtualhost.d/00-log.conf | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef23d0b..ae2b945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CentOS-6 6.9 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1. - Adds correction to README.md example for usage of `APACHE_ERROR_LOG_LOCATION` and `APACHE_ERROR_LOG_LEVEL`. - Fixes issue with environment variables not getting replaced within PHP files in the default scan directory when a app package is installed that contains no custom PHP drop-in configuration files. - Fixes prerequisite test when testing disable wrapper features. +- Adds exclusion of internal "Docker-Healthcheck" requests from the access log. ### 1.10.3 - 2018-01-16 diff --git a/src/etc/services-config/httpd/conf.virtualhost.d/00-log.conf b/src/etc/services-config/httpd/conf.virtualhost.d/00-log.conf index f012db7..4ad474d 100644 --- a/src/etc/services-config/httpd/conf.virtualhost.d/00-log.conf +++ b/src/etc/services-config/httpd/conf.virtualhost.d/00-log.conf @@ -1,5 +1,16 @@ ErrorLog "${APACHE_ERROR_LOG_LOCATION}" LogLevel "${APACHE_ERROR_LOG_LEVEL}" - CustomLog "${APACHE_CUSTOM_LOG_LOCATION}" "${APACHE_CUSTOM_LOG_FORMAT}" + CustomLog "${APACHE_CUSTOM_LOG_LOCATION}" "${APACHE_CUSTOM_LOG_FORMAT}" env=!SKIP_CUSTOM_LOG + + + + SetEnvIf Request_Method ".*" TRUSTED_ADDRESS=false + SetEnvIf Remote_Addr "^127\.0\.0\.1$" TRUSTED_ADDRESS=true + SetEnvIf User-Agent "^Docker-Healthcheck$" SKIP_CUSTOM_LOG + SetEnvIf TRUSTED_ADDRESS "false" !SKIP_CUSTOM_LOG + + = 2.4> + SetEnvIfExpr "-R '127.0.0.1' && %{HTTP_USER_AGENT} == 'Docker-Healthcheck'" SKIP_CUSTOM_LOG + From fe854585048900fab27ed64ebf4d73b9a85b837b Mon Sep 17 00:00:00 2001 From: James Deathe Date: Sat, 27 Jan 2018 23:07:51 +0000 Subject: [PATCH 6/6] Release changes for 1.10.4 and 2.2.4. --- CHANGELOG.md | 2 +- Dockerfile | 2 +- README.md | 36 +++++++++---------- .../system/centos-ssh-apache-php@.service | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae2b945..4ab9f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Summary of release changes for Version 1. CentOS-6 6.9 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1. -### 1.10.4 - Unreleased +### 1.10.4 - 2018-01-27 - Fixes issue with unusable healthcheck error messages. - Adds correction to README.md example for usage of `APACHE_ERROR_LOG_LOCATION` and `APACHE_ERROR_LOG_LEVEL`. diff --git a/Dockerfile b/Dockerfile index 6911787..625799d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -300,7 +300,7 @@ ENV APACHE_AUTOSTART_HTTPD_BOOTSTRAP=true \ # ----------------------------------------------------------------------------- # Set image metadata # ----------------------------------------------------------------------------- -ARG RELEASE_VERSION="1.10.3" +ARG RELEASE_VERSION="1.10.4" LABEL \ maintainer="James Deathe " \ install="docker run \ diff --git a/README.md b/README.md index b9dd27d..31af47a 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,16 @@ Apache PHP web server, loading only a minimal set of Apache modules by default. ### Tags and respective `Dockerfile` links -- `centos-6-httpd24u-php56u`, `centos-6-httpd24u-php56u-2.2.3`, `2.2.3` [(centos-6-httpd24u-php56u/Dockerfile)](https://github.com/jdeathe/centos-ssh-apache-php/blob/centos-6-httpd24u-php56u/Dockerfile) -- `centos-6`, `centos-6-1.10.3`, `1.10.3` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-apache-php/blob/centos-6/Dockerfile) +- `centos-6-httpd24u-php56u`, `centos-6-httpd24u-php56u-2.2.4`, `2.2.4` [(centos-6-httpd24u-php56u/Dockerfile)](https://github.com/jdeathe/centos-ssh-apache-php/blob/centos-6-httpd24u-php56u/Dockerfile) +- `centos-6`, `centos-6-1.10.4`, `1.10.4` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-apache-php/blob/centos-6/Dockerfile) #### centos-6 -The latest CentOS-6 Standard Package based release can be pulled from the `centos-6` Docker tag. It is recommended to select a specific release tag - the convention is `centos-6-1.10.3` or `1.10.3` for the [1.10.3](https://github.com/jdeathe/centos-ssh-apache-php/tree/1.10.3) release tag. This build of [Apache](https://httpd.apache.org/), (httpd CentOS package), uses the mpm_prefork_module and php5_module modules for handling [PHP](http://php.net/). +The latest CentOS-6 Standard Package based release can be pulled from the `centos-6` Docker tag. It is recommended to select a specific release tag - the convention is `centos-6-1.10.4` or `1.10.4` for the [1.10.4](https://github.com/jdeathe/centos-ssh-apache-php/tree/1.10.4) release tag. This build of [Apache](https://httpd.apache.org/), (httpd CentOS package), uses the mpm_prefork_module and php5_module modules for handling [PHP](http://php.net/). #### centos-6-httpd24u-php56u -The latest CentOS-6 [IUS](https://ius.io) Apache 2.4, PHP-FPM 5.6 based release can be pulled from the `centos-6-httpd24u-php56u` Docker tag. It is recommended to select a specific release tag - the convention is `centos-6-httpd24u-php56u-2.2.3` or `2.2.3` for the [2.2.3](https://github.com/jdeathe/centos-ssh-apache-php/tree/2.2.3) release tag. This build of [Apache](https://httpd.apache.org/), (httpd24u package), uses the mpm_prefork_module and php-fpm for handling [PHP](http://php.net/). This version has the option of using the worker or event MPM. +The latest CentOS-6 [IUS](https://ius.io) Apache 2.4, PHP-FPM 5.6 based release can be pulled from the `centos-6-httpd24u-php56u` Docker tag. It is recommended to select a specific release tag - the convention is `centos-6-httpd24u-php56u-2.2.4` or `2.2.4` for the [2.2.4](https://github.com/jdeathe/centos-ssh-apache-php/tree/2.2.4) release tag. This build of [Apache](https://httpd.apache.org/), (httpd24u package), uses the mpm_prefork_module and php-fpm for handling [PHP](http://php.net/). This version has the option of using the worker or event MPM. Included in the build are the [SCL](https://www.softwarecollections.org/), [EPEL](http://fedoraproject.org/wiki/EPEL) and [IUS](https://ius.io) repositories. Installed packages include [OpenSSH](http://www.openssh.com/portable.html) secure shell, [vim-minimal](http://www.vim.org/), [elinks](http://elinks.or.cz) (for fullstatus support), PHP [Memcached](http://pecl.php.net/package/memcached) are installed along with python-setuptools, [supervisor](http://supervisord.org/) and [supervisor-stdout](https://github.com/coderanger/supervisor-stdout). The `centos-6` "Standard" PHP 5.3 build includes PHP [APC](http://pecl.php.net/package/APC) where Zend Opcache is bundled in PHP 5.6. @@ -97,10 +97,10 @@ $ docker run \ --volume /:/media/root \ --env BASH_ENV="" \ --env ENV="" \ - jdeathe/centos-ssh-apache-php:1.10.3 \ + jdeathe/centos-ssh-apache-php:1.10.4 \ /usr/sbin/scmi install \ --chroot=/media/root \ - --tag=1.10.3 \ + --tag=1.10.4 \ --name=apache-php.pool-1.1.1 ``` @@ -115,10 +115,10 @@ $ docker run \ --volume /:/media/root \ --env BASH_ENV="" \ --env ENV="" \ - jdeathe/centos-ssh-apache-php:1.10.3 \ + jdeathe/centos-ssh-apache-php:1.10.4 \ /usr/sbin/scmi uninstall \ --chroot=/media/root \ - --tag=1.10.3 \ + --tag=1.10.4 \ --name=apache-php.pool-1.1.1 ``` @@ -133,10 +133,10 @@ $ docker run \ --volume /:/media/root \ --env BASH_ENV="" \ --env ENV="" \ - jdeathe/centos-ssh-apache-php:1.10.3 \ + jdeathe/centos-ssh-apache-php:1.10.4 \ /usr/sbin/scmi install \ --chroot=/media/root \ - --tag=1.10.3 \ + --tag=1.10.4 \ --name=apache-php.pool-1.1.1 \ --manager=systemd \ --register \ @@ -157,7 +157,7 @@ Since release `centos-6-1.7.2` the install template has been added to the image _NOTE:_ A prerequisite of the following examples is that the image has been pulled (or loaded from the release package). ``` -$ docker pull jdeathe/centos-ssh-apache-php:1.10.3 +$ docker pull jdeathe/centos-ssh-apache-php:1.10.4 ``` To see detailed information about the image run `scmi` with the `--info` option. To see all available `scmi` options run with the `--help` option. @@ -166,7 +166,7 @@ To see detailed information about the image run `scmi` with the `--info` option. $ eval "sudo -E $( docker inspect \ -f "{{.ContainerConfig.Labels.install}}" \ - jdeathe/centos-ssh-apache-php:1.10.3 + jdeathe/centos-ssh-apache-php:1.10.4 ) --info" ``` @@ -176,7 +176,7 @@ To perform an installation using the docker name `apache-php.pool-1.2.1` simply $ eval "sudo -E $( docker inspect \ -f "{{.ContainerConfig.Labels.install}}" \ - jdeathe/centos-ssh-apache-php:1.10.3 + jdeathe/centos-ssh-apache-php:1.10.4 ) --name=apache-php.pool-1.2.1" ``` @@ -186,7 +186,7 @@ To uninstall use the *same command* that was used to install but with the `unins $ eval "sudo -E $( docker inspect \ -f "{{.ContainerConfig.Labels.uninstall}}" \ - jdeathe/centos-ssh-apache-php:1.10.3 + jdeathe/centos-ssh-apache-php:1.10.4 ) --name=apache-php.pool-1.2.1" ``` @@ -199,7 +199,7 @@ To see detailed information about the image run `scmi` with the `--info` option. ``` $ sudo -E atomic install \ -n apache-php.pool-1.3.1 \ - jdeathe/centos-ssh-apache-php:1.10.3 \ + jdeathe/centos-ssh-apache-php:1.10.4 \ --info ``` @@ -208,14 +208,14 @@ To perform an installation using the docker name `apache-php.pool-1.3.1` simply ``` $ sudo -E atomic install \ -n apache-php.pool-1.3.1 \ - jdeathe/centos-ssh-apache-php:1.10.3 + jdeathe/centos-ssh-apache-php:1.10.4 ``` Alternatively, you could use the `scmi` options `--name` or `-n` for naming the container. ``` $ sudo -E atomic install \ - jdeathe/centos-ssh-apache-php:1.10.3 \ + jdeathe/centos-ssh-apache-php:1.10.4 \ --name apache-php.pool-1.3.1 ``` @@ -224,7 +224,7 @@ To uninstall use the *same command* that was used to install but with the `unins ``` $ sudo -E atomic uninstall \ -n apache-php.pool-1.3.1 \ - jdeathe/centos-ssh-apache-php:1.10.3 + jdeathe/centos-ssh-apache-php:1.10.4 ``` #### Environment Variables diff --git a/src/etc/systemd/system/centos-ssh-apache-php@.service b/src/etc/systemd/system/centos-ssh-apache-php@.service index 099324e..76fc93b 100644 --- a/src/etc/systemd/system/centos-ssh-apache-php@.service +++ b/src/etc/systemd/system/centos-ssh-apache-php@.service @@ -52,7 +52,7 @@ Environment="DOCKER_USER=jdeathe" Environment="DOCKER_CONTAINER_OPTS=" Environment="DOCKER_IMAGE_PACKAGE_PATH=/var/opt/scmi/packages" Environment="DOCKER_IMAGE_NAME=centos-ssh-apache-php" -Environment="DOCKER_IMAGE_TAG=1.10.3" +Environment="DOCKER_IMAGE_TAG=1.10.4" Environment="DOCKER_PORT_MAP_TCP_80=8080" Environment="DOCKER_PORT_MAP_TCP_443=9443" Environment="DOCKER_PORT_MAP_TCP_8443=NULL"