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

Add templating for status and ping pages #92

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ override_attributes "php-fpm" => {
## Create PHP-FPM pool named 'www' with default settings:

```ruby
php_fpm_pool "www"
php_fpm_fpm_pool "www"
```

## Create PHP-FPM pool named 'www' with custom settings:

```ruby
php_fpm_pool "www" do
php_fpm_fpm_pool "www" do
cookbook "another-cookbook" # get template from another cookbook
process_manager "dynamic"
max_requests 5000
Expand All @@ -74,7 +74,7 @@ end
## Delete PHP-FPM pool named 'www':

```ruby
php_fpm_pool "www" do
php_fpm_fpm_pool "www" do
enable false
end
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Cookbook Name:: php-fpm
# Definition:: php_fpm_pool
# Definition:: php_fpm_fpm_pool
#
# Copyright 2008-2017, Chef Software, Inc.
#
Expand All @@ -17,7 +17,7 @@
# limitations under the License.
#

define :php_fpm_pool, template: 'pool.conf.erb', enable: true do
define :php_fpm_fpm_pool, template: 'pool.conf.erb', enable: true do
pool_name = params[:name]

conf_file = "#{node['php-fpm']['pool_conf_dir']}/#{pool_name}.conf"
Expand Down Expand Up @@ -52,6 +52,8 @@
request_slowlog_timeout: params[:request_slowlog_timeout] || false,
php_options: params[:php_options] || {},
request_terminate_timeout: params[:request_terminate_timeout] || node['php-fpm']['request_terminate_timeout'],
status_path: params[:status_path],
ping_path: params[:ping_path],
params: params
)
notifies :restart, 'service[php-fpm]'
Expand Down
2 changes: 1 addition & 1 deletion recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
else
pool_name = pool[:name]
end
php_fpm_pool pool_name do
php_fpm_fpm_pool pool_name do
pool.each do |k, v|
params[k.to_sym] = v
end
Expand Down
8 changes: 8 additions & 0 deletions templates/pool.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ pm.max_requests = <%= @max_requests %>
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
<% if @status_path %>
pm.status_path = <%= @status_path %>
<% else %>
;pm.status_path = /status
<% end %>

; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
Expand All @@ -248,7 +252,11 @@ pm.max_requests = <%= @max_requests %>
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
<% if @ping_path %>
ping.path = <%= @ping_path %>
<% else %>
;ping.path = /ping
<% end %>

; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
Expand Down