From 730df1becdbd8d5b5db39c51e0293bb1744f1fe5 Mon Sep 17 00:00:00 2001 From: James Deathe Date: Tue, 16 Jan 2018 09:46:00 +0000 Subject: [PATCH 1/2] ISSUE 133: Updates upstream source to 1.10.3 --- CHANGELOG.md | 4 + Dockerfile | 2 +- README.md | 5 + default.mk | 1 + environment.mk | 1 + .../centos-ssh-apache-php-fcgi@.service | 2 + src/opt/scmi/environment.sh | 1 + test/shpec/operation_shpec.sh | 147 +++++++++++++----- 8 files changed, 124 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08b8951..78501b8 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-CGI 5.3 (FastCGI), PHP memcached 1.0, PHP APC 3.1. +### 1.10.3 - Unreleased + +- Updates image source to [release 1.10.3](https://github.com/jdeathe/centos-ssh-apache-php/releases/tag/1.10.3). + ### 1.10.2 - 2017-12-27 - Updates image source to [release 1.10.2](https://github.com/jdeathe/centos-ssh-apache-php/releases/tag/1.10.2). diff --git a/Dockerfile b/Dockerfile index 282948e..ac5b994 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ # CentOS-6, Apache 2.2, PHP 5.3, PHP Memcached 1.0, PHP APC 3.1. # # ============================================================================= -FROM jdeathe/centos-ssh-apache-php:1.10.2 +FROM jdeathe/centos-ssh-apache-php:1.10.3 # ----------------------------------------------------------------------------- # FastCGI support diff --git a/README.md b/README.md index 6bd682c..a86dec9 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,8 @@ $ docker run \ ##### SCMI Fleet Support +**_Deprecation Notice:_** The fleet project is no longer maintained. The fleet `--manager` option has been deprecated in `scmi`. + If your docker host has systemd, fleetd (and optionally etcd) installed then `scmi` provides a method to schedule the container to run on the cluster. This provides some additional features for managing a group of instances on a [fleet](https://github.com/coreos/fleet) cluster and has the option to use an etcd backed service registry. To use the fleet method of installation use the `-m` or `--manager` option of `scmi` and to include the optional etcd register companion unit use the `--register` option. ##### SCMI Image Information @@ -436,8 +438,11 @@ To set the timezone for the UK and account for British Summer Time you would use Using `PHP_OPTIONS_SESSION_SAVE_HANDLER` and `PHP_OPTIONS_SESSION_SAVE_PATH` together it's possible to configure PHP to use an alternative `session.save_handler` and `session.save_path`. For example if you have a Memcached server running on the host `memcached-server` on the default port `11211` the following configuration will allow session data to be stored in Memcached, allowing session data to be shared between multiple PHP containers. +Using `PHP_OPTIONS_SESSION_NAME` a session name can be defined - otherwise the default name "PHPSESSID" is used. + ``` ... + --env "PHP_OPTIONS_SESSION_NAME=app-session" \ --env "PHP_OPTIONS_SESSION_SAVE_HANDLER=memcached" \ --env "PHP_OPTIONS_SESSION_SAVE_PATH=memcached-server:11211" \ ... diff --git a/default.mk b/default.mk index 173389d..bd3d03e 100644 --- a/default.mk +++ b/default.mk @@ -26,6 +26,7 @@ define DOCKER_CONTAINER_PARAMETERS --env "APACHE_SSL_PROTOCOL=$(APACHE_SSL_PROTOCOL)" \ --env "APACHE_SYSTEM_USER=$(APACHE_SYSTEM_USER)" \ --env "PHP_OPTIONS_DATE_TIMEZONE=$(PHP_OPTIONS_DATE_TIMEZONE)" \ +--env "PHP_OPTIONS_SESSION_NAME=$(PHP_OPTIONS_SESSION_NAME)" \ --env "PHP_OPTIONS_SESSION_SAVE_HANDLER=$(PHP_OPTIONS_SESSION_SAVE_HANDLER)" \ --env "PHP_OPTIONS_SESSION_SAVE_PATH=$(PHP_OPTIONS_SESSION_SAVE_PATH)" endef diff --git a/environment.mk b/environment.mk index a6e46e7..d08246f 100644 --- a/environment.mk +++ b/environment.mk @@ -72,5 +72,6 @@ APACHE_SSL_CIPHER_SUITE ?= ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY APACHE_SSL_PROTOCOL ?= All -SSLv2 -SSLv3 APACHE_SYSTEM_USER ?= app PHP_OPTIONS_DATE_TIMEZONE ?= UTC +PHP_OPTIONS_SESSION_NAME ?= PHPSESSID PHP_OPTIONS_SESSION_SAVE_HANDLER ?= files PHP_OPTIONS_SESSION_SAVE_PATH ?= /var/lib/php/session diff --git a/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service b/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service index 965a8b5..4138df8 100644 --- a/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service +++ b/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service @@ -79,6 +79,7 @@ Environment="APACHE_SSL_CIPHER_SUITE=ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHA Environment="APACHE_SSL_PROTOCOL=All -SSLv2 -SSLv3" Environment="APACHE_SYSTEM_USER=app" Environment="PHP_OPTIONS_DATE_TIMEZONE=UTC" +Environment="PHP_OPTIONS_SESSION_NAME=PHPSESSID" Environment="PHP_OPTIONS_SESSION_SAVE_HANDLER=files" Environment="PHP_OPTIONS_SESSION_SAVE_PATH=/var/lib/php/session" @@ -133,6 +134,7 @@ ExecStart=/bin/bash -c \ --env \"APACHE_SSL_PROTOCOL=${APACHE_SSL_PROTOCOL}\" \ --env \"APACHE_SYSTEM_USER=${APACHE_SYSTEM_USER}\" \ --env \"PHP_OPTIONS_DATE_TIMEZONE=${PHP_OPTIONS_DATE_TIMEZONE}\" \ + --env \"PHP_OPTIONS_SESSION_NAME=${PHP_OPTIONS_SESSION_NAME}\" \ --env \"PHP_OPTIONS_SESSION_SAVE_HANDLER=${PHP_OPTIONS_SESSION_SAVE_HANDLER}\" \ --env \"PHP_OPTIONS_SESSION_SAVE_PATH=${PHP_OPTIONS_SESSION_SAVE_PATH}\" \ $(if [[ ${DOCKER_PORT_MAP_TCP_80} != NULL ]]; then \ diff --git a/src/opt/scmi/environment.sh b/src/opt/scmi/environment.sh index cf6fb66..15ce13c 100644 --- a/src/opt/scmi/environment.sh +++ b/src/opt/scmi/environment.sh @@ -76,5 +76,6 @@ APACHE_SSL_CIPHER_SUITE="${APACHE_SSL_CIPHER_SUITE:-"ECDHE-ECDSA-CHACHA20-POLY13 APACHE_SSL_PROTOCOL="${APACHE_SSL_PROTOCOL:-All -SSLv2 -SSLv3}" APACHE_SYSTEM_USER="${APACHE_SYSTEM_USER:-app}" PHP_OPTIONS_DATE_TIMEZONE="${PHP_OPTIONS_DATE_TIMEZONE:-UTC}" +PHP_OPTIONS_SESSION_NAME="${PHP_OPTIONS_SESSION_NAME:-PHPSESSID}" PHP_OPTIONS_SESSION_SAVE_HANDLER="${PHP_OPTIONS_SESSION_SAVE_HANDLER:-files}" PHP_OPTIONS_SESSION_SAVE_PATH="${PHP_OPTIONS_SESSION_SAVE_PATH:-/var/lib/php/session}" diff --git a/test/shpec/operation_shpec.sh b/test/shpec/operation_shpec.sh index 50869df..f9637d9 100644 --- a/test/shpec/operation_shpec.sh +++ b/test/shpec/operation_shpec.sh @@ -89,7 +89,7 @@ function __setup () local -r session_store_alias="memcached_1" local -r session_store_name="memcached.pool-1.1.1" local -r session_store_network="bridge_internal_1" - local -r session_store_release="1.1.1" + local -r session_store_release="1.1.2" if [[ -z $(docker network ls -q -f name="${session_store_network}") ]]; then docker network create \ @@ -222,6 +222,7 @@ ${other_required_apache_modules} local container_hostname="" local container_port_80="" local curl_get_request="" + local curl_session_name="" local header_server="" local header_x_service_uid="" local status=0 @@ -631,6 +632,25 @@ ${other_required_apache_modules} end end + describe "PHP options" + it "Has default session.name." + curl_session_name="$( + curl -s \ + --header 'Host: localhost.localdomain' \ + http://127.0.0.1:${container_port_80}/_phpinfo.php \ + | grep 'session.name' \ + | sed -E \ + -e 's~^.*(session.name)~\1~' \ + -e 's~~~g' \ + -e 's~]*>~ ~g' + )" + + assert equal \ + "${curl_session_name}" \ + "session.name PHPSESSID PHPSESSID" + end + end + __terminate_container \ apache-php.pool-1.1.1 \ &> /dev/null @@ -663,6 +683,7 @@ function test_custom_configuration () local curl_response_code_server_alias="" local curl_session_data_write="" local curl_session_data_read="" + local curl_session_name="" local header_x_service_operating_mode="" local header_x_service_uid="" local php_date_timezone="" @@ -2010,43 +2031,6 @@ function test_custom_configuration () end end - describe "PHP date.timezone" - it "Sets to 'Europe/London'." - __terminate_container \ - apache-php.pool-1.1.1 \ - &> /dev/null - - docker run \ - --detach \ - --name apache-php.pool-1.1.1 \ - --publish ${DOCKER_PORT_MAP_TCP_80}:80 \ - --env PHP_OPTIONS_DATE_TIMEZONE="Europe/London" \ - jdeathe/centos-ssh-apache-php-fcgi:latest \ - &> /dev/null - - if ! __is_container_ready \ - apache-php.pool-1.1.1 \ - ${STARTUP_TIME} \ - "/usr/sbin/httpd(\.worker|\.event)? " \ - "[[ 000 != \$(curl -sI -o /dev/null -w %{http_code} localhost/) ]]" - then - exit 1 - fi - - php_date_timezone="$( - docker exec \ - apache-php.pool-1.1.1 \ - php \ - -r \ - "printf('%s', ini_get('date.timezone'));" - )" - - assert equal \ - "${php_date_timezone}" \ - "Europe/London" - end - end - describe "Configure autostart" __terminate_container \ apache-php.pool-1.1.1 \ @@ -2107,6 +2091,93 @@ function test_custom_configuration () &> /dev/null end + describe "PHP date.timezone" + it "Sets to 'Europe/London'." + __terminate_container \ + apache-php.pool-1.1.1 \ + &> /dev/null + + docker run \ + --detach \ + --name apache-php.pool-1.1.1 \ + --publish ${DOCKER_PORT_MAP_TCP_80}:80 \ + --env PHP_OPTIONS_DATE_TIMEZONE="Europe/London" \ + jdeathe/centos-ssh-apache-php-fcgi:latest \ + &> /dev/null + + if ! __is_container_ready \ + apache-php.pool-1.1.1 \ + ${STARTUP_TIME} \ + "/usr/sbin/httpd(\.worker|\.event)? " \ + "[[ 000 != \$(curl -sI -o /dev/null -w %{http_code} localhost/) ]]" + then + exit 1 + fi + + php_date_timezone="$( + docker exec \ + apache-php.pool-1.1.1 \ + php \ + -r \ + "printf('%s', ini_get('date.timezone'));" + )" + + assert equal \ + "${php_date_timezone}" \ + "Europe/London" + end + end + + describe "PHP session.name" + __terminate_container \ + apache-php.pool-1.1.1 \ + &> /dev/null + + docker run \ + --detach \ + --name apache-php.pool-1.1.1 \ + --publish ${DOCKER_PORT_MAP_TCP_80}:80 \ + --env PHP_OPTIONS_SESSION_NAME="app-session" \ + jdeathe/centos-ssh-apache-php:latest \ + &> /dev/null + + if ! __is_container_ready \ + apache-php.pool-1.1.1 \ + ${STARTUP_TIME} \ + "/usr/sbin/httpd(\.worker|\.event)? " \ + "[[ 000 != \$(curl -sI -o /dev/null -w %{http_code} localhost/) ]]" + then + exit 1 + fi + + container_port_80="$( + __get_container_port \ + apache-php.pool-1.1.1 \ + 80/tcp + )" + + it "Sets to app-session." + curl_session_name="$( + curl -s \ + --header 'Host: localhost.localdomain' \ + http://127.0.0.1:${container_port_80}/_phpinfo.php \ + | grep 'session.name' \ + | sed -E \ + -e 's~^.*(session.name)~\1~' \ + -e 's~~~g' \ + -e 's~]*>~ ~g' + )" + + assert equal \ + "${curl_session_name}" \ + "session.name app-session app-session" + end + + __terminate_container \ + apache-php.pool-1.1.1 \ + &> /dev/null + end + describe "PHP memcached session store" __terminate_container \ apache-php.pool-1.1.1 \ From 28b4c51ff50156f257164171993b6518fe280d08 Mon Sep 17 00:00:00 2001 From: James Deathe Date: Tue, 16 Jan 2018 11:24:51 +0000 Subject: [PATCH 2/2] Release changes for 1.10.3. --- CHANGELOG.md | 2 +- Dockerfile | 2 +- README.md | 32 +++++++++---------- .../centos-ssh-apache-php-fcgi@.service | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78501b8..858ae17 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-CGI 5.3 (FastCGI), PHP memcached 1.0, PHP APC 3.1. -### 1.10.3 - Unreleased +### 1.10.3 - 2018-01-16 - Updates image source to [release 1.10.3](https://github.com/jdeathe/centos-ssh-apache-php/releases/tag/1.10.3). diff --git a/Dockerfile b/Dockerfile index ac5b994..95f49cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ ENV APACHE_MPM="worker" # ----------------------------------------------------------------------------- # Set image metadata # ----------------------------------------------------------------------------- -ARG RELEASE_VERSION="1.10.2" +ARG RELEASE_VERSION="1.10.3" LABEL \ maintainer="James Deathe " \ install="docker run \ diff --git a/README.md b/README.md index a86dec9..b158be5 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ Apache PHP web server, loading only a minimal set of Apache modules by default. ## Overview & links -The latest CentOS-6 based release can be pulled from the centos-6 Docker tag. For a specific release tag the convention is `centos-6-1.10.2` or `1.10.2` for the [1.10.2](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/tree/1.7.0) release tag. +The latest CentOS-6 based release can be pulled from the centos-6 Docker tag. For 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-fcgi/tree/1.7.0) release tag. -- `centos-6`, `centos-6-1.10.2`, `1.10.2` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/Dockerfile) +- `centos-6`, `centos-6-1.10.3`, `1.10.3` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-apache-php-fcgi/blob/centos-6/Dockerfile) This build of [Apache](https://httpd.apache.org/), (httpd CentOS package), uses the [mod_fcgid](https://httpd.apache.org/mod_fcgid/) module to run [PHP](http://php.net/) as a [FastCGI](http://www.fastcgi.com/) process. @@ -87,10 +87,10 @@ $ docker run \ --volume /:/media/root \ --env BASH_ENV="" \ --env ENV="" \ - jdeathe/centos-ssh-apache-php-fcgi:1.10.2 \ + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 \ /usr/sbin/scmi install \ --chroot=/media/root \ - --tag=1.10.2 \ + --tag=1.10.3 \ --name=apache-php.pool-1.1.1 ``` @@ -105,10 +105,10 @@ $ docker run \ --volume /:/media/root \ --env BASH_ENV="" \ --env ENV="" \ - jdeathe/centos-ssh-apache-php-fcgi:1.10.2 \ + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 \ /usr/sbin/scmi uninstall \ --chroot=/media/root \ - --tag=1.10.2 \ + --tag=1.10.3 \ --name=apache-php.pool-1.1.1 ``` @@ -123,10 +123,10 @@ $ docker run \ --volume /:/media/root \ --env BASH_ENV="" \ --env ENV="" \ - jdeathe/centos-ssh-apache-php-fcgi:1.10.2 \ + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 \ /usr/sbin/scmi install \ --chroot=/media/root \ - --tag=1.10.2 \ + --tag=1.10.3 \ --name=apache-php.pool-1.1.1 \ --manager=systemd \ --register \ @@ -150,7 +150,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-fcgi:1.10.2 + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 ) --info" ``` @@ -160,7 +160,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-fcgi:1.10.2 + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 ) --name=apache-php.pool-1.2.1" ``` @@ -170,7 +170,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-fcgi:1.10.2 + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 ) --name=apache-php.pool-1.2.1" ``` @@ -181,7 +181,7 @@ With the addition of install/uninstall image labels it is possible to use [Proje _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-fcgi:1.10.2 +$ docker pull jdeathe/centos-ssh-apache-php-fcgi:1.10.3 ``` To see detailed information about the image run `scmi` with the `--info` option. To see all available `scmi` options run with the `--help` option. @@ -189,7 +189,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-fcgi:1.10.2 \ + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 \ --info ``` @@ -198,14 +198,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-fcgi:1.10.2 + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 ``` Alternatively, you could use the `scmi` options `--name` or `-n` for naming the container. ``` $ sudo -E atomic install \ - jdeathe/centos-ssh-apache-php-fcgi:1.10.2 \ + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 \ --name apache-php.pool-1.3.1 ``` @@ -214,7 +214,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-fcgi:1.10.2 + jdeathe/centos-ssh-apache-php-fcgi:1.10.3 ``` #### Environment Variables diff --git a/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service b/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service index 4138df8..34f210b 100644 --- a/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.service +++ b/src/etc/systemd/system/centos-ssh-apache-php-fcgi@.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-fcgi" -Environment="DOCKER_IMAGE_TAG=1.10.2" +Environment="DOCKER_IMAGE_TAG=1.10.3" Environment="DOCKER_PORT_MAP_TCP_80=8080" Environment="DOCKER_PORT_MAP_TCP_443=9443" Environment="DOCKER_PORT_MAP_TCP_8443=NULL"