From 18bd4b7e92f2a5a58050e5246f35beda9362edcc Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 14 Jun 2020 14:11:29 +0200 Subject: [PATCH] several fixes / additions for 20.1 container --- doc/docker/development/Dockerfile | 1 + doc/docker/docker-compose.yml | 20 ++++++++++++++++++-- doc/docker/fpm/Dockerfile | 24 ++++++++++++++++++------ doc/docker/fpm/entrypoint.sh | 13 ++++++++----- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/doc/docker/development/Dockerfile b/doc/docker/development/Dockerfile index eb78803744..babf3c7f75 100644 --- a/doc/docker/development/Dockerfile +++ b/doc/docker/development/Dockerfile @@ -80,6 +80,7 @@ RUN apt-get install -y php$PHP_VERSION-cli php-xdebug inetutils-ping iproute2 gi VOLUME /var/www VOLUME /var/lib/egroupware VOLUME /var/lib/php/sessions +VOLUME /var/lib/egroupware-push EXPOSE 9000 diff --git a/doc/docker/docker-compose.yml b/doc/docker/docker-compose.yml index 6ea4f9258f..dc54bb0387 100644 --- a/doc/docker/docker-compose.yml +++ b/doc/docker/docker-compose.yml @@ -28,6 +28,7 @@ volumes: device: $PWD/sources/egroupware/swoolepush # volume to store config.inc.php file / token shared between egroupware and push container push-config: + sessions: collabora-config: driver_opts: type: none @@ -52,8 +53,8 @@ volumes: device: $PWD/data/default/rocketchat/uploads services: egroupware: - image: egroupware/egroupware:latest - # EPL image: download.egroupware.org/egroupware/epl:latest + image: egroupware/egroupware:20.1 + # EPL image: download.egroupware.org/egroupware/epl:20.1 # setting a default language for a new installation #environment: #- LANG=de @@ -62,6 +63,8 @@ services: # extra-sources rsync from entry-point into sources #- extra:/usr/share/egroupware-extra - data:/var/lib/egroupware + - sessions:/var/lib/php/sessions + - push-config:/var/lib/egroupware-push # if you want to use the host database: # 1. comment out the whole db service below AND # 2. set EGW_DB_HOST=localhost AND @@ -99,6 +102,19 @@ services: #extra_hosts: #- "my.host.name:ip-address" + # push server using phpswoole + push: + image: phpswoole/swoole:latest + volumes: + - sources-push:/var/www + - sessions:/var/lib/php/sessions + - push-config:/var/lib/egroupware-push + container_name: egroupware-push + restart: always + # as we get our sources from there + depends_on: + - egroupware + nginx: image: nginx:stable-alpine volumes: diff --git a/doc/docker/fpm/Dockerfile b/doc/docker/fpm/Dockerfile index bbd31b76af..59e0e3100e 100644 --- a/doc/docker/fpm/Dockerfile +++ b/doc/docker/fpm/Dockerfile @@ -7,12 +7,17 @@ FROM ubuntu:18.04 MAINTAINER rb@egroupware.org ARG VERSION=dev-master +ARG PHP_VERSION=7.3 + +# keeping build-arg in environment for entrypoint.sh +ENV VERSION=$VERSION +ENV PHP_VERSION=$PHP_VERSION RUN apt-get update \ && apt-get install -y software-properties-common \ && LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \ && apt-get update \ - && bash -c "apt-get install -y php7.3-{cli,mysql,json,gd,xsl,bz2,opcache,apcu,tidy,zip,bcmath,mbstring,smbclient,ldap,curl,fpm,pgsql,gmp}" \ + && bash -c "apt-get install -y php$PHP_VERSION-{cli,mysql,json,gd,xsl,bz2,opcache,apcu,tidy,zip,bcmath,mbstring,smbclient,ldap,curl,fpm,pgsql,gmp}" \ # fpm and php.ini settings && sed -e 's/^;\?listen \?=.*/listen = 9000/g' \ -e '/allowed_clients/d' \ @@ -22,7 +27,7 @@ RUN apt-get update \ -e 's/^;\?pm.max_requests =.*/pm.max_requests = 30/' \ -e 's/^;\?php_admin_value\[memory_limit\].*/php_admin_value[memory_limit] = 172M/' \ -e 's/^;\?request_terminate_timeout.*/request_terminate_timeout = 70m/' \ - -i /etc/php/7.3/fpm/pool.d/www.conf \ + -i /etc/php/$PHP_VERSION/fpm/pool.d/www.conf \ && sed -e 's/^;\?session.gc_maxlifetime.*/session.gc_maxlifetime=14400/g' \ -e 's|^;\?date.timezone.*|date.timezone = UTC|g' \ -e 's|^;\?sys_temp_dir.*|sys_temp_dir = /tmp|g' \ @@ -33,14 +38,15 @@ RUN apt-get update \ -e 's|^;\?max_input_vars \?=.*|max_input_vars = 2000|g' \ -e 's|^;\?zlib.output_compression \?=.*|zlib.output_compression = On|g' \ -e 's|^;\?opcache.validate_timestamps \?=.*|opcache.validate_timestamps=0|g' \ - -i /etc/php/7.3/fpm/php.ini \ + -i /etc/php/$PHP_VERSION/fpm/php.ini \ && sed -e 's|^;\?date.timezone.*|date.timezone = UTC|g' \ -e 's|^;\?sys_temp_dir.*|sys_temp_dir = /tmp|g' \ - -i /etc/php/7.3/cli/php.ini \ + -i /etc/php/$PHP_VERSION/cli/php.ini \ # create directory for pid file && mkdir -p /run/php \ # send logs to stderr to be viewed by docker logs - && ln -s /dev/stderr /var/log/php7.3-fpm.log \ + && ln -s /dev/stderr /var/log/php$PHP_VERSION-fpm.log \ + && update-alternatives --install /usr/sbin/php-fpm php-fpm /usr/sbin/php-fpm$PHP_VERSION 5 \ # install tools to build EGroupware && apt-get install -y rsync npm zip curl sudo cron patch \ && npm install -g grunt-cli \ @@ -77,6 +83,10 @@ exit $RESULT' \ && chown -R www-data:www-data /var/lib/egroupware \ && chmod 700 /var/lib/egroupware/ \ && ln -s /var/lib/egroupware/header.inc.php /usr/share/egroupware \ + # create directory for push config + && mkdir -p /var/lib/egroupware-push \ + && chown -R www-data:www-data /var/lib/egroupware-push \ + && ln -s /var/lib/egroupware-push/config.inc.php /usr/share/egroupware/swoolepush \ # install cron-job and disable fallback async service and ability to switch them off in admin && sed 's/apache/www-data/' doc/rpm-build/egroupware.cron > /etc/cron.d/egroupware \ && patch -p1 < doc/rpm-build/asyncservice.patch \ @@ -87,10 +97,12 @@ exit $RESULT' \ VOLUME /usr/share/egroupware VOLUME /var/lib/egroupware +VOLUME /var/lib/php/sessions +VOLUME /var/lib/egroupware-push EXPOSE 9000 ADD entrypoint.sh / -CMD ["php-fpm7.3", "--nodaemonize"] +CMD ["php-fpm", "--nodaemonize"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/doc/docker/fpm/entrypoint.sh b/doc/docker/fpm/entrypoint.sh index b0b9bee69d..8dc736ca7d 100755 --- a/doc/docker/fpm/entrypoint.sh +++ b/doc/docker/fpm/entrypoint.sh @@ -1,23 +1,26 @@ #!/bin/bash set -e +VERSION=${VERSION:-dev-master} +PHP_VERSION=${PHP_VERSION:-7.3} + # if EGW_APC_SHM_SIZE is set in environment, propagate value to apcu.ini test -n "$EGW_APC_SHM_SIZE" && { - grep "apc.shm_size" /etc/php/7.3/fpm/conf.d/20-apcu.ini >/dev/null && \ + grep "apc.shm_size" /etc/php/$PHP_VERSION/fpm/conf.d/20-apcu.ini >/dev/null && \ sed -e "s/^;\?apc.shm_size.*/apc.shm_size=$EGW_APC_SHM_SIZE/g" \ - -i /etc/php/7.3/fpm/conf.d/20-apcu.ini || \ - echo "apc.shm_size=$EGW_APC_SHM_SIZE" >> /etc/php/7.3/fpm/conf.d/20-apcu.ini + -i /etc/php/$PHP_VERSION/fpm/conf.d/20-apcu.ini || \ + echo "apc.shm_size=$EGW_APC_SHM_SIZE" >> /etc/php/$PHP_VERSION/fpm/conf.d/20-apcu.ini } # if EGW_SESSION_TIMEOUT is set in environment, propagate value to php.ini test -n "$EGW_SESSION_TIMEOUT" && test "$EGW_SESSION_TIMEOUT" -ge 1440 && \ sed -e "s/^;\?session.gc_maxlifetime.*/session.gc_maxlifetime=$EGW_SESSION_TIMEOUT/g" \ - -i /etc/php/7.3/fpm/php.ini + -i /etc/php/$PHP_VERSION/fpm/php.ini # if EGW_MEMORY_LIMIT is set in environment, propagate value to php.ini test -n "$EGW_MEMORY_LIMIT" && \ sed -e "s/^;\?memory_limit.*/memory_limit=$EGW_MEMORY_LIMIT/g" \ - -i /etc/php/7.3/fpm/php.ini + -i /etc/php/$PHP_VERSION/fpm/php.ini # ToDo check version before copy rsync -a --delete /usr/share/egroupware-sources/ /usr/share/egroupware/