This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-nginx.git
The following commit(s) were added to refs/heads/main by this push:
new de37694 Release fix2 (#26)
de37694 is described below
commit de376940191f5f2dd118397ab50a23a3a8801c30
Author: Sixh-PrFor <[email protected]>
AuthorDate: Fri Nov 4 17:35:41 2022 +0800
Release fix2 (#26)
* 1. commit zookeeper connection
* Increase the processing of heartbeats
* 1. Send a request to subscribe
* 1. zookeeper watch event...
* 1. zookeeper watch event...
* 1. update zookeeper proto.
* 1. update zookeeper proto.
* update zookeeper proto.
* update zookeeper proto.
* Modify Chinese
* Modify Chinese
* Modify Chinese
* update sessionId lower.
* modify doc
* modify doc
* modify version
* modify version
---
LICENSE | 9 ++++++
README.md | 34 +++++++++++++++------
rockspec/shenyu-nginx-1.0.0-2.rockspec | 55 ++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 9 deletions(-)
diff --git a/LICENSE b/LICENSE
index 8dada3e..c4d7056 100644
--- a/LICENSE
+++ b/LICENSE
@@ -199,3 +199,12 @@
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.
+
+========================================================================
+Apache 2.0 licenses
+========================================================================
+
+The following components are provided under the Apache License. See project
link for details.
+The text of each license is the standard MIT license.
+ https://github.com/iryont/lua-struct struct
+
diff --git a/README.md b/README.md
index fab3199..e2854a3 100644
--- a/README.md
+++ b/README.md
@@ -4,15 +4,17 @@ Apache ShenYu Nginx Module
This module provided SDK to watch available ShenYu instance list as upstream
nodes by Service Register Center for OpenResty.
1. [ETCD](#greeting-etcd) (Supported)
2. [Nacos](#greeting-nacos) (Supported)
-3. [Zookeeper](#greeting-zookeeper) (Supported)
+3. [Zookeeper](#greeting-zookeeper) (Supported)k
4. [Consul](#greeting-consul) (Supported)
In the cluster mode, Apache ShenYu supports the deployment of multiple ShenYu
instances, which may have new instances joining or leaving at any time.
-Hence, Apache ShenYu introduces Service Discovery modules to help client to
detect the available instances.
-Currently, Apache ShenYu Bootstrap already supports Apache Zookeeper, Nacos,
Etcd, and consul. Client or LoadBalancer can get the available ShenYu instances
by those Service register center.
+Hence, Apache ShenYu introduces Service Discovery modules to help client to
detect the available instances.
+Currently, Apache ShenYu Bootstrap already supports Apache Zookeeper, Nacos,
Etcd, and consul. Client or LoadBalancer can get the available ShenYu instances
by those Service register center.
Here provides a completed
[examples](https://github.com/apache/shenyu-nginx/tree/main/example).
+
=======
+
Here is a completed
[example](https://github.com/apache/shenyu-nginx/blob/main/example/etcd/nginx.conf)
working with ETCD.
Here is a completed
[example](https://github.com/apache/shenyu-nginx/blob/main/example/nacos/nginx.conf)
working with Nacos.
@@ -30,23 +32,26 @@ Here is a completed
[example](https://github.com/apache/shenyu-nginx/blob/main/e
### Build from source
The first, clone the source from GitHub.
+
```shell
git clone https://github.com/apache/shenyu-nginx
```
Then, build from source and install.
+
```shell
cd shenyu-nginx
-luarocks make rockspec/shenyu-nginx-1.0.0-1.rockspec
+luarocks make rockspec/shenyu-nginx-1.0.0-2.rockspec
```
### Greeting ETCD
-Modify the Nginx configure, create and initialize the ShenYu Register to
connect to the target register center.
+Modify the Nginx configure, create and initialize the ShenYu Register to
connect to the target register center.
The module will fetch the all of ShenYu instances which are registered to Etcd
in the same cluster.
-It works like Etcd client to watch(based on long polling) ShenYu instance
lists.
+It works like Etcd client to watch(based on long polling) ShenYu instance
lists.
Here is an example for Etcd.
+
```
init_worker_by_lua_block {
local register = require("shenyu.register.etcd")
@@ -60,8 +65,9 @@ init_worker_by_lua_block {
1. `balancer_type` specify the balancer. It has supported `chash` and `round
robin`.
2. `etcd_base_url` specify the Etcd server.(Currently, authentication is not
supported.)
-Add an `upstream block` for ShenYu and enable to update upstream servers
dynamically. This case will synchronize the ShenYu instance list with register
center.
+Add an `upstream block` for ShenYu and enable to update upstream servers
dynamically. This case will synchronize the ShenYu instance list with register
center.
And then pick one up for handling the request.
+
```
upstream shenyu {
server 0.0.0.1; -- bad
@@ -76,6 +82,7 @@ upstream shenyu {
### Greeting Nacos
Modify the Nginx configure, create and initialize the ShenYu Register to
connect to target register center. Here is an example for Nacos.
+
```
init_worker_by_lua_block {
local register = require("shenyu.register.nacos")
@@ -94,8 +101,9 @@ init_worker_by_lua_block {
3. `username` specify the username to log in Nacos. (it is only required when
Nacos auth enable)
4. `password` specify the password to log in Nacos.
-Modify the `upstream` to enable to update upstream servers dynamically. This
case will synchronize the ShenYu instance list with register center.
+Modify the `upstream` to enable to update upstream servers dynamically. This
case will synchronize the ShenYu instance list with register center.
And then pick one up for handling the request.
+
```
upstream shenyu {
server 0.0.0.1; -- bad
@@ -106,9 +114,11 @@ upstream shenyu {
}
```
-## Greeting Zookeeper
+## Greeting Zookeeper
+
Modify the Nginx configure, create and initialize the ShenYu register to
connect to target register center.
Listen for changes to the node via the zookeeper watch event. Here is an
example of the zookeeper configuration.
+
```shell
init_worker_by_lua_block {
local register = require("shenyu.register.zookeeper")
@@ -119,10 +129,12 @@ init_worker_by_lua_block {
});
}
```
+
1. `servers` zookeeper cluster address.
2. ``balancer_type`` specify the balancer. It has supported `chash` and `round
robin`.
Modify the upstream to enable to update upstream servers dynamically. This
case will synchronize the ShenYu instance list with register center. And then
pick one up for handling the request.
+
```shell
upstream shenyu {
server 0.0.0.1;
@@ -136,6 +148,7 @@ Modify the upstream to enable to update upstream servers
dynamically. This case
Modify the Nginx configure, create and initialize the ShenYu register to
connect to target register center.
Listen for changes to the node via the consul watch event. Here is an example
of the consul configuration.
+
```shell
init_worker_by_lua_block {
local register = require "shenyu.register.consul";
@@ -147,6 +160,7 @@ init_worker_by_lua_block {
})
}
```
+
1. ``balancer_type`` specify the balancer. It has supported `chash` and `round
robin`.
2. `uri` consul server address.
3. `path` path of service.
@@ -154,6 +168,7 @@ init_worker_by_lua_block {
Modify the upstream to enable to update upstream servers dynamically. This
case will synchronize the ShenYu instance list with register center. And then
pick one up for handling the request.
```shell
+
upstream shenyu {
server 0.0.0.1;
balancer_by_lua_block {
@@ -165,6 +180,7 @@ Modify the upstream to enable to update upstream servers
dynamically. This case
## Finally
Finally, restart OpenResty.
+
```shell
openresty -s reload
```
diff --git a/rockspec/shenyu-nginx-1.0.0-2.rockspec
b/rockspec/shenyu-nginx-1.0.0-2.rockspec
new file mode 100644
index 0000000..4d1cff7
--- /dev/null
+++ b/rockspec/shenyu-nginx-1.0.0-2.rockspec
@@ -0,0 +1,55 @@
+--
+-- 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.
+--
+
+package = "shenyu-nginx"
+version = "1.0.0-2"
+source = {
+ url = "https://github.com/apache/shenyu-nginx",
+ branch = "main",
+}
+
+description = {
+ summary = "Discovery Apache Shenyu servers for Nginx",
+ homepage = "https://github.com/apache/shenyu-nginx",
+ license = "Apache License 2.0"
+}
+
+dependencies = {
+ "lua-resty-balancer >= 0.04",
+ "lua-resty-http >= 0.15",
+ "lua-cjson = 2.1.0.6-1",
+ "stringy = 0.7-0",
+}
+
+build = {
+ type = "builtin",
+ modules = {
+ ["shenyu.register.etcd"] = "lib/shenyu/register/etcd.lua",
+ ["shenyu.register.nacos"] = "lib/shenyu/register/nacos.lua",
+ ["shenyu.register.balancer"] = "lib/shenyu/register/balancer.lua",
+ ["shenyu.register.consul"] = "lib/shenyu/register/consul.lua",
+ ["shenyu.register.zookeeper"] = "lib/shenyu/register/zookeeper.lua",
+ ["shenyu.register.zookeeper.connection"] =
"lib/shenyu/register/zookeeper/connection.lua",
+ ["shenyu.register.zookeeper.zk_client"] =
"lib/shenyu/register/zookeeper/zk_client.lua",
+ ["shenyu.register.zookeeper.zk_cluster"] =
"lib/shenyu/register/zookeeper/zk_cluster.lua",
+ ["shenyu.register.zookeeper.zk_const"] =
"lib/shenyu/register/zookeeper/zk_const.lua",
+ ["shenyu.register.zookeeper.zk_proto"] =
"lib/shenyu/register/zookeeper/zk_proto.lua",
+ ["shenyu.register.core.string"] = "lib/shenyu/register/core/string.lua",
+ ["shenyu.register.core.struct"] = "lib/shenyu/register/core/struct.lua",
+ ["shenyu.register.core.utils"] = "lib/shenyu/register/core/utils.lua",
+ }
+}