Refs #30 Adding PHP-FPM 5.2

This commit is contained in:
cytopia
2018-08-02 13:24:41 +02:00
parent 523c936f65
commit 694a7c0fea
26 changed files with 1486 additions and 69 deletions

View File

@@ -0,0 +1,87 @@
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-base.j2 instead.
FROM devilbox/php-fpm-5.2
MAINTAINER "cytopia" <cytopia@everythingcli.org>
###
### Labels
###
LABEL \
name="cytopia's PHP-FPM 5.2 Image" \
image="devilbox/php-fpm" \
tag="5.2-base" \
vendor="devilbox" \
license="MIT"
###
### Envs
###
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000" \
PHP_VERSION="5.2"
###
### User/Group
###
RUN set -x \
&& groupadd -g ${MY_GID} -r ${MY_GROUP} \
&& useradd -u ${MY_UID} -m -s /bin/bash -g ${MY_GROUP} ${MY_USER}
###
### Upgrade (install ps)
###
RUN set -x \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install --no-install-recommends --no-install-suggests -y procps \
&& rm -rf /var/lib/apt/lists/*
###
### Configure
###
RUN set -x \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###
### Copy files
###
COPY ./data/php-ini.d/php-5.2.ini /usr/local/etc/php/conf.d/yyy-devilbox.ini
COPY ./data/php-fpm.conf/php-fpm-5.2.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/php-fpm.d-5.2.conf /usr/local/etc/php-fpm.d/php-fpm.d.conf
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
###
### Verify
###
RUN set -x \
&& php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^5.2' \
&& /usr/local/sbin/php-fpm --test \
&& PHP_ERROR="$( php -v 2>&1 1>/dev/null )" \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi
###
### Ports
###
EXPOSE 9000
###
### Entrypoint
###
ENTRYPOINT ["/docker-entrypoint.sh"]

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="5.3"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="5.4"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="5.5"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="5.6"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="7.0"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="7.1"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="7.2"
###

View File

@@ -20,7 +20,8 @@ LABEL \
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000"
MY_GID="1000" \
PHP_VERSION="7.3"
###

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" ?>
<configuration>
All relative paths in this config are relative to php's install prefix
<section name="global_options">
Pid file
<value name="pid_file">/var/run/php-fpm.pid</value>
Error log file
<value name="error_log">/proc/self/fd/2</value>
Log level
<value name="log_level">notice</value>
When this amount of php processes exited with SIGSEGV or SIGBUS ...
<value name="emergency_restart_threshold">10</value>
... in a less than this interval of time, a graceful restart will be initiated.
Useful to work around accidental curruptions in accelerator's shared memory.
<value name="emergency_restart_interval">1m</value>
Time limit on waiting child's reaction on signals from master
<value name="process_control_timeout">5s</value>
Set to 'no' to debug fpm
<value name="daemonize">no</value>
</section>
<workers>
<section name="pool">
Name of pool. Used in logs and stats.
<value name="name">default</value>
Address to accept fastcgi requests on.
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
<value name="listen_address">0.0.0.0:9000</value>
<value name="listen_options">
Set listen(2) backlog
<value name="backlog">1023</value>
Set permissions for unix socket, if one used.
In Linux read/write permissions must be set in order to allow connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.
<value name="owner"></value>
<value name="group"></value>
<value name="mode">0666</value>
</value>
Additional php.ini defines, specific to this pool of workers.
<value name="php_defines">
<value name="error_reporting">E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED</value>
<value name="xmlrpc_errors">Off</value>
<value name="report_memleaks">On</value>
<value name="display_errors">Off</value>
<value name="display_startup_errors">Off</value>
<value name="track_errors">On</value>
<value name="log_errors">On</value>
<value name="html_errors">Off</value>
</value>
Unix user of processes
<value name="user">devilbox</value>
Unix group of processes
<value name="group">devilbox</value>
Process manager settings
<value name="pm">
Sets style of controling worker process count.
Valid values are 'static' and 'apache-like'
<value name="style">apache-like</value>
Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
<value name="max_children">50</value>
Settings group for 'apache-like' pm style
<value name="apache_like">
Sets the number of server processes created on startup.
Used only when 'apache-like' pm_style is selected
<value name="StartServers">10</value>
Sets the desired minimum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MinSpareServers">5</value>
Sets the desired maximum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MaxSpareServers">15</value>
</value>
</value>
The timeout (in seconds) for serving a single request after which the worker process will be terminated
Should be used when 'max_execution_time' ini option does not stop script execution for some reason
'0s' means 'off'
<value name="request_terminate_timeout">180s</value>
The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
'0s' means 'off'
<value name="request_slowlog_timeout">0s</value>
The log file for slow requests
<value name="slowlog">logs/slow.log</value>
Set open file desc rlimit
<value name="rlimit_files">1024</value>
Set max core size rlimit
<value name="rlimit_core">0</value>
Chroot to this directory at the start, absolute path
<value name="chroot"></value>
Chdir to this directory at the start, absolute path
<value name="chdir"></value>
Redirect workers' stdout and stderr into main error log.
If not set, they will be redirected to /dev/null, according to FastCGI specs
<value name="catch_workers_output">yes</value>
How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
<value name="max_requests">500</value>
Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
Makes sense only with AF_INET listening socket.
<!-- <value name="allowed_clients">127.0.0.1</value> -->
Pass environment variables like LD_LIBRARY_PATH
All $VARIABLEs are taken from current environment
<value name="environment">
<value name="HOSTNAME">$HOSTNAME</value>
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
<value name="TMP">/tmp</value>
<value name="TMPDIR">/tmp</value>
<value name="TEMP">/tmp</value>
<value name="OSTYPE">$OSTYPE</value>
<value name="MACHTYPE">$MACHTYPE</value>
<value name="MALLOC_CHECK_">2</value>
</value>
</section>
</workers>
</configuration>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,42 @@
; ############################################################
; # Devilbox PHP defaults for 5.2-base
; ############################################################
; Each PHP flavour (base, mods, prod, work) might have its own php.ini.
; If none is present, the one from the previous flavour is inherited.
[PHP]
; Memory
; Note: "memory_limit" should be larger than "post_max_size"
memory_limit = 512M
; Timeouts
max_execution_time = 180
max_input_time = 180
; Uploads
; Note: "post_max_size" should be greater than "upload_max_filesize"
post_max_size = 384M
upload_max_filesize = 256M
max_file_uploads = 20
; Vars
variables_order = EGPCS
max_input_nesting_level = 64
; Error reporting
; Note: error_log is dynamic and handled during start to set appropriate setting
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
xmlrpc_errors = Off
report_memleaks = On
display_errors = Off
display_startup_errors = Off
track_errors = On
log_errors = On
html_errors = Off