From d9f534a0bc634e5bc7760b4010fab1c01b59dbd3 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Wed, 3 Apr 2019 03:51:20 +0200 Subject: [PATCH 1/8] :sparkles: Add PHP.ini setup to fix #78 & fix #69 --- apache/Dockerfile | 6 ++++++ apache/docker-entrypoint.sh | 11 ++++++++++- beta-apache/Dockerfile | 6 ++++++ beta-apache/docker-entrypoint.sh | 11 ++++++++++- beta-fpm/Dockerfile | 6 ++++++ beta-fpm/docker-entrypoint.sh | 11 ++++++++++- common/docker-entrypoint.sh | 11 ++++++++++- fpm/Dockerfile | 6 ++++++ fpm/docker-entrypoint.sh | 11 ++++++++++- 9 files changed, 74 insertions(+), 5 deletions(-) diff --git a/apache/Dockerfile b/apache/Dockerfile index 87cb549a..48a6e0de 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -43,6 +43,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index e15cb42d..75d924d0 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +134,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/beta-apache/Dockerfile b/beta-apache/Dockerfile index b47b6def..07c49a59 100644 --- a/beta-apache/Dockerfile +++ b/beta-apache/Dockerfile @@ -42,6 +42,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/beta-apache/docker-entrypoint.sh b/beta-apache/docker-entrypoint.sh index e15cb42d..75d924d0 100644 --- a/beta-apache/docker-entrypoint.sh +++ b/beta-apache/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +134,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/beta-fpm/Dockerfile b/beta-fpm/Dockerfile index 10f3a3c0..9f291ab3 100644 --- a/beta-fpm/Dockerfile +++ b/beta-fpm/Dockerfile @@ -42,6 +42,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/beta-fpm/docker-entrypoint.sh b/beta-fpm/docker-entrypoint.sh index e15cb42d..75d924d0 100644 --- a/beta-fpm/docker-entrypoint.sh +++ b/beta-fpm/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +134,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/common/docker-entrypoint.sh b/common/docker-entrypoint.sh index c5644eac..75d924d0 100755 --- a/common/docker-entrypoint.sh +++ b/common/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -15,7 +25,6 @@ if [ -n "$MYSQL_PORT_3306_TCP" ]; then fi - if [ -z "$MAUTIC_DB_HOST" ]; then echo >&2 "error: missing MAUTIC_DB_HOST and MYSQL_PORT_3306_TCP environment variables" echo >&2 " Did you forget to --link some_mysql_container:mysql or set an external db" diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 62cacb2e..31953829 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -43,6 +43,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index e15cb42d..75d924d0 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +134,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" From 841e9b03404137114277c5204226f5ef9ef589e7 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Wed, 3 Apr 2019 03:54:27 +0200 Subject: [PATCH 2/8] :memo: Add documentation on PHP parameters --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b48a4bc3..5b7a3a67 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,12 @@ If the `MAUTIC_DB_NAME` specified does not already exist on the given MySQL serv ### Enable / Disable Features - `-e MAUTIC_TESTER=...` (defaults to empty) Enables Mautic Github Pull Tester [documentation](https://github.com/mautic/mautic-tester) +### PHP options +- `-e PHP_INI_DATE_TIMEZONE=...` (defaults to `UTC`) Set PHP timezone +- `-e PHP_MEMORY_LIMIT=...` (defaults to `256M`) Set PHP memory limit +- `-e PHP_MAX_UPLOAD=...` (defaults to `20M`) Set PHP upload max file size +- `-e PHP_MAX_EXECUTION_TIME=...` (defaults to `300`) Set PHP max execution time + ### Persistent Data Volumes From bb16dca02110eb9c1373e51580afa97306bd80b7 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Wed, 3 Apr 2019 15:56:54 +0200 Subject: [PATCH 3/8] :fire: Remove mautic-php.ini and update PHP values --- apache/Dockerfile | 5 ++--- apache/docker-entrypoint.sh | 3 +++ apache/mautic-php.ini | 5 ----- beta-apache/Dockerfile | 5 ++--- beta-apache/docker-entrypoint.sh | 3 +++ beta-apache/mautic-php.ini | 5 ----- beta-fpm/Dockerfile | 5 ++--- beta-fpm/docker-entrypoint.sh | 3 +++ beta-fpm/mautic-php.ini | 5 ----- common/docker-entrypoint.sh | 3 +++ common/mautic-php.ini | 5 ----- fpm/Dockerfile | 5 ++--- fpm/docker-entrypoint.sh | 3 +++ fpm/mautic-php.ini | 5 ----- 14 files changed, 23 insertions(+), 37 deletions(-) delete mode 100644 apache/mautic-php.ini delete mode 100644 beta-apache/mautic-php.ini delete mode 100644 beta-fpm/mautic-php.ini delete mode 100644 common/mautic-php.ini delete mode 100644 fpm/mautic-php.ini diff --git a/apache/Dockerfile b/apache/Dockerfile index 48a6e0de..c5210fb4 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -45,8 +45,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -62,7 +62,6 @@ COPY docker-entrypoint.sh /entrypoint.sh COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Enable Apache Rewrite Module RUN a2enmod rewrite diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 75d924d0..19f27ecb 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/apache/mautic-php.ini b/apache/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/apache/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/beta-apache/Dockerfile b/beta-apache/Dockerfile index 07c49a59..0a29af93 100644 --- a/beta-apache/Dockerfile +++ b/beta-apache/Dockerfile @@ -44,8 +44,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -61,7 +61,6 @@ COPY docker-entrypoint.sh /entrypoint.sh COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Enable Apache Rewrite Module RUN a2enmod rewrite diff --git a/beta-apache/docker-entrypoint.sh b/beta-apache/docker-entrypoint.sh index 75d924d0..19f27ecb 100644 --- a/beta-apache/docker-entrypoint.sh +++ b/beta-apache/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/beta-apache/mautic-php.ini b/beta-apache/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/beta-apache/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/beta-fpm/Dockerfile b/beta-fpm/Dockerfile index 9f291ab3..81845bd0 100644 --- a/beta-fpm/Dockerfile +++ b/beta-fpm/Dockerfile @@ -44,8 +44,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -61,7 +61,6 @@ COPY docker-entrypoint.sh /entrypoint.sh COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Apply necessary permissions RUN ["chmod", "+x", "/entrypoint.sh"] diff --git a/beta-fpm/docker-entrypoint.sh b/beta-fpm/docker-entrypoint.sh index 75d924d0..19f27ecb 100644 --- a/beta-fpm/docker-entrypoint.sh +++ b/beta-fpm/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/beta-fpm/mautic-php.ini b/beta-fpm/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/beta-fpm/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/common/docker-entrypoint.sh b/common/docker-entrypoint.sh index 75d924d0..19f27ecb 100755 --- a/common/docker-entrypoint.sh +++ b/common/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/common/mautic-php.ini b/common/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/common/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 31953829..ac0047c1 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -45,8 +45,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -62,7 +62,6 @@ COPY docker-entrypoint.sh /entrypoint.sh COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Apply necessary permissions RUN ["chmod", "+x", "/entrypoint.sh"] diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index 75d924d0..19f27ecb 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/fpm/mautic-php.ini b/fpm/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/fpm/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M From b6b4afa0d10f932c617628a4c6341f00be071f4d Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Thu, 4 Apr 2019 02:38:11 +0200 Subject: [PATCH 4/8] :sparkles: Set mautic timezone param to match PHP --- apache/makeconfig.php | 4 ++++ beta-apache/makeconfig.php | 4 ++++ beta-fpm/makeconfig.php | 4 ++++ common/makeconfig.php | 4 ++++ fpm/makeconfig.php | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/apache/makeconfig.php b/apache/makeconfig.php index ecc5a1c8..b0640797 100755 --- a/apache/makeconfig.php +++ b/apache/makeconfig.php @@ -33,6 +33,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = " Date: Wed, 3 Apr 2019 03:51:20 +0200 Subject: [PATCH 5/8] :sparkles: Add PHP.ini setup to fix #78 & fix #69 --- apache/Dockerfile | 6 ++++++ apache/docker-entrypoint.sh | 10 ++++++++++ beta-apache/Dockerfile | 6 ++++++ beta-apache/docker-entrypoint.sh | 11 ++++++++++- beta-fpm/Dockerfile | 6 ++++++ beta-fpm/docker-entrypoint.sh | 11 ++++++++++- common/docker-entrypoint.sh | 11 ++++++++++- fpm/Dockerfile | 6 ++++++ fpm/docker-entrypoint.sh | 10 ++++++++++ 9 files changed, 74 insertions(+), 3 deletions(-) diff --git a/apache/Dockerfile b/apache/Dockerfile index 765d0e16..aa3728ec 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -43,6 +43,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 129d5875..6c6b0e2f 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' diff --git a/beta-apache/Dockerfile b/beta-apache/Dockerfile index fcfd6713..2b68365e 100644 --- a/beta-apache/Dockerfile +++ b/beta-apache/Dockerfile @@ -42,6 +42,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/beta-apache/docker-entrypoint.sh b/beta-apache/docker-entrypoint.sh index ccb7d647..9a4504a5 100644 --- a/beta-apache/docker-entrypoint.sh +++ b/beta-apache/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +134,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/beta-fpm/Dockerfile b/beta-fpm/Dockerfile index 08f8e46d..c00f02a2 100644 --- a/beta-fpm/Dockerfile +++ b/beta-fpm/Dockerfile @@ -42,6 +42,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/beta-fpm/docker-entrypoint.sh b/beta-fpm/docker-entrypoint.sh index 5e7be4e0..67fe115e 100644 --- a/beta-fpm/docker-entrypoint.sh +++ b/beta-fpm/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -124,7 +134,6 @@ echo >&2 echo >&2 "========================================================================" - # Github Pull Tester if [ -n "$MAUTIC_TESTER" ]; then echo >&2 "Copying Mautic Github Pull Tester" diff --git a/common/docker-entrypoint.sh b/common/docker-entrypoint.sh index 129d5875..9a4504a5 100755 --- a/common/docker-entrypoint.sh +++ b/common/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' @@ -15,7 +25,6 @@ if [ -n "$MYSQL_PORT_3306_TCP" ]; then fi - if [ -z "$MAUTIC_DB_HOST" ]; then echo >&2 "error: missing MAUTIC_DB_HOST and MYSQL_PORT_3306_TCP environment variables" echo >&2 " Did you forget to --link some_mysql_container:mysql or set an external db" diff --git a/fpm/Dockerfile b/fpm/Dockerfile index da1ee994..a2534372 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -43,6 +43,12 @@ ENV MAUTIC_RUN_CRON_JOBS true ENV MAUTIC_DB_USER root ENV MAUTIC_DB_NAME mautic +# Setting PHP properties +ENV PHP_INI_DATE_TIMEZONE='UTC' \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_UPLOAD=20M \ + PHP_MAX_EXECUTION_TIME=300 + # Download package and extract to web volume RUN curl -o mautic.zip -SL https://github.com/mautic/mautic/releases/download/${MAUTIC_VERSION}/${MAUTIC_VERSION}.zip \ && echo "$MAUTIC_SHA1 *mautic.zip" | sha1sum -c - \ diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index 129d5875..6c6b0e2f 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -1,6 +1,16 @@ #!/bin/bash set -e +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = "${PHP_INI_DATE_TIMEZONE}" +memory_limit = ${PHP_MEMORY_LIMIT} +upload_max_filesize = ${PHP_MAX_UPLOAD} +max_execution_time = ${PHP_MAX_EXECUTION_TIME} +EOF +fi + + if [ -n "$MYSQL_PORT_3306_TCP" ]; then if [ -z "$MAUTIC_DB_HOST" ]; then export MAUTIC_DB_HOST='mysql' From d6902592601abb0bfd4734eda5106981d65a0f2e Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Wed, 3 Apr 2019 03:54:27 +0200 Subject: [PATCH 6/8] :memo: Add documentation on PHP parameters --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 310d4105..4e90adca 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,12 @@ If the `MAUTIC_DB_NAME` specified does not already exist on the given MySQL serv ### Enable / Disable Features - `-e MAUTIC_TESTER=...` (defaults to empty) Enables Mautic Github Pull Tester [documentation](https://github.com/mautic/mautic-tester) +### PHP options +- `-e PHP_INI_DATE_TIMEZONE=...` (defaults to `UTC`) Set PHP timezone +- `-e PHP_MEMORY_LIMIT=...` (defaults to `256M`) Set PHP memory limit +- `-e PHP_MAX_UPLOAD=...` (defaults to `20M`) Set PHP upload max file size +- `-e PHP_MAX_EXECUTION_TIME=...` (defaults to `300`) Set PHP max execution time + ### Persistent Data Volumes From be3adc6f8e9746df2950556b974d446c1b144f41 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Wed, 3 Apr 2019 15:56:54 +0200 Subject: [PATCH 7/8] :fire: Remove mautic-php.ini and update PHP values --- apache/Dockerfile | 5 ++--- apache/docker-entrypoint.sh | 3 +++ apache/mautic-php.ini | 5 ----- beta-apache/Dockerfile | 5 ++--- beta-apache/docker-entrypoint.sh | 3 +++ beta-apache/mautic-php.ini | 5 ----- beta-fpm/Dockerfile | 5 ++--- beta-fpm/docker-entrypoint.sh | 3 +++ beta-fpm/mautic-php.ini | 5 ----- common/docker-entrypoint.sh | 3 +++ common/mautic-php.ini | 5 ----- fpm/Dockerfile | 5 ++--- fpm/docker-entrypoint.sh | 3 +++ fpm/mautic-php.ini | 5 ----- 14 files changed, 23 insertions(+), 37 deletions(-) delete mode 100644 apache/mautic-php.ini delete mode 100644 beta-apache/mautic-php.ini delete mode 100644 beta-fpm/mautic-php.ini delete mode 100644 common/mautic-php.ini delete mode 100644 fpm/mautic-php.ini diff --git a/apache/Dockerfile b/apache/Dockerfile index aa3728ec..50c00cca 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -45,8 +45,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -63,7 +63,6 @@ COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic RUN chmod 644 /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Enable Apache Rewrite Module RUN a2enmod rewrite diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 6c6b0e2f..4e29f2d5 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/apache/mautic-php.ini b/apache/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/apache/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/beta-apache/Dockerfile b/beta-apache/Dockerfile index 2b68365e..d6488d19 100644 --- a/beta-apache/Dockerfile +++ b/beta-apache/Dockerfile @@ -44,8 +44,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -62,7 +62,6 @@ COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic RUN chmod 644 /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Enable Apache Rewrite Module RUN a2enmod rewrite diff --git a/beta-apache/docker-entrypoint.sh b/beta-apache/docker-entrypoint.sh index 9a4504a5..6846ba6e 100644 --- a/beta-apache/docker-entrypoint.sh +++ b/beta-apache/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/beta-apache/mautic-php.ini b/beta-apache/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/beta-apache/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/beta-fpm/Dockerfile b/beta-fpm/Dockerfile index c00f02a2..3cfd9e29 100644 --- a/beta-fpm/Dockerfile +++ b/beta-fpm/Dockerfile @@ -44,8 +44,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -62,7 +62,6 @@ COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic RUN chmod 644 /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Apply necessary permissions RUN ["chmod", "+x", "/entrypoint.sh"] diff --git a/beta-fpm/docker-entrypoint.sh b/beta-fpm/docker-entrypoint.sh index 67fe115e..7dd3a9bc 100644 --- a/beta-fpm/docker-entrypoint.sh +++ b/beta-fpm/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/beta-fpm/mautic-php.ini b/beta-fpm/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/beta-fpm/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/common/docker-entrypoint.sh b/common/docker-entrypoint.sh index 9a4504a5..6846ba6e 100755 --- a/common/docker-entrypoint.sh +++ b/common/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/common/mautic-php.ini b/common/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/common/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M diff --git a/fpm/Dockerfile b/fpm/Dockerfile index a2534372..6b0cd336 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -45,8 +45,8 @@ ENV MAUTIC_DB_NAME mautic # Setting PHP properties ENV PHP_INI_DATE_TIMEZONE='UTC' \ - PHP_MEMORY_LIMIT=256M \ - PHP_MAX_UPLOAD=20M \ + PHP_MEMORY_LIMIT=512M \ + PHP_MAX_UPLOAD=128M \ PHP_MAX_EXECUTION_TIME=300 # Download package and extract to web volume @@ -63,7 +63,6 @@ COPY makeconfig.php /makeconfig.php COPY makedb.php /makedb.php COPY mautic.crontab /etc/cron.d/mautic RUN chmod 644 /etc/cron.d/mautic -COPY mautic-php.ini /usr/local/etc/php/conf.d/mautic-php.ini # Apply necessary permissions RUN ["chmod", "+x", "/entrypoint.sh"] diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index 6c6b0e2f..4e29f2d5 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -4,8 +4,11 @@ set -e if [ ! -f /usr/local/etc/php/php.ini ]; then cat < /usr/local/etc/php/php.ini date.timezone = "${PHP_INI_DATE_TIMEZONE}" +always_populate_raw_post_data = -1 memory_limit = ${PHP_MEMORY_LIMIT} +file_uploads = On upload_max_filesize = ${PHP_MAX_UPLOAD} +post_max_size = ${PHP_MAX_UPLOAD} max_execution_time = ${PHP_MAX_EXECUTION_TIME} EOF fi diff --git a/fpm/mautic-php.ini b/fpm/mautic-php.ini deleted file mode 100644 index fbcad0c9..00000000 --- a/fpm/mautic-php.ini +++ /dev/null @@ -1,5 +0,0 @@ -always_populate_raw_post_data = -1 -memory_limit = 512M -file_uploads = On -upload_max_filesize=128M -post_max_size=128M From e19871c58b8bc604c77a4f2306e4ec62e4dad3e9 Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Thu, 4 Apr 2019 02:38:11 +0200 Subject: [PATCH 8/8] :sparkles: Set mautic timezone param to match PHP --- apache/makeconfig.php | 4 ++++ beta-apache/makeconfig.php | 4 ++++ beta-fpm/makeconfig.php | 4 ++++ common/makeconfig.php | 4 ++++ fpm/makeconfig.php | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/apache/makeconfig.php b/apache/makeconfig.php index 41134d24..0db32904 100755 --- a/apache/makeconfig.php +++ b/apache/makeconfig.php @@ -36,6 +36,10 @@ $parameters['trusted_proxies'] = $proxies; } +if(array_key_exists('PHP_INI_DATE_TIMEZONE', $_ENV)) { + $parameters['default_timezone'] = $_ENV['PHP_INI_DATE_TIMEZONE']; +} + $path = '/var/www/html/app/config/local.php'; $rendered = "