Skip to content

Commit

Permalink
Merge pull request #91 from Monogramm/feature/php.ini
Browse files Browse the repository at this point in the history
Add PHP.ini setup to fix #78 & fix #69
  • Loading branch information
luizeof authored Nov 3, 2019
2 parents c26fe59 + 22de963 commit 32a80fa
Show file tree
Hide file tree
Showing 20 changed files with 121 additions and 32 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ 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

### 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

Expand Down
7 changes: 6 additions & 1 deletion apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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=512M \
PHP_MAX_UPLOAD=128M \
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 - \
Expand All @@ -57,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
Expand Down
13 changes: 13 additions & 0 deletions apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -e

if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /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


if [ -n "$MYSQL_PORT_3306_TCP" ]; then
if [ -z "$MAUTIC_DB_HOST" ]; then
export MAUTIC_DB_HOST='mysql'
Expand Down
4 changes: 4 additions & 0 deletions apache/makeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n\$parameters = ".var_export($parameters, true).";\n";

Expand Down
5 changes: 0 additions & 5 deletions apache/mautic-php.ini

This file was deleted.

7 changes: 6 additions & 1 deletion beta-apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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=512M \
PHP_MAX_UPLOAD=128M \
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 - \
Expand All @@ -56,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
Expand Down
14 changes: 13 additions & 1 deletion beta-apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -e

if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /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


if [ -n "$MYSQL_PORT_3306_TCP" ]; then
if [ -z "$MAUTIC_DB_HOST" ]; then
export MAUTIC_DB_HOST='mysql'
Expand Down Expand Up @@ -124,7 +137,6 @@ echo >&2
echo >&2 "========================================================================"



# Github Pull Tester
if [ -n "$MAUTIC_TESTER" ]; then
echo >&2 "Copying Mautic Github Pull Tester"
Expand Down
4 changes: 4 additions & 0 deletions beta-apache/makeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n\$parameters = ".var_export($parameters, true).";\n";

Expand Down
5 changes: 0 additions & 5 deletions beta-apache/mautic-php.ini

This file was deleted.

7 changes: 6 additions & 1 deletion beta-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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=512M \
PHP_MAX_UPLOAD=128M \
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 - \
Expand All @@ -56,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"]
Expand Down
14 changes: 13 additions & 1 deletion beta-fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -e

if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /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


if [ -n "$MYSQL_PORT_3306_TCP" ]; then
if [ -z "$MAUTIC_DB_HOST" ]; then
export MAUTIC_DB_HOST='mysql'
Expand Down Expand Up @@ -124,7 +137,6 @@ echo >&2
echo >&2 "========================================================================"



# Github Pull Tester
if [ -n "$MAUTIC_TESTER" ]; then
echo >&2 "Copying Mautic Github Pull Tester"
Expand Down
4 changes: 4 additions & 0 deletions beta-fpm/makeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n\$parameters = ".var_export($parameters, true).";\n";

Expand Down
5 changes: 0 additions & 5 deletions beta-fpm/mautic-php.ini

This file was deleted.

14 changes: 13 additions & 1 deletion common/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -e

if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /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


if [ -n "$MYSQL_PORT_3306_TCP" ]; then
if [ -z "$MAUTIC_DB_HOST" ]; then
export MAUTIC_DB_HOST='mysql'
Expand All @@ -15,7 +28,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"
Expand Down
4 changes: 4 additions & 0 deletions common/makeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n\$parameters = ".var_export($parameters, true).";\n";

Expand Down
5 changes: 0 additions & 5 deletions common/mautic-php.ini

This file was deleted.

7 changes: 6 additions & 1 deletion fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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=512M \
PHP_MAX_UPLOAD=128M \
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 - \
Expand All @@ -57,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"]
Expand Down
13 changes: 13 additions & 0 deletions fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -e

if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /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


if [ -n "$MYSQL_PORT_3306_TCP" ]; then
if [ -z "$MAUTIC_DB_HOST" ]; then
export MAUTIC_DB_HOST='mysql'
Expand Down
4 changes: 4 additions & 0 deletions fpm/makeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<?php\n\$parameters = ".var_export($parameters, true).";\n";

Expand Down
5 changes: 0 additions & 5 deletions fpm/mautic-php.ini

This file was deleted.

0 comments on commit 32a80fa

Please sign in to comment.