From f93780b5522c13ef8ae8770d71516cc8fc073aa7 Mon Sep 17 00:00:00 2001 From: Abhishek Choudhary Date: Mon, 22 Jul 2024 10:52:47 +0545 Subject: [PATCH 1/3] chore: upgrade openresty version to 1.25.3.2 --- ci/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/common.sh b/ci/common.sh index 146b7aa5080a..fce16e7ffd9f 100644 --- a/ci/common.sh +++ b/ci/common.sh @@ -78,7 +78,7 @@ install_curl () { install_apisix_runtime() { export runtime_version=${APISIX_RUNTIME} - wget "https://raw.githubusercontent.com/api7/apisix-build-tools/apisix-runtime/${APISIX_RUNTIME}/build-apisix-runtime.sh" + wget "https://raw.githubusercontent.com/shreemaan-abhishek/apisix-build-tools/upgrade-to-12532/build-apisix-runtime.sh" chmod +x build-apisix-runtime.sh ./build-apisix-runtime.sh latest } From d8951061c1b1f1c23f49f70847bf9f35cbf8a613 Mon Sep 17 00:00:00 2001 From: Abhishek Choudhary Date: Mon, 22 Jul 2024 20:03:59 +0545 Subject: [PATCH 2/3] remove grpc --- apisix/core/grpc.lua | 27 ------- apisix/init.lua | 7 -- t/core/grpc-openresty.t | 50 ------------ t/core/grpc.t | 173 ---------------------------------------- 4 files changed, 257 deletions(-) delete mode 100644 apisix/core/grpc.lua delete mode 100644 t/core/grpc-openresty.t delete mode 100644 t/core/grpc.t diff --git a/apisix/core/grpc.lua b/apisix/core/grpc.lua deleted file mode 100644 index 9cf7d747a667..000000000000 --- a/apisix/core/grpc.lua +++ /dev/null @@ -1,27 +0,0 @@ --- --- Licensed to the Apache Software Foundation (ASF) under one or more --- contributor license agreements. See the NOTICE file distributed with --- this work for additional information regarding copyright ownership. --- The ASF licenses this file to You under the Apache License, Version 2.0 --- (the "License"); you may not use this file except in compliance with --- the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -local pcall = pcall - -local ok, mod = pcall(require, "resty.grpc") -if not ok then - -- vanilla OpenResty doesn't have grpc-client-nginx-module - return nil -end - --- Reimport the `resty.grpc` as `core.grpc`. For the doc of the gRPC API, --- see https://github.com/api7/grpc-client-nginx-module -return mod diff --git a/apisix/init.lua b/apisix/init.lua index 0391ddd62787..103a8c1d7584 100644 --- a/apisix/init.lua +++ b/apisix/init.lua @@ -113,13 +113,6 @@ function _M.http_init_worker() -- for testing only core.log.info("random test in [1, 10000]: ", math.random(1, 10000)) - -- Because go's scheduler doesn't work after fork, we have to load the gRPC module - -- in each worker. - core.grpc = require("apisix.core.grpc") - if type(core.grpc) ~= "table" then - core.grpc = nil - end - require("apisix.events").init_worker() local discovery = require("apisix.discovery.init").discovery diff --git a/t/core/grpc-openresty.t b/t/core/grpc-openresty.t deleted file mode 100644 index 85d0a4369392..000000000000 --- a/t/core/grpc-openresty.t +++ /dev/null @@ -1,50 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use t::APISIX; - -my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx'; -my $version = eval { `$nginx_binary -V 2>&1` }; - -if ($version =~ m/\/apisix-nginx-module/) { - plan(skip_all => "for vanilla OpenResty only"); -} else { - plan('no_plan'); -} - -add_block_preprocessor(sub { - my ($block) = @_; - - if (!$block->request) { - $block->set_value("request", "GET /t"); - } -}); - -run_tests; - -__DATA__ - -=== TEST 1: ensure the core.grpc is nil under vanilla OpenResty ---- config - location /t { - content_by_lua_block { - local core = require "apisix.core" - local gcli = core.grpc - ngx.say(gcli) - } - } ---- response_body -nil diff --git a/t/core/grpc.t b/t/core/grpc.t deleted file mode 100644 index bd52d9e13409..000000000000 --- a/t/core/grpc.t +++ /dev/null @@ -1,173 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -use t::APISIX; - -my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx'; -my $version = eval { `$nginx_binary -V 2>&1` }; - -if ($version !~ m/\/apisix-nginx-module/) { - plan(skip_all => "apisix-nginx-module not installed"); -} else { - plan('no_plan'); -} - -add_block_preprocessor(sub { - my ($block) = @_; - - if (!$block->request) { - $block->set_value("request", "GET /t"); - } -}); - -run_tests; - -__DATA__ - -=== TEST 1: unary ---- config - location /t { - content_by_lua_block { - local core = require "apisix.core" - local gcli = core.grpc - assert(gcli.load("t/grpc_server_example/proto/helloworld.proto")) - local conn = assert(gcli.connect("127.0.0.1:10051")) - local res, err = conn:call("helloworld.Greeter", "SayHello", { - name = "apisix" }) - conn:close() - if not res then - ngx.status = 503 - ngx.say(err) - return - end - ngx.say(res.message) - } - } ---- response_body -Hello apisix - - - -=== TEST 2: server stream ---- config - location /t { - content_by_lua_block { - local core = require "apisix.core" - local gcli = core.grpc - assert(gcli.load("t/grpc_server_example/proto/helloworld.proto")) - local conn = assert(gcli.connect("127.0.0.1:10051")) - local st, err = conn:new_server_stream("helloworld.Greeter", - "SayHelloServerStream", { name = "apisix" }) - if not st then - ngx.status = 503 - ngx.say(err) - return - end - - for i = 1, 5 do - local res, err = st:recv() - if not res then - ngx.status = 503 - ngx.say(err) - return - end - ngx.say(res.message) - end - } - } ---- response_body eval -"Hello apisix\n" x 5 - - - -=== TEST 3: client stream ---- config - location /t { - content_by_lua_block { - local core = require "apisix.core" - local gcli = core.grpc - assert(gcli.load("t/grpc_server_example/proto/helloworld.proto")) - local conn = assert(gcli.connect("127.0.0.1:10051")) - local st, err = conn:new_client_stream("helloworld.Greeter", - "SayHelloClientStream", { name = "apisix" }) - if not st then - ngx.status = 503 - ngx.say(err) - return - end - - for i = 1, 3 do - local ok, err = st:send({ name = "apisix" }) - if not ok then - ngx.status = 503 - ngx.say(err) - return - end - end - - local res, err = st:recv_close() - if not res then - ngx.status = 503 - ngx.say(err) - return - end - ngx.say(res.message) - } - } ---- response_body -Hello apisix!Hello apisix!Hello apisix!Hello apisix! - - - -=== TEST 4: bidirectional stream ---- config - location /t { - content_by_lua_block { - local core = require "apisix.core" - local gcli = core.grpc - assert(gcli.load("t/grpc_server_example/proto/helloworld.proto")) - local conn = assert(gcli.connect("127.0.0.1:10051")) - local st, err = conn:new_bidirectional_stream("helloworld.Greeter", - "SayHelloBidirectionalStream", { name = "apisix" }) - if not st then - ngx.status = 503 - ngx.say(err) - return - end - - for i = 1, 3 do - local ok, err = st:send({ name = "apisix" }) - if not ok then - ngx.status = 503 - ngx.say(err) - return - end - end - - assert(st:close_send()) - for i = 1, 5 do - local res, err = st:recv() - if not res then - ngx.status = 503 - ngx.say(err) - return - end - ngx.say(res.message) - end - } - } ---- response_body eval -"Hello apisix\n" x 4 . "stream ended\n" From 15008df4abd3f8289d47d5bc1c629394f8daa6c5 Mon Sep 17 00:00:00 2001 From: Abhishek Choudhary Date: Mon, 29 Jul 2024 19:50:39 +0545 Subject: [PATCH 3/3] replace forked link with release link --- .requirements | 2 +- ci/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.requirements b/.requirements index bbfa42c49801..6c393209ff55 100644 --- a/.requirements +++ b/.requirements @@ -17,4 +17,4 @@ APISIX_PACKAGE_NAME=apisix -APISIX_RUNTIME=1.2.0 +APISIX_RUNTIME=1.2.1 diff --git a/ci/common.sh b/ci/common.sh index fce16e7ffd9f..146b7aa5080a 100644 --- a/ci/common.sh +++ b/ci/common.sh @@ -78,7 +78,7 @@ install_curl () { install_apisix_runtime() { export runtime_version=${APISIX_RUNTIME} - wget "https://raw.githubusercontent.com/shreemaan-abhishek/apisix-build-tools/upgrade-to-12532/build-apisix-runtime.sh" + wget "https://raw.githubusercontent.com/api7/apisix-build-tools/apisix-runtime/${APISIX_RUNTIME}/build-apisix-runtime.sh" chmod +x build-apisix-runtime.sh ./build-apisix-runtime.sh latest }