From c2b3c77932fdf813ae961437ae3fb77ab7390dff Mon Sep 17 00:00:00 2001 From: Akos Vandra Date: Wed, 15 Jan 2020 15:34:51 +0100 Subject: [PATCH 1/3] add status and ping path config option --- definitions/php_fpm_pool.rb | 2 ++ templates/pool.conf.erb | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/definitions/php_fpm_pool.rb b/definitions/php_fpm_pool.rb index 12fc383..27ed004 100644 --- a/definitions/php_fpm_pool.rb +++ b/definitions/php_fpm_pool.rb @@ -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]' diff --git a/templates/pool.conf.erb b/templates/pool.conf.erb index ec4fbf3..643e48d 100644 --- a/templates/pool.conf.erb +++ b/templates/pool.conf.erb @@ -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 @@ -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. From 49770b974456e8d49137cdcb25478a3e49f39aac Mon Sep 17 00:00:00 2001 From: Akos Vandra Date: Sun, 19 Jan 2020 07:00:03 +0100 Subject: [PATCH 2/3] fix ping path --- templates/pool.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/pool.conf.erb b/templates/pool.conf.erb index 643e48d..f4186f2 100644 --- a/templates/pool.conf.erb +++ b/templates/pool.conf.erb @@ -253,7 +253,7 @@ pm.status_path = <%= @status_path %> ; may conflict with a real PHP file. ; Default Value: not set <% if @ping_path %> -ping_path = <%= @ping_path %> +ping.path = <%= @ping_path %> <% else %> ;ping.path = /ping <% end %> From 5f6694e1febedf4772148390f87fda3a08fa1afa Mon Sep 17 00:00:00 2001 From: Akos Vandra Date: Wed, 29 Jan 2020 23:02:48 +0100 Subject: [PATCH 3/3] fix name collision with php cookbook --- README.md | 6 +++--- definitions/{php_fpm_pool.rb => php_fpm_fpm_pool.rb} | 4 ++-- recipes/configure.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename definitions/{php_fpm_pool.rb => php_fpm_fpm_pool.rb} (96%) diff --git a/README.md b/README.md index a503473..ac81a30 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 ``` diff --git a/definitions/php_fpm_pool.rb b/definitions/php_fpm_fpm_pool.rb similarity index 96% rename from definitions/php_fpm_pool.rb rename to definitions/php_fpm_fpm_pool.rb index 27ed004..2b6cea4 100644 --- a/definitions/php_fpm_pool.rb +++ b/definitions/php_fpm_fpm_pool.rb @@ -1,6 +1,6 @@ # # Cookbook Name:: php-fpm -# Definition:: php_fpm_pool +# Definition:: php_fpm_fpm_pool # # Copyright 2008-2017, Chef Software, Inc. # @@ -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" diff --git a/recipes/configure.rb b/recipes/configure.rb index 26bfb8d..880a358 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -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