You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/06/09 02:14:32 UTC

[apisix] branch master updated: chore: require http_stub_status_module exists (#7208)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d08d6bb4 chore: require http_stub_status_module exists (#7208)
3d08d6bb4 is described below

commit 3d08d6bb4e9baab40e31f72497d44f9da20db2f9
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Thu Jun 9 10:14:24 2022 +0800

    chore: require http_stub_status_module exists (#7208)
    
    The http_stub_status_module is required in fact, as:
    1. missing this module will generate "failed to fetch Nginx status" error:
    https://github.com/apache/apisix/blob/a99eb64f23737a8796606f48b851e27be52a3e6e/apisix/plugins/prometheus/exporter.lua#L245
    2. both OpenResty and APISIX-Base already contains this module
    
    Therefore I decide to remove the additional check to make code simpler.
    
    Signed-off-by: spacewander <sp...@gmail.com>
---
 apisix/cli/ngx_tpl.lua | 6 ------
 apisix/cli/ops.lua     | 8 ++------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 4709362e5..cf8c08b38 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -82,13 +82,11 @@ http {
             }
         }
 
-        {% if with_module_status then %}
         location = /apisix/nginx_status {
             allow 127.0.0.0/24;
             deny all;
             stub_status;
         }
-        {% end %}
     }
 }
 {% end %}
@@ -503,13 +501,11 @@ http {
             }
         }
 
-        {% if with_module_status then %}
         location = /apisix/nginx_status {
             allow 127.0.0.0/24;
             deny all;
             stub_status;
         }
-        {% end %}
     }
     {% end %}
 
@@ -618,14 +614,12 @@ http {
         {% end %}
         # http server configuration snippet ends
 
-        {% if with_module_status then %}
         location = /apisix/nginx_status {
             allow 127.0.0.0/24;
             deny all;
             access_log off;
             stub_status;
         }
-        {% end %}
 
         {% if enable_admin and not admin_server_addr then %}
         location /apisix/admin {
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 937d74106..0be0701f6 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -244,12 +244,9 @@ Please modify "admin_key" in conf/config.yaml .
     end
 
     local or_info = util.execute_cmd("openresty -V 2>&1")
-    local with_module_status = true
     if or_info and not or_info:find("http_stub_status_module", 1, true) then
-        stderr:write("'http_stub_status_module' module is missing in ",
-                     "your openresty, please check it out. Without this ",
-                     "module, there will be fewer monitoring indicators.\n")
-        with_module_status = false
+        util.die("'http_stub_status_module' module is missing in ",
+                 "your openresty, please check it out.\n")
     end
 
     local use_apisix_openresty = true
@@ -548,7 +545,6 @@ Please modify "admin_key" in conf/config.yaml .
         lua_cpath = env.pkg_cpath_org,
         os_name = util.trim(util.execute_cmd("uname")),
         apisix_lua_home = env.apisix_home,
-        with_module_status = with_module_status,
         use_apisix_openresty = use_apisix_openresty,
         error_log = {level = "warn"},
         enable_http = enable_http,