diff options
author | startxfr <clarue@startx.fr> | 2015-11-28 15:15:52 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2015-11-28 15:15:52 +0100 |
commit | 4bb17b8c05c6e430293217797eef694671ec1e1b (patch) | |
tree | 2aec4634843d5ed54a8e71049e4e564f8d33973d /Services/php | |
parent | 151b31b6f47fb3d96afdd66138ff40d92cac6202 (diff) | |
download | phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.tar.gz phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.tar.bz2 phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.tar.xz phpmyadmin-4bb17b8c05c6e430293217797eef694671ec1e1b.zip |
final change in script lib for OS. Change in apache and php services
Diffstat (limited to 'Services/php')
-rw-r--r-- | Services/php/Dockerfile | 17 | ||||
-rw-r--r-- | Services/php/docker-compose.yml | 15 | ||||
-rw-r--r-- | Services/php/httpd.conf | 15 | ||||
-rw-r--r-- | Services/php/index.php (renamed from Services/php/app/index.php) | 0 | ||||
-rw-r--r-- | Services/php/run.sh | 58 |
5 files changed, 96 insertions, 9 deletions
diff --git a/Services/php/Dockerfile b/Services/php/Dockerfile index 60985df..b46f098 100644 --- a/Services/php/Dockerfile +++ b/Services/php/Dockerfile @@ -8,14 +8,17 @@ 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 application content -COPY app/* /var/www/html/ -COPY httpd.conf /etc/httpd/conf.d/sx.conf +COPY httpd.conf /etc/httpd/conf.d/app.conf COPY php.ini /etc/php.d/sx.ini -RUN chmod ug+r /var/www/html/* \ - && chown -R apache:apache /var/www/html /var/log/httpd +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 EXPOSE 80 EXPOSE 443 -VOLUME ["/var/www/html", "/var/log/httpd"] -CMD ["/sx/httpd_run.sh"]
\ No newline at end of file +VOLUME ["/data/www","/data/logs"] +CMD ["/bin/run.sh"]
\ No newline at end of file diff --git a/Services/php/docker-compose.yml b/Services/php/docker-compose.yml new file mode 100644 index 0000000..b8130ef --- /dev/null +++ b/Services/php/docker-compose.yml @@ -0,0 +1,15 @@ +apache: + build: ./ +# image: sx-apache + container_name: "sx-apache" + mem_limit: 1g + memswap_limit: 2g + cpu_shares: 2 + restart: "on-failure:2" + environment: + CONTAINER_TYPE: "service" + CONTAINER_SERVICE: "apache" + CONTAINER_INSTANCE: "sx-apache" + volumes: + - "/tmp/container/logs:/data/logs" + - "/tmp/container/www:/data/www"
\ No newline at end of file diff --git a/Services/php/httpd.conf b/Services/php/httpd.conf index 2cb8301..3a51a63 100644 --- a/Services/php/httpd.conf +++ b/Services/php/httpd.conf @@ -1,8 +1,19 @@ # -# This file will be copied into /etc/httpd/conf.d/sx.conf and loaded when httpd start +# This file will be copied into /etc/httpd/conf.d/app.conf and loaded when httpd start # ServerAdmin cl@startx.fr -<Directory "/var/www/html"> +ErrorLog "/data/logs/httpd_error.log" + +<IfModule log_config_module> + CustomLog "/data/logs/httpd_access.log" combined +</IfModule> + +Alias / /data/www +<Directory "/data/www"> + AddDefaultCharset UTF-8 AllowOverride All + Order Allow,Deny + Allow from All + Require all granted DirectoryIndex index.php index.html </Directory> diff --git a/Services/php/app/index.php b/Services/php/index.php index 411b39b..411b39b 100644 --- a/Services/php/app/index.php +++ b/Services/php/index.php diff --git a/Services/php/run.sh b/Services/php/run.sh new file mode 100644 index 0000000..bcddd35 --- /dev/null +++ b/Services/php/run.sh @@ -0,0 +1,58 @@ +#!/bin/bash +source /bin/sx-lib.sh +export HTTPDCONF=/etc/httpd/conf.d/app.conf + +# Begin configuration before starting daemonized process +# and start generating host keys +function begin_config { + echo "=> BEGIN APACHE-PHP CONFIGURATION" + mkdir -p /var/run/httpd + if [ -v DOCROOT ]; then + echo "=> Changing document root to $DOCROOT" + ${DOCROOT=/data/www} + echo "DocumentRoot \"$DOCROOT\"" >> $HTTPDCONF + fi +} + +# End configuration process just before starting daemon +function end_config { + stop_server + echo "=> END APACHE-PHP CONFIGURATION" +} + +# Start the httpd server in background. Used to perform config +# against the database structure such as user creation +function start_server { + echo "=> Starting httpd + php server" + /usr/sbin/apachectl & + sleep 2 +} + +# Stop the httpd server running in background. +function stop_server { + echo "=> Stopping httpd + php server ..." + killall httpd + rm -rf /run/httpd/* + sleep 2 +} + +# Start the httpd server as a deamon and execute it inside +# the running shell +function start_daemon { + echo "=> Starting httpd + php daemon ..." + exec /usr/sbin/apachectl -D FOREGROUND +} + + + +if [[ "$0" == *"run.sh" && ! $1 = "" ]];then + eval "$@"; +fi + +check_environment +check_httpd_environment +display_container_header +begin_config +end_config +start_daemon +display_container_started |