[GitHub] [incubator-apisix] qiujiayu commented on a change in pull request #1167: feature: auto import nameservers into APISIX from system resolv file.…

2020-02-26 Thread GitBox
qiujiayu commented on a change in pull request #1167: feature: auto import 
nameservers into APISIX from system resolv file.…
URL: https://github.com/apache/incubator-apisix/pull/1167#discussion_r384908035
 
 

 ##
 File path: bin/apisix
 ##
 @@ -525,6 +530,25 @@ local function check_or_version(cur_ver_s, need_ver_s)
 return true
 end
 
+
+local function system_dns_resolver()
+local file, err = io.open("/etc/resolv.conf")
+if err then
+return nil, err
+else
+local lines = file:lines()
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] qiujiayu commented on a change in pull request #1167: feature: auto import nameservers into APISIX from system resolv file.…

2020-02-26 Thread GitBox
qiujiayu commented on a change in pull request #1167: feature: auto import 
nameservers into APISIX from system resolv file.…
URL: https://github.com/apache/incubator-apisix/pull/1167#discussion_r384908050
 
 

 ##
 File path: bin/apisix
 ##
 @@ -236,7 +236,12 @@ http {
 init_by_lua_block {
 require "resty.core"
 apisix = require("apisix")
-apisix.http_init()
+local args = {}
+
+local dns_resolver = { {% for _, dns_addr in ipairs(dns_resolver or 
{}) do %} "{*dns_addr*}", {% end %} }
+args["dns_resolver"] = dns_resolver
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-apisix] branch master updated: bugfix: removed unwanted quotes. (#1158)

2020-02-26 Thread wenming
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 3176a07  bugfix: removed unwanted quotes. (#1158)
3176a07 is described below

commit 3176a0786201d7929199bc6e282f2358d46b8f18
Author: YuanSheng Wang 
AuthorDate: Thu Feb 27 08:45:34 2020 +0800

bugfix: removed unwanted quotes. (#1158)
---
 Makefile | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index f294efa..6083288 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ ifeq ("$(wildcard /usr/local/openresty-debug/bin/openresty)", 
"")
 endif
 endif
 
-LUTJIT_DIR ?= $(shell ${OR_EXEC} -V 2>&1 | grep prefix | grep -Eo 
'prefix=(.*?)/nginx' | grep -Eo '/.*/')luajit
+LUAJIT_DIR ?= $(shell ${OR_EXEC} -V 2>&1 | grep prefix | grep -Eo 
'prefix=(.*?)/nginx' | grep -Eo '/.*/')luajit
 
 ### help: Show Makefile rules.
 .PHONY: help
@@ -48,11 +48,11 @@ help: default
 .PHONY: deps
 deps: default
 ifeq ($(UNAME),Darwin)
-   luarocks install --lua-dir=$(LUTJIT_DIR) 
rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
-else ifneq ($(LUAROCKS_VER),'luarocks 3.')
-   luarocks install rockspec/apisix-master-0.rockspec --tree=deps 
--only-deps --local
+   luarocks install --lua-dir=$(LUAJIT_DIR) 
rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
+else ifeq ($(LUAROCKS_VER),luarocks 3.)
+   luarocks install --lua-dir=$(LUAJIT_DIR) 
rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
 else
-   luarocks install --lua-dir=/usr/local/openresty/luajit 
rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local
+   luarocks install rockspec/apisix-master-0.rockspec --tree=deps 
--only-deps --local
 endif
 
 



[GitHub] [incubator-apisix] moonming merged pull request #1158: bugfix(makefile): removed unwanted quotes.

2020-02-26 Thread GitBox
moonming merged pull request #1158: bugfix(makefile): removed unwanted quotes.
URL: https://github.com/apache/incubator-apisix/pull/1158
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] membphis commented on issue #1167: feature: auto import nameservers into APISIX from system resolv file.…

2020-02-26 Thread GitBox
membphis commented on issue #1167: feature: auto import nameservers into APISIX 
from system resolv file.…
URL: https://github.com/apache/incubator-apisix/pull/1167#issuecomment-591479787
 
 
   for the test case, we can use this way: 
   
   
https://github.com/apache/incubator-apisix/blob/master/.travis/apisix_cli_test.sh


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] membphis commented on a change in pull request #1167: feature: auto import nameservers into APISIX from system resolv file.…

2020-02-26 Thread GitBox
membphis commented on a change in pull request #1167: feature: auto import 
nameservers into APISIX from system resolv file.…
URL: https://github.com/apache/incubator-apisix/pull/1167#discussion_r384556438
 
 

 ##
 File path: bin/apisix
 ##
 @@ -525,6 +530,25 @@ local function check_or_version(cur_ver_s, need_ver_s)
 return true
 end
 
+
+local function system_dns_resolver()
+local file, err = io.open("/etc/resolv.conf")
+if err then
+return nil, err
+else
+local lines = file:lines()
 
 Review comment:
   better style:
   
   ```
   local file = io.open("xx.xxx")
   for line in file:lines() do
   print(line) -- 这里就是每次取一行
   end
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] membphis commented on a change in pull request #1167: feature: auto import nameservers into APISIX from system resolv file.…

2020-02-26 Thread GitBox
membphis commented on a change in pull request #1167: feature: auto import 
nameservers into APISIX from system resolv file.…
URL: https://github.com/apache/incubator-apisix/pull/1167#discussion_r384554864
 
 

 ##
 File path: bin/apisix
 ##
 @@ -236,7 +236,12 @@ http {
 init_by_lua_block {
 require "resty.core"
 apisix = require("apisix")
-apisix.http_init()
+local args = {}
+
+local dns_resolver = { {% for _, dns_addr in ipairs(dns_resolver or 
{}) do %} "{*dns_addr*}", {% end %} }
+args["dns_resolver"] = dns_resolver
 
 Review comment:
   this style is better.
   
   ```
   local args = {
   dns_resolver = dns_resolver
   }
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] qiujiayu opened a new pull request #1167: feature: auto import nameservers into APISIX from system resolv file.…

2020-02-26 Thread GitBox
qiujiayu opened a new pull request #1167: feature: auto import nameservers into 
APISIX from system resolv file.…
URL: https://github.com/apache/incubator-apisix/pull/1167
 
 
   … #1164
   
   ### Summary
   
   auto import system DNS resolver
   
   ### Issues resolved
   
   Fix #1164
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] agile6v edited a comment on issue #1153: feature: support for proxy caching plugin based on disk.

