You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/php_fpm_pool.md
+48-6Lines changed: 48 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,10 +30,52 @@ More info: <https://www.php.net/manual/en/install.fpm.php>
30
30
31
31
## Examples
32
32
33
-
Install a FPM pool named 'default'
33
+
1.Install a FPM pool named 'default'
34
34
35
-
```ruby
36
-
php_fpm_pool 'default'do
37
-
action :install
38
-
end
39
-
```
35
+
```ruby
36
+
php_fpm_pool 'default'do
37
+
action :install
38
+
end
39
+
```
40
+
41
+
2. Multiple FPM Pools
42
+
Changes in configuration during provisioning of an FPM pool will lead to a restart of the `phpX.Y-fpm` service.
43
+
If more than `5` FPM pools are affected by a configuration change, this will lead to subsequent `5+` service restarts.
44
+
However, `systemd` will deny this number of subsequent service restarts with the following error:
45
+
46
+
```bash
47
+
php8.1-fpm.service: Start request repeated too quickly.
48
+
php8.1-fpm.service: Failed with result 'start-limit-hit'.
49
+
Failed to start The PHP 8.1 FastCGI Process Manager.
50
+
```
51
+
52
+
This behavior is due to the `unified_mode true` setting of an `fpm_pool` custom resource, which is a [default setting](https://docs.chef.io/deprecations_unified_mode/) for `chef-clients v18+`. In this mode, notifications set as `:delayed` within a custom resource action (like `action :install`) are queued to be processed once the action completes (i.e., at the end of the resource `action :install` block), rather than waiting until the end of the Chef client run.
53
+
54
+
**Possible Workaround**
55
+
56
+
In a wrapper cookbook, define a `ruby_block` with a call to the `sleep(X)` function, which will be called upon an `fpm_pool` resource update:
57
+
58
+
```ruby
59
+
# frozen_string_literal: true
60
+
#
61
+
# Cookbook:: my_php
62
+
# Recipe:: fpm
63
+
64
+
ruby_block "wait after_service restart"do
65
+
block do
66
+
Chef::Log.info("Waiting 5 seconds after php-fpm service restart...")
67
+
sleep(5)
68
+
end
69
+
action :nothing
70
+
end
71
+
72
+
# Fancy loop on all defined pools for this node
73
+
node['php']['fpm_pool'].each do |pool_name, parameters|
0 commit comments