summaryrefslogtreecommitdiffstats
path: root/Services/php
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2015-11-28 19:46:13 +0100
committerstartxfr <clarue@startx.fr>2015-11-28 19:46:13 +0100
commit348568c89ae1ad19270e930c02a1492bc43e99b1 (patch)
tree97514774d5c27789d9383f5085103eb9775b6a52 /Services/php
parent05c9aa4a4d3572168878bf0e81eeac724a95454d (diff)
downloadphpmyadmin-348568c89ae1ad19270e930c02a1492bc43e99b1.tar.gz
phpmyadmin-348568c89ae1ad19270e930c02a1492bc43e99b1.tar.bz2
phpmyadmin-348568c89ae1ad19270e930c02a1492bc43e99b1.tar.xz
phpmyadmin-348568c89ae1ad19270e930c02a1492bc43e99b1.zip
Adding display of OS flavour at startup and improving flexibility of services with env param
Diffstat (limited to 'Services/php')
-rw-r--r--Services/php/Dockerfile16
-rw-r--r--Services/php/README.md2
-rw-r--r--Services/php/docker-compose.yml16
-rw-r--r--Services/php/httpd.conf10
-rw-r--r--Services/php/run.sh16
5 files changed, 32 insertions, 28 deletions
diff --git a/Services/php/Dockerfile b/Services/php/Dockerfile
index b46f098..8bb0304 100644
--- a/Services/php/Dockerfile
+++ b/Services/php/Dockerfile
@@ -8,17 +8,19 @@ RUN dnf -y install php php-pecl-mongo php-cli php-pear \
php-bcmath php-pecl-zip php-php-gettext php-tcpdf \
php-tcpdf-dejavu-sans-fonts php-tidy \
&& dnf clean all
-COPY httpd.conf /etc/httpd/conf.d/app.conf
+ENV LOG_PATH=/data/logs/httpd_php \
+ APP_PATH=/data/httpd_php
+COPY httpd.conf $HTTPDCONF
COPY php.ini /etc/php.d/sx.ini
COPY run.sh /bin/
RUN chmod 775 /bin/run.sh && \
- chmod ug+r /etc/httpd/conf.d/app.conf
-COPY ./ /data/www
-RUN rm -f /data/www/Dockerfile /data/www/httpd.conf /data/www/run.sh && \
- chown -R apache:apache /data/www /data/logs && \
- chmod ug+r -R /data/www
+ chmod ug+r $HTTPDCONF
+COPY ./ $APP_PATH
+RUN rm -f $APP_PATH/Dockerfile $APP_PATH/httpd.conf $APP_PATH/run.sh && \
+ chown -R apache:apache $APP_PATH $LOG_PATH && \
+ chmod ug+r -R $APP_PATH
EXPOSE 80
EXPOSE 443
-VOLUME ["/data/www","/data/logs"]
+VOLUME [$APP_PATH,$LOG_PATH]
CMD ["/bin/run.sh"] \ No newline at end of file
diff --git a/Services/php/README.md b/Services/php/README.md
index 2757a6a..370a3a8 100644
--- a/Services/php/README.md
+++ b/Services/php/README.md
@@ -6,7 +6,7 @@ Container running apache + php daemon under a fedora server
docker run -d -p 80:80 --name="php" startx/sv-php
# when used with a volume container (run data container, then run service)
- docker run -d -v /var/www/html -v /var/log/httpd --name php-data startx/sv-php echo "Data container for php webserver"
+ docker run -d -v /var/www/html -v /var/logs/httpd --name php-data startx/sv-php echo "Data container for php webserver"
docker run -d -p 80:80 --volumes-from php-data --name="php" startx/sv-php
when linked to another container
docker run -d --name="mongo" startx/sv-mongo
diff --git a/Services/php/docker-compose.yml b/Services/php/docker-compose.yml
index b8130ef..2f410ce 100644
--- a/Services/php/docker-compose.yml
+++ b/Services/php/docker-compose.yml
@@ -1,15 +1,17 @@
-apache:
+httpd_php:
build: ./
-# image: sx-apache
- container_name: "sx-apache"
+# image: sx-httpd_php
+ container_name: "sx-httpd_php"
mem_limit: 1g
memswap_limit: 2g
cpu_shares: 2
restart: "on-failure:2"
environment:
CONTAINER_TYPE: "service"
- CONTAINER_SERVICE: "apache"
- CONTAINER_INSTANCE: "sx-apache"
+ CONTAINER_SERVICE: "httpd_php"
+ CONTAINER_INSTANCE: "sx-httpd_php"
+ SERVER_NAME: "localhost"
+ DOC_ROOT: "/data/httpd_php"
volumes:
- - "/tmp/container/logs:/data/logs"
- - "/tmp/container/www:/data/www" \ No newline at end of file
+ - "/tmp/container/logs/httpd_php:/data/logs/httpd_php"
+ - "/tmp/container/httpd_php:/data/httpd_php" \ No newline at end of file
diff --git a/Services/php/httpd.conf b/Services/php/httpd.conf
index 3a51a63..1ce768f 100644
--- a/Services/php/httpd.conf
+++ b/Services/php/httpd.conf
@@ -1,15 +1,17 @@
#
# This file will be copied into /etc/httpd/conf.d/app.conf and loaded when httpd start
#
+DocumentRoot ${DOC_ROOT}
+ServerName ${SERVER_NAME}
ServerAdmin cl@startx.fr
-ErrorLog "/data/logs/httpd_error.log"
+ErrorLog ${LOG_PATH}/error.log
<IfModule log_config_module>
- CustomLog "/data/logs/httpd_access.log" combined
+ CustomLog ${LOG_PATH}/access.log combined
</IfModule>
-Alias / /data/www
-<Directory "/data/www">
+Alias / ${APP_PATH}
+<Directory ${APP_PATH}>
AddDefaultCharset UTF-8
AllowOverride All
Order Allow,Deny
diff --git a/Services/php/run.sh b/Services/php/run.sh
index a02537e..a59a9af 100644
--- a/Services/php/run.sh
+++ b/Services/php/run.sh
@@ -1,6 +1,4 @@
#!/bin/bash
-export HTTPDCONF=/etc/httpd/conf.d/app.conf
-
source /bin/sx-lib.sh
source /bin/sx-httpd.sh
@@ -8,10 +6,10 @@ if [[ "$0" == *"run.sh" && ! $1 = "" ]];then
eval "$@";
fi
-check_environment
-check_httpd_environment
-display_container_httpd_header
-begin_config
-end_config
-display_container_started
-start_daemon
+check_environment | tee -a $STARTUPLOG
+check_httpd_environment | tee -a $STARTUPLOG
+display_container_httpd_header | tee -a $STARTUPLOG
+begin_config | tee -a $STARTUPLOG
+end_config | tee -a $STARTUPLOG
+display_container_started | tee -a $STARTUPLOG
+start_daemon | tee -a $STARTUPLOG