Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opcache vars pr 1.x #860

Open
wants to merge 31 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2ec1181
Supporting opcache variables for PHP-FPM and CLI.
gregharvey Nov 14, 2022
2ae2f54
Merge branch '1.x' into opcache_vars
gregharvey Nov 17, 2022
eddc7db
Proper support for PHP-FPM and unix sockets.
gregharvey Nov 17, 2022
e7e3e6b
Merge branch '1.x' into opcache_vars-PR-1.x
gregharvey Nov 17, 2022
60adc1d
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Nov 17, 2022
a6725e9
Removing recursive ownership from AWS EFS mount point check.
gregharvey Nov 17, 2022
9372471
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Nov 17, 2022
80d3700
Adding some unix sock documentation to pool_group for PHP-FPM.
gregharvey Nov 18, 2022
ff818e1
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Nov 18, 2022
338554b
Merging feature branch changes.
gregharvey Feb 16, 2023
d9da903
Merge branch '1.x' into opcache_vars
gregharvey Apr 14, 2023
7b7fc79
Merge branch '1.x' into opcache_vars-PR-1.x
gregharvey Apr 14, 2023
cf2b80e
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Apr 14, 2023
f58aa8e
Merge branch '1.x' into opcache_vars
gregharvey Apr 14, 2023
8bb27bf
Merge branch '1.x' into opcache_vars-PR-1.x
gregharvey Apr 14, 2023
5ac66e4
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Apr 14, 2023
d4e1f7a
Merge branch '1.x' into opcache_vars
gregharvey Apr 14, 2023
0316984
Merge branch '1.x' into opcache_vars-PR-1.x
gregharvey Apr 14, 2023
b380d9f
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Apr 14, 2023
743da73
Merge branch '1.x' into opcache_vars
gregharvey Apr 25, 2023
d99d70f
Merging 1.x.
gregharvey Dec 12, 2023
af6956d
Allowing users to specify port.
gregharvey Dec 12, 2023
be28544
Merging 1.x.
gregharvey Dec 12, 2023
36485c0
Merging feature branch.
gregharvey Dec 12, 2023
bcb98fa
Merge branch '1.x' into opcache_vars
gregharvey Dec 18, 2023
c9ca0f9
Adding a line break to try to resolve strange template issue.!
gregharvey Dec 18, 2023
cb01056
Merge branch '1.x' into opcache_vars-PR-1.x
gregharvey Dec 18, 2023
4ce05c4
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Dec 18, 2023
1a77169
Removing bizarre duplication of task.
gregharvey Dec 18, 2023
6e6df14
Merge branch 'opcache_vars' into opcache_vars-PR-1.x
gregharvey Dec 18, 2023
287f5ba
Adding services back in.
gregharvey Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions roles/nginx/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ nginx:
# Group prefix. Useful for grouping by environments.
log_group_prefix: ""
# Main log stream for nginx (Cloudwatch).
log_stream_name: example
# We can only have one backend, due to the way we use "common" templates.
# Moving this per domain means instead having templates per project type.
php_fastcgi_backend: "127.0.0.1:90{{ php.version[-1] | replace('.','') }}"
log_stream_name: example # We can only have one backend, due to the way we use "common" templates, moving this per domain means instead having templates per project type.
# See php.fpm.unix_socket, if true use a socket here:
php_fastcgi_backend: "127.0.0.1:90{{ php.version[-1] | replace('.','') }}" # for unix socket use "unix:/var/run/php{{ php.version[-1] | replace('.','') }}-fpm.sock"
ratelimitingcrawlers: false
client_max_body_size: "700M"
fastcgi_read_timeout: 60
Expand Down
5 changes: 4 additions & 1 deletion roles/php-fpm/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
php:
# see php-common for default version
fpm:
unix_socket: false # set to true to use a unix socket, you must also update nginx and cachetool if you do
tcp_port: "" # leave empty to automate port selection - port will be "90{{ version | replace('.','') }}" - e.g. 9081 for PHP 8.1
expose_php: "{% if _env_type == 'prod' %}Off{% else %}On{% endif %}"
error_reporting: "{% if _env_type == 'prod' %}E_ALL & ~E_DEPRECATED & ~E_STRICT{% else %}E_ALL{% endif %}"
display_errors: "{% if _env_type == 'prod' %}Off{% else %}On{% endif %}"
Expand All @@ -21,7 +24,7 @@ php:
max_file_uploads: 20
date_timezone: "Europe/London"
pool_user: "{{ user_deploy.username }}"
pool_group: "{{ user_deploy.username }}"
pool_group: "{{ user_deploy.username }}" # if using unix socket this should be the web server user
default_socket_timeout: 60
max_children: 5
start_servers: 2
Expand Down
10 changes: 9 additions & 1 deletion roles/php-fpm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@
loop_control:
loop_var: version

- name: Copy default pool configuration.
- name: Copy default pool configuration for a single, fixed port PHP version.
ansible.builtin.template:
dest: "/etc/php/{{ php.version[0] }}/fpm/pool.d/www.conf"
src: "www.conf-fixedport.j2"
mode: 0555
when: php.fpm.tcp_port | length > 0

- name: Copy default pool configuration for dynamic PHP versioning.
ansible.builtin.template:
dest: "/etc/php/{{ version }}/fpm/pool.d/www.conf"
src: "www.conf.j2"
mode: 0555
with_items: "{{ php.version }}"
when: php.fpm.tcp_port | length == 0
loop_control:
loop_var: version

Expand Down
13 changes: 13 additions & 0 deletions roles/php-fpm/templates/www.conf-fixedport.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[www]
user = {{ php.fpm.pool_user }}
group = {{ php.fpm.pool_group }}
listen = 127.0.0.1:{{ php.fpm.tcp_port }}
listen.owner = {{ php.fpm.pool_user }}
listen.group = {{ php.fpm.pool_group }}
pm = dynamic
pm.max_children = {{ php.fpm.max_children }}
pm.start_servers = {{ php.fpm.start_servers }}
pm.min_spare_servers = {{ php.fpm.min_spare_servers }}
pm.max_spare_servers = {{ php.fpm.max_spare_servers }}
pm.process_idle_timeout = {{ php.fpm.process_idle_timeout }}
pm.max_requests = {{ php.fpm.max_requests }}
5 changes: 3 additions & 2 deletions roles/php-fpm/templates/www.conf.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[www]
user = {{ php.fpm.pool_user }}
group = {{ php.fpm.pool_group }}
listen = 127.0.0.1:90{{ version | replace('.','') }}
listen = {% if php.fpm.unix_socket %}'/var/run/php{{ version | replace('.','') }}-fpm.sock'{% else %}127.0.0.1:90{{ version | replace('.','') }}{% endif %}

listen.owner = {{ php.fpm.pool_user }}
listen.group = {{ php.fpm.pool_group }}
pm = dynamic
Expand All @@ -10,4 +11,4 @@ pm.start_servers = {{ php.fpm.start_servers }}
pm.min_spare_servers = {{ php.fpm.min_spare_servers }}
pm.max_spare_servers = {{ php.fpm.max_spare_servers }}
pm.process_idle_timeout = {{ php.fpm.process_idle_timeout }}
pm.max_requests = {{ php.fpm.max_requests }}
pm.max_requests = {{ php.fpm.max_requests }}
Loading