2020-02-26 Thread GitBox
agile6v edited a comment on issue #1153: feature: support for proxy caching 
plugin based on disk.
URL: https://github.com/apache/incubator-apisix/pull/1153#issuecomment-591469470
 
 
   Hi @moonming 
   
   Tests cases I think the t/servroot/conf/nginx.conf file should be modified.
   
   In recent days, i have been preparing to make a presentation. So I'm gonna 
add tests in this weekend. 
   And are there any other problems with code implementation? 
   Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] agile6v commented on issue #1153: feature: support for proxy caching plugin based on disk.

2020-02-26 Thread GitBox
agile6v commented on issue #1153: feature: support for proxy caching plugin 
based on disk.
URL: https://github.com/apache/incubator-apisix/pull/1153#issuecomment-591469470
 
 
   Hi 
   
   Tests cases I think the t/servroot/conf/nginx.conf file should be modified.
   
   In recent days, i have been preparing to make a presentation. So I'm gonna 
add tests in this weekend. 
   And are there any other problems with code implementation? 
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] membphis opened a new pull request #1166: bugfix(prometheus): the balancer IP may be nil, use an empty string i…

2020-02-26 Thread GitBox
membphis opened a new pull request #1166: bugfix(prometheus): the balancer IP 
may be nil, use an empty string i…
URL: https://github.com/apache/incubator-apisix/pull/1166
 
 
   …nstead.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-apisix] branch master updated: test: exported ENV{APISIX_HOME}, allow user to define the working path by himself. (#1160)

2020-02-26 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 6cca341  test: exported ENV{APISIX_HOME}, allow user to define the 
working path by himself. (#1160)
6cca341 is described below

commit 6cca341b7f11f85d543490068caac30b703c3efb
Author: YuanSheng Wang 
AuthorDate: Wed Feb 26 21:26:01 2020 +0800

test: exported ENV{APISIX_HOME}, allow user to define the working path by 
himself. (#1160)

* change: enable Lua code coverage.
---
 t/APISIX.pm  | 26 +-
 t/lib/test_admin.lua | 28 
 2 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/t/APISIX.pm b/t/APISIX.pm
index f7887ab..f15b367 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -26,15 +26,15 @@ no_long_string();
 no_shuffle();
 worker_connections(128);
 
-my $pwd = cwd();
+my $apisix_home = $ENV{APISIX_HOME} || cwd();
 
 sub read_file($) {
 my $infile = shift;
-open my $in, $infile
+open my $in, "$apisix_home/$infile"
 or die "cannot open $infile for reading: $!";
-my $cert = do { local $/; <$in> };
+my $data = do { local $/; <$in> };
 close $in;
-$cert;
+$data;
 }
 
 my $yaml_config = read_file("conf/config.yaml");
@@ -50,15 +50,15 @@ add_block_preprocessor(sub {
 
 my $main_config = $block->main_config // <<_EOC_;
 worker_rlimit_core  500M;
-working_directory   $pwd;
+working_directory   $apisix_home;
 _EOC_
 
 $block->set_value("main_config", $main_config);
 
 my $stream_enable = $block->stream_enable;
 my $stream_config = $block->stream_config // <<_EOC_;
-lua_package_path 
"$pwd/deps/share/lua/5.1/?.lua;$pwd/lua/?.lua;$pwd/t/?.lua;/usr/share/lua/5.1/?.lua;;";
-lua_package_cpath 
"$pwd/deps/lib/lua/5.1/?.so;$pwd/deps/lib64/lua/5.1/?.so;/usr/lib64/lua/5.1/?.so;;";
+lua_package_path 
"$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/lua/?.lua;$apisix_home/t/?.lua;./?.lua;;";
+lua_package_cpath 
"$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;";
 
 lua_socket_log_errors off;
 
@@ -70,10 +70,10 @@ _EOC_
 }
 
 init_by_lua_block {
--- if os.getenv("APISIX_ENABLE_LUACOV") == "1" then
--- require("luacov.runner")("t/apisix.luacov")
--- jit.off()
--- end
+if os.getenv("APISIX_ENABLE_LUACOV") == "1" then
+require("luacov.runner")("t/apisix.luacov")
+jit.off()
+end
 
 require "resty.core"
 
@@ -133,8 +133,8 @@ _EOC_
 
 my $http_config = $block->http_config // '';
 $http_config .= <<_EOC_;
-lua_package_path 
"$pwd/deps/share/lua/5.1/?.lua;$pwd/lua/?.lua;$pwd/t/?.lua;/usr/share/lua/5.1/?.lua;;";
-lua_package_cpath 
"$pwd/deps/lib/lua/5.1/?.so;$pwd/deps/lib64/lua/5.1/?.so;/usr/lib64/lua/5.1/?.so;;";
+lua_package_path 
"$apisix_home/deps/share/lua/5.1/?.lua;$apisix_home/lua/?.lua;$apisix_home/t/?.lua;./?.lua;;";
+lua_package_cpath 
"$apisix_home/deps/lib/lua/5.1/?.so;$apisix_home/deps/lib64/lua/5.1/?.so;./?.so;;";
 
 lua_shared_dict plugin-limit-req 10m;
 lua_shared_dict plugin-limit-count   10m;
diff --git a/t/lib/test_admin.lua b/t/lib/test_admin.lua
index 38c3a3a..608124f 100644
--- a/t/lib/test_admin.lua
+++ b/t/lib/test_admin.lua
@@ -158,4 +158,32 @@ function _M.read_file(path)
 end
 
 
+function _M.req_self_with_http(uri, method, body, headers)
+if type(body) == "table" then
+body = json.encode(body)
+end
+
+if type(method) == "number" then
+method = methods[method]
+end
+headers = headers or {}
+
+local httpc = http.new()
+-- https://github.com/ledgetech/lua-resty-http
+uri = ngx.var.scheme .. "://" .. ngx.var.server_addr
+  .. ":" .. ngx.var.server_port .. uri
+headers["Content-Type"] = "application/x-www-form-urlencoded"
+local res, err = httpc:request_uri(uri,
+{
+method = method,
+body = body,
+keepalive = false,
+headers = headers,
+}
+)
+
+return res, err
+end
+
+
 return _M



[GitHub] [incubator-apisix] membphis merged pull request #1160: test: exported ENV{APISIX_HOME}, allow user to define the working path by himself.

2020-02-26 Thread GitBox
membphis merged pull request #1160: test: exported ENV{APISIX_HOME}, allow user 
to define the working path by himself.
URL: https://github.com/apache/incubator-apisix/pull/1160
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] nic-chen commented on issue #1144: request help: fail to proxy grpc request

2020-02-26 Thread GitBox
nic-chen commented on issue #1144: request help:  fail to proxy grpc request
URL: 
https://github.com/apache/incubator-apisix/issues/1144#issuecomment-591419482
 
 
   抱歉,我这边没能够重现这个问题。
   
   
Travis每次都会跑这个基础用例,应该不至于有问题:https://github.com/apache/incubator-apisix/blob/master/t/grpc-proxy-test.sh
   
   你可以把Apache APISIX的log贴上来,看看gRPC服务有没有输出什么内容。
   
   
   
   Sorry, I can't reproduce this issue.
   
   Travis runs this test case every time, and it should not be a problem: 
https: //github.com/apache/incubator-apisix/blob/master/t/grpc-proxy-test.sh
   
   You can upload the Apache APISIX log and see if the gRPC server outputs 
anything.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] moonming commented on issue #1153: feature: support for proxy caching plugin based on disk.

2020-02-26 Thread GitBox
moonming commented on issue #1153: feature: support for proxy caching plugin 
based on disk.
URL: https://github.com/apache/incubator-apisix/pull/1153#issuecomment-591413643
 
 
   how to add test cases for this plugin?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-apisix] membphis opened a new issue #1165: feature: support `backup` feature for roundrobin load balancing.

2020-02-26 Thread GitBox
membphis opened a new issue #1165: feature: support `backup` feature for 
roundrobin load balancing.
URL: https://github.com/apache/incubator-apisix/issues/1165
 
 
   http://nginx.org/en/docs/http/ngx_http_upstream_module.html#example
   
   This feature is useful when all upstream nodes are unhealthy.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services