Skip to content

Commit

Permalink
feat(docker): tweak PHP-FPM process manager values (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLicense committed Aug 27, 2024
1 parent 7e9ffb8 commit f9e9916
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 0 deletions.
3 changes: 3 additions & 0 deletions infra/docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ RUN apk add --no-cache libreoffice cups-client poppler-utils
# PHP config file
COPY ./php.ini ${PHP_INI_DIR}/conf.d/zzzz-php.ini

# PHP-FPM config file
COPY php-fpm.conf /usr/local/etc/php-fpm.d/zzzz-www.conf

# nginx server config file
COPY api.conf /etc/nginx/conf.d/api.conf

Expand Down
29 changes: 29 additions & 0 deletions infra/docker/api/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; The access log file.
; Default value: not set
access.log = /dev/null

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 40

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: (min_spare_servers + max_spare_servers) / 2
pm.start_servers = 4

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 2

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 4
3 changes: 3 additions & 0 deletions infra/docker/cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ RUN apk add --no-cache icu-dev \
# PHP config file
COPY ./php.ini ${PHP_INI_DIR}/conf.d/zzzz-php.ini

# PHP-FPM config file
COPY php-fpm.conf /usr/local/etc/php-fpm.d/zzzz-www.conf

EXPOSE 8080

FROM cli AS production
Expand Down
29 changes: 29 additions & 0 deletions infra/docker/cli/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; The access log file.
; Default value: not set
access.log = /dev/null

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 40

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: (min_spare_servers + max_spare_servers) / 2
pm.start_servers = 4

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 2

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 4
3 changes: 3 additions & 0 deletions infra/docker/internal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ COPY /clamav/supervisord.conf /etc/supervisor/conf.d/clamd.conf
# PHP config file
COPY ./php.ini ${PHP_INI_DIR}/conf.d/zzzz-php.ini

# PHP-FPM config file
COPY php-fpm.conf /usr/local/etc/php-fpm.d/zzzz-www.conf

# nginx server config file
COPY internal.conf /etc/nginx/conf.d/internal.conf

Expand Down
29 changes: 29 additions & 0 deletions infra/docker/internal/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; The access log file.
; Default value: not set
access.log = /dev/null

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 40

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: (min_spare_servers + max_spare_servers) / 2
pm.start_servers = 4

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 2

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 4
3 changes: 3 additions & 0 deletions infra/docker/selfserve/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ COPY /clamav/supervisord.conf /etc/supervisor/conf.d/clamd.conf
# PHP config file
COPY ./php.ini ${PHP_INI_DIR}/conf.d/zzzz-php.ini

# PHP-FPM config file
COPY php-fpm.conf /usr/local/etc/php-fpm.d/zzzz-www.conf

# nginx server config file
COPY selfserve.conf /etc/nginx/conf.d/selfserve.conf

Expand Down
29 changes: 29 additions & 0 deletions infra/docker/selfserve/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; The access log file.
; Default value: not set
access.log = /dev/null

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 40

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: (min_spare_servers + max_spare_servers) / 2
pm.start_servers = 4

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 2

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 4

0 comments on commit f9e9916

Please sign in to comment.