Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #528 from jdeathe/centos-6-develop
Browse files Browse the repository at this point in the history
Release changes for 1.10.4
  • Loading branch information
jdeathe authored Jan 27, 2018
2 parents ddf7361 + fe85458 commit 5bec7bc
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 47 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ 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 - 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`.
- 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

- Updates source image to [1.8.3 tag](https://github.com/jdeathe/centos-ssh/releases/tag/1.8.3).
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <james.deathe@gmail.com>" \
install="docker run \
Expand Down
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
```

Expand All @@ -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
```

Expand All @@ -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 \
Expand All @@ -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.
Expand All @@ -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"
```

Expand All @@ -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"
```

Expand All @@ -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"
```

Expand All @@ -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
```

Expand All @@ -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
```

Expand All @@ -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
Expand Down Expand Up @@ -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" \
...
```

Expand Down
13 changes: 12 additions & 1 deletion src/etc/services-config/httpd/conf.virtualhost.d/00-log.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
ErrorLog "${APACHE_ERROR_LOG_LOCATION}"
LogLevel "${APACHE_ERROR_LOG_LEVEL}"
<IfModule mod_log_config.c>
CustomLog "${APACHE_CUSTOM_LOG_LOCATION}" "${APACHE_CUSTOM_LOG_FORMAT}"
CustomLog "${APACHE_CUSTOM_LOG_LOCATION}" "${APACHE_CUSTOM_LOG_FORMAT}" env=!SKIP_CUSTOM_LOG
</IfModule>
<IfModule mod_setenvif.c>
<IfVersion < 2.4>
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
</IfVersion>
<IfVersion >= 2.4>
SetEnvIfExpr "-R '127.0.0.1' && %{HTTP_USER_AGENT} == 'Docker-Healthcheck'" SKIP_CUSTOM_LOG
</IfVersion>
</IfModule>
2 changes: 1 addition & 1 deletion src/etc/systemd/system/centos-ssh-apache-php@.service
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/usr/bin/healthcheck
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 37 additions & 12 deletions src/usr/sbin/httpd-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
35 changes: 24 additions & 11 deletions test/shpec/operation_shpec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""

Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down

0 comments on commit 5bec7bc

Please sign in to comment.