feat(): improve PHP resource management

pull/26/head
Hardware 2018-02-17 10:21:10 +01:00
parent c722bab23e
commit 0da5a98d69
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
5 changed files with 14 additions and 5 deletions

View File

@ -5,7 +5,11 @@ LABEL description "Next-generation forum software that makes online discussion f
ARG VERSION=v0.1.0-beta.7
ENV GID=991 UID=991 UPLOAD_MAX_SIZE=50M
ENV GID=991 \
UID=991 \
UPLOAD_MAX_SIZE=50M \
PHP_MEMORY_LIMIT=128M \
OPCACHE_MEMORY_LIMIT=128
RUN echo "@community https://nl.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories \
&& apk add -U \

View File

@ -41,6 +41,8 @@ Flarum is the next-generation forum software that makes online discussion fun. I
| **DB_PASS** | MariaDB database password | **required** | none
| **DB_PREF** | Flarum tables prefix | *optional* | none
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
| **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M |
| **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128
## Installation

View File

@ -2,7 +2,7 @@ zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.fast_shutdown=1
opcache.memory_consumption=128
opcache.memory_consumption=<OPCACHE_MEMORY_LIMIT>
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=5413
opcache.max_accelerated_files=7963
opcache.revalidate_freq=60

View File

@ -5,11 +5,12 @@ error_log = /tmp/php_error.log
[www]
listen = /tmp/php-fpm.sock
pm = dynamic
pm.max_children = 5
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_spare_servers = 4
chdir = /
php_admin_value[expose_php] = Off
php_admin_value[post_max_size] = <UPLOAD_MAX_SIZE>
php_admin_value[upload_max_filesize] = <UPLOAD_MAX_SIZE>
php_admin_value[memory_limit] = <PHP_MEMORY_LIMIT>

View File

@ -24,6 +24,8 @@ if [ -z "$FORUM_URL" ]; then
fi
sed -i "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf
sed -i "s/<PHP_MEMORY_LIMIT>/$PHP_MEMORY_LIMIT/g" /etc/php7/php-fpm.conf
sed -i "s/<OPCACHE_MEMORY_LIMIT>/$OPCACHE_MEMORY_LIMIT/g" /etc/php7/conf.d/00_opcache.ini
# Set permissions
chown -R $UID:$GID /flarum /services /var/log /var/lib/nginx