Skip to content

Commit

Permalink
Allow setting different PHP-FPM params in environment config
Browse files Browse the repository at this point in the history
  • Loading branch information
gutobenn committed Aug 16, 2024
1 parent c1f1162 commit c805499
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 7 additions & 5 deletions roles/wordpress-setup/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ robots_tag_header: "{{ item.value.robots_tag_header | default({}) }}"
robots_tag_header_enabled: "{{ robots_tag_header.enabled | default(not_prod) }}"

# PHP FPM
php_fpm_pm_max_children: 10
php_fpm_pm_start_servers: 1
php_fpm_pm_min_spare_servers: 1
php_fpm_pm_max_spare_servers: 3
php_fpm_pm_max_requests: 500
php_fpm: "{{ item.value.php_fpm | default({}) }}"
php_fpm_pm: "{{ php_fpm.pm | default('dynamic') }}"
php_fpm_pm_max_children: "{{ php_fpm.pm_max_children | default(10) }}"
php_fpm_pm_start_servers: "{{ php_fpm.pm_start_servers | default(1) }}"
php_fpm_pm_min_spare_servers: "{{ php_fpm.pm_min_spare_servers | default(1) }}"
php_fpm_pm_max_spare_servers: "{{ php_fpm.pm_max_spare_servers | default(3) }}"
php_fpm_pm_max_requests: "{{ php_fpm.pm_max_requests | default(500) }}"
3 changes: 3 additions & 0 deletions roles/wordpress-setup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
dest: /etc/php/{{ php_version }}/fpm/pool.d/wordpress.conf
mode: '0644'
notify: reload php-fpm
loop: "{{ wordpress_sites | dict2items }}"
loop_control:
label: "{{ item.key }}"

- name: Disable default PHP-FPM pool
command: mv /etc/php/{{ php_version }}/fpm/pool.d/www.conf /etc/php/{{ php_version }}/fpm/pool.d/www.disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ listen.owner = www-data
listen.group = www-data
user = {{ web_user }}
group = {{ web_group }}
pm = dynamic
pm = {{ php_fpm_pm }}
pm.max_children = {{ php_fpm_pm_max_children }}
pm.start_servers = {{ php_fpm_pm_start_servers }}
pm.min_spare_servers = {{ php_fpm_pm_min_spare_servers }}
Expand Down

0 comments on commit c805499

Please sign in to comment.