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

Commit 3010ce2

Browse files
committed
Merge pull request #25 from jdeathe/master
Release changes ready for centos-6-1.3.0
2 parents 5293183 + abec596 commit 3010ce2

File tree

15 files changed

+2676
-81
lines changed

15 files changed

+2676
-81
lines changed

Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
# CentOS-6, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1, Composer
55
#
66
# =============================================================================
7-
FROM jdeathe/centos-ssh-apache-php:centos-6
7+
FROM jdeathe/centos-ssh-apache-php:centos-6-1.3.0
88

99
MAINTAINER James Deathe <james.deathe@gmail.com>
1010

1111
# -----------------------------------------------------------------------------
1212
# FastCGI support
1313
# -----------------------------------------------------------------------------
1414
RUN yum --setopt=tsflags=nodocs -y install \
15+
fcgi-2.4.0-12.el6 \
16+
mod_fcgid-2.3.9-1.el6 \
17+
&& yum versionlock add \
1518
fcgi \
1619
mod_fcgid \
1720
&& rm -rf /var/cache/yum/* \
@@ -48,14 +51,8 @@ RUN mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.off \
4851
# -----------------------------------------------------------------------------
4952
# Add the PHP Wrapper script
5053
# -----------------------------------------------------------------------------
51-
RUN mkdir -p /var/www/app/bin
52-
ADD var/www/app/bin/php-wrapper /var/www/app/bin/
53-
54-
# -----------------------------------------------------------------------------
55-
# Set permissions & add to the template directory
56-
# -----------------------------------------------------------------------------
57-
RUN chmod -R 750 /var/www/app/bin \
58-
&& cp -rpf /var/www/app/bin /var/www/.app-skel/bin
54+
ADD var/www/app-bin/php-wrapper /var/www/app-bin/
55+
RUN chmod -R 750 /var/www/app-bin
5956

6057
# -----------------------------------------------------------------------------
6158
# Copy files into place

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
centos-ssh-apache-php-fcgi
22
==========================
33

4-
Docker Image including CentOS-6, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1, Composer.
4+
Docker Image including CentOS-6 6.6 x86_64, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1, Composer.
55

66
Apache (mod_fcgid) loads only a minimal set of modules by default. Supports custom configuration via a configuration data volume.
77

@@ -56,7 +56,7 @@ Create the data volume, mounting our docker host's configuration directory to */
5656
```
5757
$ docker run \
5858
--name volume-config.apache-php.app-1.1.1 \
59-
-v /etc/services-config/ssh.pool-1:/etc/services-config/ssh \
59+
-v /etc/services-config/ssh.pool-1/ssh:/etc/services-config/ssh \
6060
-v /etc/services-config/apache-php.app-1.1.1/supervisor:/etc/services-config/supervisor \
6161
-v /etc/services-config/apache-php.app-1.1.1/httpd:/etc/services-config/httpd \
6262
-v /etc/services-config/apache-php.app-1.1.1/ssl/certs:/etc/services-config/ssl/certs \

apache-php.app-1.1.1@8080.service

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ExecStartPre=/bin/sudo /bin/bash -c \
3535
if [ ! \"volume-config.%p\" == \"$(/usr/bin/docker ps -a | /bin/grep -v -e \\\"volume-config.%p/.*,.*\\\" | /bin/grep -e '[ ]\{1,\}'volume-config.%p | /bin/grep -o volume-config.%p)\" ]; then \
3636
/usr/bin/docker run \
3737
--name volume-config.%p \
38-
-v /etc/services-config/ssh.pool-1:/etc/services-config/ssh \
38+
-v /etc/services-config/ssh.pool-1/ssh:/etc/services-config/ssh \
3939
-v /etc/services-config/%p/supervisor:/etc/services-config/supervisor \
4040
-v /etc/services-config/%p/httpd:/etc/services-config/httpd \
4141
-v /etc/services-config/%p/ssl/certs:/etc/services-config/ssl/certs \
@@ -47,10 +47,10 @@ ExecStartPre=/bin/sudo /bin/bash -c \
4747
# Initialisation: Pull or build image if required
4848
ExecStartPre=/bin/sudo /bin/bash -c \
4949
"if [ ! \"jdeathe/centos-ssh-apache-php-fcgi\" == \"$(/usr/bin/docker images | /bin/grep -e '^jdeathe/centos-ssh-apache-php-fcgi[ ]\{1,\}' | /bin/grep -o 'jdeathe/centos-ssh-apache-php-fcgi')\" ]; then \
50-
if [ -f /var/services-packages/jdeathe/centos-ssh-apache-php-fcgi.centos-6-1.2.1.tar.xz ]; then \
51-
/usr/bin/xz -dc /var/services-packages/jdeathe/centos-ssh-apache-php-fcgi.centos-6-1.2.1.tar.xz | /usr/bin/docker load; \
50+
if [ -f /var/services-packages/jdeathe/centos-ssh-apache-php-fcgi.centos-6-1.3.0.tar.xz ]; then \
51+
/usr/bin/xz -dc /var/services-packages/jdeathe/centos-ssh-apache-php-fcgi.centos-6-1.3.0.tar.xz | /usr/bin/docker load; \
5252
else \
53-
/usr/bin/docker pull jdeathe/centos-ssh-apache-php-fcgi:centos-6-1.2.1; \
53+
/usr/bin/docker pull jdeathe/centos-ssh-apache-php-fcgi:centos-6-1.3.0; \
5454
fi; \
5555
fi"
5656

@@ -75,7 +75,7 @@ ExecStart=/bin/sudo /bin/bash -c \
7575
--env DATE_TIMEZONE=UTC \
7676
--volumes-from volume-config.%p \
7777
-v /var/services-data/apache-php/app-1:/var/www/app \
78-
jdeathe/centos-ssh-apache-php-fcgi:centos-6-1.2.1"
78+
jdeathe/centos-ssh-apache-php-fcgi:centos-6-1.3.0"
7979

8080
ExecStartPost=/usr/bin/etcdctl set /services/apache-php/app-1/1.1 %H:%i
8181

build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
# Change working directory
4-
DIR_PATH="$( cd "$( echo "${0%/*}" )"; pwd )"
5-
if [[ $DIR_PATH == */* ]]; then
4+
DIR_PATH="$( if [ "$( echo "${0%/*}" )" != "$( echo "${0}" )" ] ; then cd "$( echo "${0%/*}" )"; fi; pwd )"
5+
if [[ $DIR_PATH == */* ]] && [[ $DIR_PATH != "$( pwd )" ]] ; then
66
cd $DIR_PATH
77
fi
88

@@ -12,11 +12,11 @@ source build.conf
1212

1313
show_docker_image ()
1414
{
15-
NAME=$1
16-
NAME_PARTS=(${NAME//:/ })
15+
local NAME=$1
16+
local NAME_PARTS=(${NAME//:/ })
1717

1818
# Set 'latest' tag if no tag requested
19-
if [ ${#NAME_PART[@]} == 1 ]; then
19+
if [ ${#NAME_PARTS[@]} == 1 ]; then
2020
NAME_PARTS[1]='latest'
2121
fi
2222

etc/apache-bootstrap

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,12 @@ fi
2424
if [[ ! -n $(find ${APP_HOME_DIR} -maxdepth 1 -type f) ]] && [[ -d ${APP_HOME_DIR_TEMPLATE} ]]; then
2525
echo Home directory ${APP_HOME_DIR} exists but is empty - populate it using ${APP_HOME_DIR_TEMPLATE}...
2626
cp -rf ${APP_HOME_DIR_TEMPLATE}/. ${APP_HOME_DIR}/
27-
elif [[ ! -d ${APP_HOME_DIR}/bin || ! -n $(find ${APP_HOME_DIR}/bin -maxdepth 1 -type f) ]] && [[ -d ${APP_HOME_DIR_TEMPLATE}/bin ]]; then
28-
echo Home directory ${APP_HOME_DIR}/bin is missing or empty empty - populate it using ${APP_HOME_DIR_TEMPLATE}/bin...
29-
cp -rf ${APP_HOME_DIR_TEMPLATE}/bin ${APP_HOME_DIR}/
30-
elif [[ ! -d ${APP_HOME_DIR}/public_html ]]; then
31-
echo ERROR: ${APP_HOME_DIR}/public_html not found.
32-
exit 1
3327
fi
3428

35-
# Correct permissions (750) must be set on the bin directory and the php-wrapper
36-
if [[ ! "$(stat -c %a ${APP_HOME_DIR}/bin)" == "750" ]]; then
37-
echo ERROR: Permissions on ${APP_HOME_DIR}/bin must be 750...
38-
# exit 1
39-
elif [[ ! "$(stat -c %a ${APP_HOME_DIR}/bin/php-wrapper)" == "750" ]]; then
40-
echo ERROR: Permissions on ${APP_HOME_DIR}/bin/php-wrapper must be 750...
41-
# exit 1
29+
# Document root directory is required
30+
if [[ ! -d ${APP_HOME_DIR}/public_html ]]; then
31+
echo ERROR: ${APP_HOME_DIR}/public_html not found.
32+
exit 1
4233
fi
4334

4435
# If users need to change the vhost.conf the SSL version can be rebuilt if it is deleted
@@ -56,7 +47,7 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]] && [[ ! -f ${APP_HOME_DIR}/vho
5647
-e 's~#SSLCipherSuite \(.*\)$~SSLCipherSuite \1~g' \
5748
-e 's~#SSLCertificateFile \(.*\)$~SSLCertificateFile \1~g' \
5849
-e 's~#SSLCertificateKeyFile \(.*\)$~SSLCertificateKeyFile \1~g' \
59-
/var/www/app/vhost-ssl.conf
50+
${APP_HOME_DIR}/vhost-ssl.conf
6051
fi
6152

6253
# Enable/Disable SSL support
@@ -66,7 +57,7 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]]; then
6657

6758
sed -i \
6859
-e 's~^#NameVirtualHost \*:443$~NameVirtualHost \*:443~g' \
69-
-e 's~^#Include /var/www/app/vhost-ssl.conf$~Include /var/www/app/vhost-ssl.conf~g' \
60+
-e 's~^#Include ${APP_HOME_DIR}/vhost-ssl.conf$~Include ${APP_HOME_DIR}/vhost-ssl.conf~g' \
7061
/etc/httpd/conf/httpd.conf
7162

7263
if [[ ! -f /etc/services-config/ssl/private/localhost.key ]] || [[ ! -f /etc/services-config/ssl/certs/localhost.crt ]]; then
@@ -85,7 +76,7 @@ else
8576

8677
sed -i \
8778
-e 's~^NameVirtualHost \*:443$~#NameVirtualHost \*:443~g' \
88-
-e 's~^Include /var/www/app/vhost-ssl.conf$~#Include /var/www/app/vhost-ssl.conf~g' \
79+
-e 's~^Include ${APP_HOME_DIR}/vhost-ssl.conf$~#Include ${APP_HOME_DIR}/vhost-ssl.conf~g' \
8980
/etc/httpd/conf/httpd.conf
9081
fi
9182

@@ -100,17 +91,23 @@ fi
10091

10192
# Set the Apache (run) service user/group
10293
if [[ ${OPTS_SUEXECUSERGROUP} == "true" ]]; then
103-
sed -i -e "s~^User .*$~User ${OPTS_SERVICE_USER_GROUP}~g" -e "s~^Group .*$~Group ${OPTS_SERVICE_USER_GROUP}~g" -e "s~^LogLevel warn$~LogLevel debug~g" /etc/httpd/conf/httpd.conf
104-
sed -i -e 's~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' /var/www/app/vhost.conf
105-
sed -i -e 's~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' /var/www/app/vhost-ssl.conf
106-
chown -R 502:502 /var/{www/app/bin,www/.app-skel/bin,run/mod_fcgid}
94+
sed -i -e "s~^User .*$~User ${OPTS_SERVICE_USER_GROUP}~g" \
95+
-e "s~^Group .*$~Group ${OPTS_SERVICE_USER_GROUP}~g" /etc/httpd/conf/httpd.conf
96+
sed -i -e 's~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' ${APP_HOME_DIR}/vhost.conf
97+
sed -i -e 's~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' ${APP_HOME_DIR}/vhost-ssl.conf
98+
chown -R 502:502 /var/{www/app-bin,run/mod_fcgid}
10799
else
108-
sed -i -e "s~^User .*$~User apache~g" -e "s~^Group .*$~Group apache~g" /etc/httpd/conf/httpd.conf
109-
sed -i -e 's~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' /var/www/app/vhost.conf
110-
sed -i -e 's~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' /var/www/app/vhost-ssl.conf
111-
chown -R apache:apache /var/{www/app/bin,www/.app-skel/bin,run/mod_fcgid}
100+
sed -i -e "s~^User .*$~User apache~g" \
101+
-e "s~^Group .*$~Group apache~g" /etc/httpd/conf/httpd.conf
102+
sed -i -e 's~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' ${APP_HOME_DIR}/vhost.conf
103+
sed -i -e 's~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' ${APP_HOME_DIR}/vhost-ssl.conf
104+
chown -R apache:apache /var/{www/app-bin,run/mod_fcgid}
112105
fi
113106

107+
# Update any existing instances of php-wrapper path in the Virtual Host
108+
sed -i -e 's~app/bin/php-wrapper~app-bin/php-wrapper~g' ${APP_HOME_DIR}/vhost.conf
109+
sed -i -e 's~app/bin/php-wrapper~app-bin/php-wrapper~g' ${APP_HOME_DIR}/vhost-ssl.conf
110+
114111
echo Loading Apache modules...
115112
for MODULE in ${APACHE_LOAD_MODULES}
116113
do
@@ -124,16 +121,15 @@ done
124121
echo "${OPTS_SERVICE_USER}:${OPTS_SERVICE_USER_PASSWORD}" | chpasswd
125122
echo "${OPTS_SERVICE_USER_GROUP}:${OPTS_SERVICE_USER_GROUP_PASSWORD}" | chpasswd
126123

127-
echo
128-
echo "================================================================================"
129-
echo "Apache Credentials"
130-
echo "--------------------------------------------------------------------------------"
131-
echo "${OPTS_SERVICE_USER} : ${OPTS_SERVICE_USER_PASSWORD}"
132-
echo "${OPTS_SERVICE_USER_GROUP} : ${OPTS_SERVICE_USER_GROUP_PASSWORD}"
133-
echo "--------------------------------------------------------------------------------"
134-
echo
135-
136-
# Allow some time for supervisor_stdout to start
137-
sleep 2
124+
cat <<-EOT
125+
126+
================================================================================
127+
Apache Credentials
128+
--------------------------------------------------------------------------------
129+
${OPTS_SERVICE_USER} : ${OPTS_SERVICE_USER_PASSWORD}
130+
${OPTS_SERVICE_USER_GROUP} : ${OPTS_SERVICE_USER_GROUP_PASSWORD}
131+
--------------------------------------------------------------------------------
132+
133+
EOT
138134

139135
exit 0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# PHP is an HTML-embedded scripting language which attempts to make it
3+
# easy for developers to write dynamically generated webpages.
4+
#
5+
<IfModule prefork.c>
6+
LoadModule php5_module modules/libphp5.so
7+
</IfModule>
8+
<IfModule worker.c>
9+
LoadModule php5_module modules/libphp5-zts.so
10+
</IfModule>
11+
12+
#
13+
# Cause the PHP interpreter to handle files with a .php extension.
14+
#
15+
AddHandler php5-script .php
16+
AddType text/html .php
17+
18+
#
19+
# Add index.php to the list of files that will be served as directory
20+
# indexes.
21+
#
22+
DirectoryIndex index.php
23+
24+
#
25+
# Uncomment the following line to allow PHP to pretty-print .phps
26+
# files as PHP source code:
27+
#
28+
#AddType application/x-httpd-php-source .phps
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# PHP is an HTML-embedded scripting language which attempts to make it
3+
# easy for developers to write dynamically generated webpages.
4+
#
5+
<IfModule prefork.c>
6+
LoadModule php5_module modules/libphp5.so
7+
</IfModule>
8+
<IfModule worker.c>
9+
LoadModule php5_module modules/libphp5-zts.so
10+
</IfModule>
11+
12+
#
13+
# Cause the PHP interpreter to handle files with a .php extension.
14+
#
15+
AddHandler php5-script .php
16+
AddType text/html .php
17+
18+
#
19+
# Add index.php to the list of files that will be served as directory
20+
# indexes.
21+
#
22+
DirectoryIndex index.php
23+
24+
#
25+
# Uncomment the following line to allow PHP to pretty-print .phps
26+
# files as PHP source code:
27+
#
28+
#AddType application/x-httpd-php-source .phps

0 commit comments

Comments
 (0)