mirror of
https://github.com/devilbox/docker-php-fpm.git
synced 2026-01-10 18:04:43 +00:00
Make php configuration generatable via Ansible
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
; ############################################################
|
||||
; # Devilbox PHP defaults for all Docker images
|
||||
; ############################################################
|
||||
|
||||
; This php.ini is applied to the base container and inherited
|
||||
; by every image built on top of it.
|
||||
; Note that prod and work images overwrite specific settings
|
||||
; for their use-case.
|
||||
|
||||
|
||||
[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
|
||||
{% if not (php_version == 5.2 or php_version == 5.3 ) %}
|
||||
max_input_vars = 8000
|
||||
{% endif %}
|
||||
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
|
||||
{% if php_version == 5.2 or php_version == 5.3 or php_version == 5.4 or php_version == 5.5 or php_version == 5.6 or php_version == 7.0 or php_version == 7.1 %}
|
||||
track_errors = On
|
||||
{% endif %}
|
||||
log_errors = On
|
||||
@@ -1,9 +0,0 @@
|
||||
; ############################################################
|
||||
; # Devilbox PHP defaults for all production Docker images
|
||||
; ############################################################
|
||||
|
||||
; This php.ini is applied to the prod container and inherited
|
||||
; by every image built on top of it.
|
||||
|
||||
|
||||
[PHP]
|
||||
@@ -1,19 +0,0 @@
|
||||
; ############################################################
|
||||
; # Devilbox PHP defaults for all development Docker images
|
||||
; ############################################################
|
||||
|
||||
; This php.ini is applied to the work container.
|
||||
|
||||
|
||||
[PHP]
|
||||
|
||||
; 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
|
||||
display_errors = On
|
||||
display_startup_errors = On
|
||||
{% if php_version == 5.2 or php_version == 5.3 or php_version == 5.4 or php_version == 5.5 or php_version == 5.6 or php_version == 7.0 or php_version == 7.1 %}
|
||||
track_errors = On
|
||||
{% endif %}
|
||||
log_errors = On
|
||||
html_errors = On
|
||||
163
build/ansible/CONFIGURATIONS/php-fpm.conf.j2
Normal file
163
build/ansible/CONFIGURATIONS/php-fpm.conf.j2
Normal file
@@ -0,0 +1,163 @@
|
||||
{% if not php_version == 5.2 %}
|
||||
[global]
|
||||
daemonize = no
|
||||
include = /usr/local/etc/php-fpm.d/*.conf
|
||||
{% else %}
|
||||
{# PHP-FPM 5.2 uses XML format for configuration #}
|
||||
<?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">{{ item.cfg[item.key].error_log | default(item.cfg[item.alt].error_log) }}</value>
|
||||
|
||||
Log level
|
||||
<value name="log_level">{{ item.cfg[item.key].log_level | default(item.cfg[item.alt].log_level) }}</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:{{ item.cfg[item.key].listen | default(item.cfg[item.alt].listen) }}</value>
|
||||
|
||||
<value name="listen_options">
|
||||
Set listen(2) backlog
|
||||
<value name="backlog">{{ item.cfg[item.key].listen_backlog | default(item.cfg[item.alt].listen_backlog) }}</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">{{ item.cfg[item.key].error_reporting | default(item.cfg[item.alt].error_reporting) }}</value>
|
||||
<value name="xmlrpc_errors">{{ item.cfg[item.key].xmlrpc_errors | default(item.cfg[item.alt].xmlrpc_errors) }}</value>
|
||||
<value name="report_memleaks">{{ item.cfg[item.key].report_memleaks | default(item.cfg[item.alt].report_memleaks) }}</value>
|
||||
<value name="display_errors">{{ item.cfg[item.key].display_errors | default(item.cfg[item.alt].display_errors) }}</value>
|
||||
<value name="display_startup_errors">{{ item.cfg[item.key].display_startup_errors | default(item.cfg[item.alt].display_startup_errors) }}</value>
|
||||
<value name="track_errors">{{ item.cfg[item.key].track_errors | default(item.cfg[item.alt].track_errors) }}</value>
|
||||
<value name="log_errors">{{ item.cfg[item.key].log_errors | default(item.cfg[item.alt].log_errors) }}</value>
|
||||
<value name="html_errors">{{ item.cfg[item.key].html_errors | default(item.cfg[item.alt].html_errors) }}</value>
|
||||
</value>
|
||||
|
||||
Unix user of processes
|
||||
<value name="user">{{ item.cfg[item.key].user | default(item.cfg[item.alt].user) }}</value>
|
||||
|
||||
Unix group of processes
|
||||
<value name="group">{{ item.cfg[item.key].group | default(item.cfg[item.alt].group) }}</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">{{ item.cfg[item.key].pm_max_children | default(item.cfg[item.alt].pm_max_children) }}</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">{{ item.cfg[item.key].pm_start_servers | default(item.cfg[item.alt].pm_start_servers) }}</value>
|
||||
|
||||
Sets the desired minimum number of idle server processes.
|
||||
Used only when 'apache-like' pm_style is selected
|
||||
<value name="MinSpareServers">{{ item.cfg[item.key].pm_min_spare_servers | default(item.cfg[item.alt].pm_min_spare_servers) }}</value>
|
||||
|
||||
Sets the desired maximum number of idle server processes.
|
||||
Used only when 'apache-like' pm_style is selected
|
||||
<value name="MaxSpareServers">{{ item.cfg[item.key].pm_max_spare_servers | default(item.cfg[item.alt].pm_max_spare_servers) }}</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">{{ item.cfg[item.key].request_terminate_timeout | default(item.cfg[item.alt].request_terminate_timeout) }}</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">{{ item.cfg[item.key].catch_workers_output | default(item.cfg[item.alt].catch_workers_output) }}</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">{{ item.cfg[item.key].pm_max_requests | default(item.cfg[item.alt].pm_max_requests) }}</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>
|
||||
{% endif %}
|
||||
110
build/ansible/CONFIGURATIONS/php-fpm.d-conf.j2
Normal file
110
build/ansible/CONFIGURATIONS/php-fpm.d-conf.j2
Normal file
@@ -0,0 +1,110 @@
|
||||
{# PHP-FPM 5.2 uses XML format for configuration and does not allow multiple files #}
|
||||
{% if not php_version == 5.2 %}
|
||||
[www]
|
||||
|
||||
; ############################################################
|
||||
; Required for Dockerization
|
||||
; ############################################################
|
||||
|
||||
{# This value is available since PHP >=5.4 #}
|
||||
{% if not php_version == 5.3 %}
|
||||
; Keep env variables set by docker
|
||||
clear_env = {{ item.cfg[item.key].clear_env | default(item.cfg[item.alt].clear_env) }}
|
||||
{% endif %}
|
||||
|
||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
||||
; Note: on highloaded environement, this can cause some delay in the page
|
||||
; process time (several ms).
|
||||
; Default Value: no
|
||||
catch_workers_output = {{ item.cfg[item.key].catch_workers_output | default(item.cfg[item.alt].catch_workers_output) }}
|
||||
|
||||
|
||||
; ############################################################
|
||||
; Networking
|
||||
; ############################################################
|
||||
|
||||
[www]
|
||||
; Ensure to listen here
|
||||
listen = {{ item.cfg[item.key].listen | default(item.cfg[item.alt].listen)}}
|
||||
{# Available since PHP >= 5.4 #}
|
||||
listen.backlog = {{ item.cfg[item.key].listen_backlog | default(item.cfg[item.alt].listen_backlog) }}
|
||||
|
||||
|
||||
; ############################################################
|
||||
; Timeouts
|
||||
; ############################################################
|
||||
|
||||
[www]
|
||||
; The timeout for serving a single request after which the worker process will be killed.
|
||||
; This option should be used when the 'max_execution_time' ini option does not stop script
|
||||
; execution for some reason.
|
||||
request_terminate_timeout = {{ item.cfg[item.key].request_terminate_timeout | default(item.cfg[item.alt].request_terminate_timeout) }}
|
||||
|
||||
|
||||
; ############################################################
|
||||
; Logging
|
||||
; ############################################################
|
||||
|
||||
[global]
|
||||
error_log = {{ item.cfg[item.key].error_log | default(item.cfg[item.alt].error_log) }}
|
||||
log_level = {{ item.cfg[item.key].log_level | default(item.cfg[item.alt].log_level) }}
|
||||
|
||||
[www]
|
||||
; if we send this to /proc/self/fd/1, it never appears
|
||||
access.log = {{ item.cfg[item.key].access_log | default(item.cfg[item.alt].access_log) }}
|
||||
|
||||
|
||||
; ############################################################
|
||||
; Worker configuration
|
||||
; ############################################################
|
||||
|
||||
[www]
|
||||
; The number of child processes is set dynamically based on the following directives:
|
||||
; pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers.
|
||||
pm = {{ item.cfg[item.key].pm | default(item.cfg[item.alt].pm) }}
|
||||
|
||||
; The maximum number of child processes to be created
|
||||
pm.max_children = {{ item.cfg[item.key].pm_max_children | default(item.cfg[item.alt].pm_max_children) }}
|
||||
|
||||
; The number of child processes created on startup. Used only when pm is set to dynamic.
|
||||
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2.
|
||||
pm.start_servers = {{ item.cfg[item.key].pm_start_servers | default(item.cfg[item.alt].pm_start_servers) }}
|
||||
|
||||
; The desired minimum number of idle server processes.
|
||||
pm.min_spare_servers = {{ item.cfg[item.key].pm_min_spare_servers | default(item.cfg[item.alt].pm_min_spare_servers) }}
|
||||
|
||||
; The desired maximum number of idle server processes.
|
||||
pm.max_spare_servers = {{ item.cfg[item.key].pm_max_spare_servers | default(item.cfg[item.alt].pm_max_spare_servers) }}
|
||||
|
||||
; The number of requests each child process should execute before respawning.
|
||||
; This can be useful to work around memory leaks in 3rd party libraries.
|
||||
; For endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||
; Default value: 0.
|
||||
pm.max_requests = {{ item.cfg[item.key].pm_max_requests | default(item.cfg[item.alt].pm_max_requests) }}
|
||||
|
||||
|
||||
; ############################################################
|
||||
; User and Group
|
||||
; ############################################################
|
||||
|
||||
[www]
|
||||
user = {{ item.cfg[item.key].user | default(item.cfg[item.alt].user) }}
|
||||
group = {{ item.cfg[item.key].group | default(item.cfg[item.alt].group) }}
|
||||
|
||||
|
||||
; ############################################################
|
||||
; PHP settings
|
||||
; ############################################################
|
||||
php_value[error_reporting] = {{ item.cfg[item.key].error_reporting | default(item.cfg[item.alt].error_reporting) }}
|
||||
php_flag[xmlrpc_errors] = {{ item.cfg[item.key].xmlrpc_errors | default(item.cfg[item.alt].xmlrpc_errors) }}
|
||||
php_flag[report_memleaks] = {{ item.cfg[item.key].report_memleaks | default(item.cfg[item.alt].report_memleaks) }}
|
||||
php_flag[display_errors] = {{ item.cfg[item.key].display_errors | default(item.cfg[item.alt].display_errors) }}
|
||||
php_flag[display_startup_errors] = {{ item.cfg[item.key].display_startup_errors | default(item.cfg[item.alt].display_startup_errors) }}
|
||||
{# Only available before PHP 7.2 #}
|
||||
{% if php_version == 5.2 or php_version == 5.3 or php_version == 5.4 or php_version == 5.5 or php_version == 5.6 or php_version == 7.0 or php_version == 7.1 %}
|
||||
php_flag[track_errors] = {{ item.cfg[item.key].track_errors | default(item.cfg[item.alt].track_errors) }}
|
||||
{% endif %}
|
||||
php_flag[log_errors] = {{ item.cfg[item.key].log_errors | default(item.cfg[item.alt].log_errors) }}
|
||||
php_flag[html_errors] = {{ item.cfg[item.key].html_errors | default(item.cfg[item.alt].html_errors) }}
|
||||
{% endif %}
|
||||
49
build/ansible/CONFIGURATIONS/php.ini.j2
Normal file
49
build/ansible/CONFIGURATIONS/php.ini.j2
Normal file
@@ -0,0 +1,49 @@
|
||||
; ############################################################
|
||||
; # Devilbox PHP defaults for {{ php_version }}-{{ item.key }}
|
||||
; ############################################################
|
||||
|
||||
; 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 = {{ item.cfg[item.key].memory_limit | default(item.cfg[item.alt].memory_limit) }}
|
||||
|
||||
|
||||
; Timeouts
|
||||
max_execution_time = {{ item.cfg[item.key].max_execution_time | default(item.cfg[item.alt].max_execution_time) }}
|
||||
max_input_time = {{ item.cfg[item.key].max_input_time | default(item.cfg[item.alt].max_input_time) }}
|
||||
|
||||
|
||||
; Uploads
|
||||
; Note: "post_max_size" should be greater than "upload_max_filesize"
|
||||
post_max_size = {{ item.cfg[item.key].post_max_size | default(item.cfg[item.alt].post_max_size) }}
|
||||
upload_max_filesize = {{ item.cfg[item.key].upload_max_filesize | default(item.cfg[item.alt].upload_max_filesize) }}
|
||||
max_file_uploads = {{ item.cfg[item.key].max_file_uploads | default(item.cfg[item.alt].max_file_uploads) }}
|
||||
|
||||
|
||||
; Vars
|
||||
variables_order = {{ item.cfg[item.key].variables_order | default(item.cfg[item.alt].variables_order) }}
|
||||
{# Only available since PHP >=5.4 #}
|
||||
{% if not (php_version == 5.2 or php_version == 5.3 ) %}
|
||||
max_input_vars = {{ item.cfg[item.key].max_input_vars | default(item.cfg[item.alt].max_input_vars) }}
|
||||
{% endif %}
|
||||
max_input_nesting_level = {{ item.cfg[item.key].max_input_nesting_level | default(item.cfg[item.alt].max_input_nesting_level) }}
|
||||
|
||||
|
||||
; Error reporting
|
||||
; Note: error_log is dynamic and handled during start to set appropriate setting
|
||||
error_reporting = {{ item.cfg[item.key].error_reporting | default(item.cfg[item.alt].error_reporting) }}
|
||||
xmlrpc_errors = {{ item.cfg[item.key].xmlrpc_errors | default(item.cfg[item.alt].xmlrpc_errors) }}
|
||||
report_memleaks = {{ item.cfg[item.key].report_memleaks | default(item.cfg[item.alt].report_memleaks) }}
|
||||
display_errors = {{ item.cfg[item.key].display_errors | default(item.cfg[item.alt].display_errors) }}
|
||||
display_startup_errors = {{ item.cfg[item.key].display_startup_errors | default(item.cfg[item.alt].display_startup_errors) }}
|
||||
{# Only available before PHP 7.2 #}
|
||||
{% if php_version == 5.2 or php_version == 5.3 or php_version == 5.4 or php_version == 5.5 or php_version == 5.6 or php_version == 7.0 or php_version == 7.1 %}
|
||||
track_errors = {{ item.cfg[item.key].track_errors | default(item.cfg[item.alt].track_errors) }}
|
||||
{% endif %}
|
||||
log_errors = {{ item.cfg[item.key].log_errors | default(item.cfg[item.alt].log_errors) }}
|
||||
html_errors = {{ item.cfg[item.key].html_errors | default(item.cfg[item.alt].html_errors) }}
|
||||
@@ -1,5 +1,7 @@
|
||||
# Auto-generated via Ansible: edit build/ansible/DOCKERFILES/Dockerfile-base.j2 instead.
|
||||
{% if php_version == 5.3 %}
|
||||
{% if php_version == 5.2 %}
|
||||
FROM devilbox/php-fpm-5.2
|
||||
{% elif php_version == 5.3 %}
|
||||
FROM devilbox/php-fpm-5.3
|
||||
{% elif php_version == 7.3 %}
|
||||
FROM devilbox/php-fpm-7.3
|
||||
@@ -62,14 +64,12 @@ RUN set -x \
|
||||
###
|
||||
### Copy files
|
||||
###
|
||||
COPY ./data/php.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/yyy-devilbox-01-base.ini
|
||||
COPY ./data/php-ini.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/yyy-devilbox.ini
|
||||
COPY ./data/php-fpm.conf/php-fpm-{{ php_version }}.conf /usr/local/etc/php-fpm.conf
|
||||
COPY ./data/php-fpm.d/php-fpm.d-{{ php_version }}.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
|
||||
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
|
||||
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
|
||||
{% if php_version == 5.3 %}
|
||||
COPY ./data/php-fpm.d-docker-5.3.conf /usr/local/etc/php-fpm.d/docker.conf
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if debug %}
|
||||
|
||||
@@ -50,7 +50,6 @@ RUN set -x \
|
||||
###
|
||||
### Copy files
|
||||
###
|
||||
COPY ./data/php.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/yyy-devilbox-03-prod.ini
|
||||
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
|
||||
COPY ./data/postfix.sh /usr/local/sbin/postfix.sh
|
||||
|
||||
@@ -191,13 +191,17 @@ RUN set -x \
|
||||
###
|
||||
### Copy files
|
||||
###
|
||||
COPY ./data/php.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/yyy-devilbox-04-work.ini
|
||||
COPY ./data/php-ini.d/php-{{ php_version }}.ini /usr/local/etc/php/conf.d/yyy-devilbox.ini
|
||||
COPY ./data/php-fpm.conf/php-fpm-{{ php_version }}.conf /usr/local/etc/php-fpm.conf
|
||||
COPY ./data/php-fpm.d/php-fpm.d-{{ php_version }}.conf /usr/local/etc/php-fpm.d/php-fpm.d.conf
|
||||
|
||||
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
COPY ./data/docker-entrypoint.d/*.sh /docker-entrypoint.d/
|
||||
COPY ./data/bash-devilbox /etc/bash-devilbox
|
||||
COPY ./data/sudo-devilbox /etc/sudoers.d/devilbox
|
||||
|
||||
|
||||
|
||||
###
|
||||
### Volumes
|
||||
###
|
||||
|
||||
@@ -1,33 +1,15 @@
|
||||
---
|
||||
|
||||
# All available Docker flavours (for each version)
|
||||
template_files:
|
||||
- src: DOCKERFILES/Dockerfile-base.j2
|
||||
dst: "../../Dockerfiles/base/Dockerfile-{{ php_version }}"
|
||||
- src: DOCKERFILES/Dockerfile-mods.j2
|
||||
dst: "../../Dockerfiles/mods/Dockerfile-{{ php_version }}"
|
||||
- src: DOCKERFILES/Dockerfile-prod.j2
|
||||
dst: "../../Dockerfiles/prod/Dockerfile-{{ php_version }}"
|
||||
- src: DOCKERFILES/Dockerfile-work.j2
|
||||
dst: "../../Dockerfiles/work/Dockerfile-{{ php_version }}"
|
||||
|
||||
# PHP.ini files to apply sane defaults
|
||||
ini_files:
|
||||
- src: CONFIGURATION/php-base.ini.j2
|
||||
dst: "../../Dockerfiles/base/data/php.d/php-{{ php_version }}.ini"
|
||||
- src: CONFIGURATION/php-prod.ini.j2
|
||||
dst: "../../Dockerfiles/prod/data/php.d/php-{{ php_version }}.ini"
|
||||
- src: CONFIGURATION/php-work.ini.j2
|
||||
dst: "../../Dockerfiles/work/data/php.d/php-{{ php_version }}.ini"
|
||||
################################################################################
|
||||
# Variables for rendering Dockerfiles and configuration
|
||||
################################################################################
|
||||
|
||||
|
||||
# Adds self-validating checks to Dockerfile
|
||||
# turn off for final build
|
||||
debug: True
|
||||
|
||||
|
||||
# All available PHP version
|
||||
###
|
||||
### Available PHP versions
|
||||
###
|
||||
php_all_versions:
|
||||
- 5.2
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
@@ -38,6 +20,205 @@ php_all_versions:
|
||||
- 7.3
|
||||
|
||||
|
||||
###
|
||||
### PHP settings equal for php.ini and php-fpm.comf (used below)
|
||||
###
|
||||
php_settings_all:
|
||||
# ---- Settings for PHP.INI and PHP-FPM.CONF ----
|
||||
base:
|
||||
# Timeouts
|
||||
timeout: 180
|
||||
# Error reporting
|
||||
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'
|
||||
|
||||
work:
|
||||
# Timeouts
|
||||
timeout: 180
|
||||
# Error reporting
|
||||
error_reporting: E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED
|
||||
xmlrpc_errors: 'Off'
|
||||
report_memleaks: 'On'
|
||||
display_errors: 'On'
|
||||
display_startup_errors: 'On'
|
||||
track_errors: 'On'
|
||||
log_errors: 'On'
|
||||
html_errors: 'On'
|
||||
|
||||
|
||||
###
|
||||
### PHP.ini
|
||||
###
|
||||
php_settings_ini:
|
||||
# ---- Sane default ----
|
||||
base:
|
||||
# Memory
|
||||
memory_limit: 512M
|
||||
# Timeouts
|
||||
max_execution_time: "{{ php_settings_all.base.timeout }}"
|
||||
max_input_time: "{{ php_settings_all.base.timeout }}"
|
||||
# Uploads
|
||||
post_max_size: 384M
|
||||
upload_max_filesize: 256M
|
||||
max_file_uploads: 20
|
||||
# Variables
|
||||
variables_order: EGPCS
|
||||
max_input_vars: 8000
|
||||
max_input_nesting_level: 64
|
||||
# Error reporting
|
||||
error_reporting: "{{ php_settings_all.base.error_reporting }}"
|
||||
xmlrpc_errors: "{{ php_settings_all.base.xmlrpc_errors }}"
|
||||
report_memleaks: "{{ php_settings_all.base.report_memleaks }}"
|
||||
display_errors: "{{ php_settings_all.base.display_errors }}"
|
||||
display_startup_errors: "{{ php_settings_all.base.display_startup_errors }}"
|
||||
track_errors: "{{ php_settings_all.base.track_errors }}"
|
||||
log_errors: "{{ php_settings_all.base.log_errors }}"
|
||||
html_errors: "{{ php_settings_all.base.html_errors }}"
|
||||
# ---- Inherits from base ----
|
||||
mods:
|
||||
# ---- Inherits from base ----
|
||||
prod:
|
||||
# ---- Inherits from base and overwrites certain values ----
|
||||
work:
|
||||
# Error reporting
|
||||
error_reporting: "{{ php_settings_all.work.error_reporting }}"
|
||||
xmlrpc_errors: "{{ php_settings_all.work.xmlrpc_errors }}"
|
||||
report_memleaks: "{{ php_settings_all.work.report_memleaks }}"
|
||||
display_errors: "{{ php_settings_all.work.display_errors }}"
|
||||
display_startup_errors: "{{ php_settings_all.work.display_startup_errors }}"
|
||||
track_errors: "{{ php_settings_all.work.track_errors }}"
|
||||
log_errors: "{{ php_settings_all.work.log_errors }}"
|
||||
html_errors: "{{ php_settings_all.work.html_errors }}"
|
||||
|
||||
|
||||
###
|
||||
### PHP-FPM.conf
|
||||
###
|
||||
php_settings_fpm:
|
||||
# ---- Sane default ----
|
||||
base:
|
||||
# Docker
|
||||
clear_env: 'no'
|
||||
catch_workers_output: 'yes'
|
||||
# Timeouts
|
||||
request_terminate_timeout: "{{ php_settings_all.work.timeout }}s"
|
||||
# Network
|
||||
listen: 9000
|
||||
listen_backlog: 1023
|
||||
# Logging
|
||||
log_level: notice
|
||||
error_log: /proc/self/fd/2
|
||||
access_log: /proc/self/fd/2
|
||||
# Worker
|
||||
pm: dynamic
|
||||
pm_max_children: 50
|
||||
pm_start_servers: 10
|
||||
pm_min_spare_servers: 5
|
||||
pm_max_spare_servers: 15
|
||||
pm_max_requests: 500
|
||||
# User/Group
|
||||
user: devilbox
|
||||
group: devilbox
|
||||
# Error reporting
|
||||
error_reporting: "{{ php_settings_all.base.error_reporting }}"
|
||||
xmlrpc_errors: "{{ php_settings_all.base.xmlrpc_errors }}"
|
||||
report_memleaks: "{{ php_settings_all.base.report_memleaks }}"
|
||||
display_errors: "{{ php_settings_all.base.display_errors }}"
|
||||
display_startup_errors: "{{ php_settings_all.base.display_startup_errors }}"
|
||||
track_errors: "{{ php_settings_all.base.track_errors }}"
|
||||
log_errors: "{{ php_settings_all.base.log_errors }}"
|
||||
html_errors: "{{ php_settings_all.base.html_errors }}"
|
||||
# ---- Inherits from base ----
|
||||
mods:
|
||||
# ---- Inherits from base ----
|
||||
prod:
|
||||
# ---- Inherits from base and overwrites certain values ----
|
||||
work:
|
||||
# Error reporting
|
||||
error_reporting: "{{ php_settings_all.work.error_reporting }}"
|
||||
xmlrpc_errors: "{{ php_settings_all.work.xmlrpc_errors }}"
|
||||
report_memleaks: "{{ php_settings_all.work.report_memleaks }}"
|
||||
display_errors: "{{ php_settings_all.work.display_errors }}"
|
||||
display_startup_errors: "{{ php_settings_all.work.display_startup_errors }}"
|
||||
track_errors: "{{ php_settings_all.work.track_errors }}"
|
||||
log_errors: "{{ php_settings_all.work.log_errors }}"
|
||||
html_errors: "{{ php_settings_all.work.html_errors }}"
|
||||
|
||||
|
||||
###
|
||||
### Templates for PHP flavours (base, mods, prod and work) for all PHP versions
|
||||
###
|
||||
|
||||
# Dockerfiles for base, mods, prod and work
|
||||
template_dockerfiles:
|
||||
- src: DOCKERFILES/Dockerfile-base.j2
|
||||
dst: "../../Dockerfiles/base/Dockerfile-{{ php_version }}"
|
||||
- src: DOCKERFILES/Dockerfile-mods.j2
|
||||
dst: "../../Dockerfiles/mods/Dockerfile-{{ php_version }}"
|
||||
- src: DOCKERFILES/Dockerfile-prod.j2
|
||||
dst: "../../Dockerfiles/prod/Dockerfile-{{ php_version }}"
|
||||
- src: DOCKERFILES/Dockerfile-work.j2
|
||||
dst: "../../Dockerfiles/work/Dockerfile-{{ php_version }}"
|
||||
|
||||
# Configuration files for base, mods, prod and work
|
||||
template_configurations:
|
||||
# php.ini
|
||||
- src: CONFIGURATIONS/php.ini.j2
|
||||
dst: "../../Dockerfiles/base/data/php-ini.d/php-{{ php_version }}.ini"
|
||||
cfg: "{{ php_settings_ini }}"
|
||||
key: base
|
||||
alt: base
|
||||
- src: CONFIGURATIONS/php.ini.j2
|
||||
dst: "../../Dockerfiles/work/data/php-ini.d/php-{{ php_version }}.ini"
|
||||
cfg: "{{ php_settings_ini }}"
|
||||
key: work
|
||||
alt: base # Alternative key to use when definition is not set in 'work'
|
||||
|
||||
# php-fpm.conf
|
||||
- src: CONFIGURATIONS/php-fpm.conf.j2
|
||||
dst: "../../Dockerfiles/base/data/php-fpm.conf/php-fpm-{{ php_version }}.conf"
|
||||
cfg: "{{ php_settings_fpm }}"
|
||||
key: base
|
||||
alt: base
|
||||
- src: CONFIGURATIONS/php-fpm.conf.j2
|
||||
dst: "../../Dockerfiles/work/data/php-fpm.conf/php-fpm-{{ php_version }}.conf"
|
||||
cfg: "{{ php_settings_fpm }}"
|
||||
key: work
|
||||
alt: base
|
||||
|
||||
# php-fpm.d-conf
|
||||
- src: CONFIGURATIONS/php-fpm.d-conf.j2
|
||||
dst: "../../Dockerfiles/base/data/php-fpm.d/php-fpm.d-{{ php_version }}.conf"
|
||||
cfg: "{{ php_settings_fpm }}"
|
||||
key: base
|
||||
alt: base
|
||||
- src: CONFIGURATIONS/php-fpm.d-conf.j2
|
||||
dst: "../../Dockerfiles/work/data/php-fpm.d/php-fpm.d-{{ php_version }}.conf"
|
||||
cfg: "{{ php_settings_fpm }}"
|
||||
key: work
|
||||
alt: base
|
||||
|
||||
# php-fpm.conf (only applied to base and fully inherited)
|
||||
#
|
||||
# # php-fpm.d/php-fpm.d.conf (only applied to base and full inherited)
|
||||
# - src: CONFIGURATIONS/php-fpm.d/php-fpm-base.d.conf.j2
|
||||
# dst: "../../Dockerfiles/base/data/php-fpm.d/php-fpm.d-{{ php_version }}.conf"
|
||||
|
||||
|
||||
###
|
||||
### Variables to be used in this file (group_vars/all.yml)
|
||||
###
|
||||
|
||||
# Adds self-validating checks to Dockerfile
|
||||
# turn off for final build
|
||||
debug: True
|
||||
|
||||
# Global variables
|
||||
compose_home: /usr/local/src/composer
|
||||
|
||||
@@ -92,7 +273,6 @@ software_enabled:
|
||||
- cleanup
|
||||
|
||||
|
||||
|
||||
###
|
||||
### All available extra repositories
|
||||
###
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
---
|
||||
|
||||
- name: render template
|
||||
- name: generate Dockerfiles
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dst }}"
|
||||
force: True
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ template_files }}"
|
||||
- "{{ template_dockerfiles }}"
|
||||
|
||||
- name: copy php.ini configuration
|
||||
- name: generate php configuration files
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dst }}"
|
||||
force: True
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ ini_files }}"
|
||||
- "{{ template_configurations }}"
|
||||
|
||||
Reference in New Issue
Block a user