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

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git


The following commit(s) were added to refs/heads/develop by this push:
     new c0bf34ef chore:use wasm filter build tags add wasm and docs (#567)
c0bf34ef is described below

commit c0bf34ef6973be72f4f1bede30247b175817afc3
Author: baerwang <[email protected]>
AuthorDate: Sun Jun 18 20:26:29 2023 +0800

    chore:use wasm filter build tags add wasm and docs (#567)
    
    Co-authored-by: baerwang <[email protected]>
---
 Dockerfile                                     |  2 +-
 README.md                                      | 86 ++++++++++++++++++------
 README_CN.md                                   | 91 ++++++++++++++++++++------
 pixiu/pkg/pluginregistry/proxywasm_register.go | 22 +++++++
 pixiu/pkg/pluginregistry/registry.go           |  1 -
 5 files changed, 161 insertions(+), 41 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index d21fee5c..fd72fbe1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -38,7 +38,7 @@ ENV GO111MODULE=on \
     GOOS=linux \
     GOARCH=amd64
 
-RUN go build -ldflags '-r ./lib -s -w' -trimpath -o dubbo-go-pixiu 
./cmd/pixiu/*.go
+RUN go build -ldflags '-r ./lib -s -w' -tags="wasm" -trimpath -o 
dubbo-go-pixiu ./cmd/pixiu/*.go
 
 ### alpine
 FROM amd64/pingcap/alpine-glibc:latest
diff --git a/README.md b/README.md
index ad3ff847..711205df 100644
--- a/README.md
+++ b/README.md
@@ -18,67 +18,114 @@ It is an open source Dubbo ecosystem API gateway, and also 
a sidecar to let othe
 
 ## Quick Start
 
+#### Requirment
+1. go 1.17 or higher
+2. docker or docker-desktop
+
 you can find out all demo in https://github.com/apache/dubbo-go-pixiu-samples.
 download it and operate as below.
+```shell
+git clone https://github.com/apache/dubbo-go-pixiu-samples.git
+```
+
+#### update pixiu to latest version
+```shell
+go get github.com/apache/[email protected]
+```
 
 #### cd samples dir
 
-```
+```shell
 cd dubbogo/simple
 ```
 
 we can use start.sh to run samples quickly. for more info, execute command as 
below for more help
 
-```
+```shell
 ./start.sh [action] [project]
 ./start.sh help
 ```
 
-we run body samples below step
+we run [direct] samples step by step as follows.
 
 #### prepare config file and docker 
 
-prepare command will prepare dubbo-server and pixiu config file and start 
docker container needed
+'prepare' command will prepare dubbo-server and pixiu config file firstly, and 
then start docker container.
 
-```
-./start.sh prepare body
+```shell
+./start.sh prepare direct
 ```
 
 if prepare config file manually, notice:
-- modify $PROJECT_DIR in conf.yaml to absolute path in your compute 
+- modify $PROJECT_DIR in conf.yaml to absolute path 
 
 #### start dubbo or http server
 
-```
-./start.sh startServer body
+```shell
+./start.sh startServer direct
 ```
 
 #### start pixiu 
 
-```
-./start.sh startPixiu body
+```shell
+./start.sh startPixiu direct
 ```
 
 if run pixiu manually in pixiu project, use command as below.
 
+```shell
+ go run cmd/pixiu/*.go gateway start -c 
/[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/direct/pixiu/conf.yaml
 ```
- go run cmd/pixiu/*.go gateway start -c 
/[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/body/pixiu/conf.yaml
+
+if run pixiu manually in pixiu project and wasm feature, use command as below.
+
+build pixiu project use command operate
+
+```shell
+go build -tags wasm -o pixiu cmd/pixiu/*.go
 ```
 
+run pixiu app binary
+
+```shell
+go build cmd/pixiu/*.go
+./pixiu gateway start -c 
/[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/direct/pixiu/conf.yaml
+```
 
 #### Try a request
 
 use curl to try or use unit test
 
-```bash
-curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d 
'{"id":"0003","code":3,"name":"dubbogo","age":99}' --header 'Content-Type: 
application/json' 
+```shell
+curl 
http://localhost:8883/UserService/com.dubbogo.pixiu.UserService/GetUserByCode \
+-H "x-dubbo-http1.1-dubbo-version:1.0.0" -H "x-dubbo-service-protocol:dubbo" \
+-H "x-dubbo-service-version:1.0.0" -H "x-dubbo-service-group:test" \
+-H "Content-Type:application/json" \
+ -d '[1]'
+```
+```shell
+curl 
http://localhost:8883/UserService/com.dubbogo.pixiu.UserService/UpdateUserByName
  \
+-H "x-dubbo-http1.1-dubbo-version:1.0.0" -H "x-dubbo-service-protocol:dubbo" \
+-H "x-dubbo-service-version:1.0.0" -H "x-dubbo-service-group:test" \
+-H "Content-Type:application/json" \
+ -d '["tc",{"id":"0002","code":1,"name":"tc","age":15}]'
+```
+```shell
+curl 
http://localhost:8883/UserService/com.dubbogo.pixiu.UserService/GetUserByCode \
+-H "x-dubbo-http1.1-dubbo-version:1.0.0" -H "x-dubbo-service-protocol:dubbo" \
+-H "x-dubbo-service-version:1.0.0" -H "x-dubbo-service-group:test" \
+-H "Content-Type:application/json" \
+ -d '[1]'
+```
+
+```shell 
 ./start.sh startTest body
 ```
 
 #### Clean
 
-```
-./start.sh clean body
+```shell
+./start.sh clean direct
 ```
 
 ## Start Docker
@@ -86,9 +133,9 @@ curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d 
'{"id":"0003","code":3,"
 #### 
 ```shell
 docker run --name pixiu-gateway -p 8888:8888 dubbogopixiu/dubbo-go-pixiu:latest
-
-```
 ```
+
+```shell
 docker run --name pixiu-gateway -p 8888:8888 \
     -v /yourpath/conf.yaml:/etc/pixiu/conf.yaml \
     -v /yourpath/log.yml:/etc/pixiu/log.yml \
@@ -112,8 +159,9 @@ The pixiu control plane is forked from 
[istio](https://github.com/istio/istio) v
 
 The project is under intensively iteration, you are more than welcome to use, 
suggest and contribute codes. 
 
+
 ### Community
- 
+
 **DingDing Group (31203920):**
 
 
[![flowchart](./docs/images/group-pixiu-dingding.jpg)](docs/images/group-pixiu-dingding.jpg)
diff --git a/README_CN.md b/README_CN.md
index c57a1bc4..b674585c 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -1,5 +1,6 @@
 [![Pixiu 
Logo](docs/images/pixiu-logo-v4.png)](http://alexstocks.github.io/html/dubbogo.html)
 
+
 
[![Language](https://img.shields.io/badge/Language-Go-blue.svg)](https://golang.org/)
 [![Build 
Status](https://travis-ci.org/dubbogo/dubbo-go-pixiu.svg?branch=master)](https://travis-ci.org/dubbogo/dubbo-go-pixiu)
 
@@ -9,72 +10,119 @@
 
 **Dubbo-Go-Pixiu**(官网: https://dubbo.apache.org/zh/docs3-v2/dubbo-go-pixiu/) 
是一款 Dubbo 生态下的高性能 API 网关和多语言解决方案 Sidecar
 
+
 ![](https://dubbo-go-pixiu.github.io/img/pixiu-dubbo-ecosystem.png)
+
 Pixiu 是一款开源的 Dubbo 生态的 API 网关和 接入 dubbo 集群的语言解决方案。作为 API 网关形态, Pixiu 
能接收外界的网络请求,将其转换为 dubbo 等协议请求,转发给背后集群;作为 Sidecar,Pixiu 期望可以代替代理服务注册到 Dubbo 
集群,让多语言服务接入 Dubbo 集群提供更快捷的解决方案
 
 
 ## 快速开始
 
-你可以在 https://github.com/apache/dubbo-go-pixiu-samples 中找到所有有关 pixiu 
功能的案例,可以按照如下的步骤进行操作。
+#### 环境准备
+1. go 1.17或者更高
+2. docker或者docker-desktop
 
-#### 进入示例代码目录
+#### 下载simples
+你可以在 https://github.com/apache/dubbo-go-pixiu-samples 中找到所有有关 pixiu 
功能的案例,可以按照如下的步骤进行操作。
+```shell
+git clone https://github.com/apache/dubbo-go-pixiu-samples.git
+```
 
+#### 更新pixiu到最新版本
+```shell
+go get github.com/apache/[email protected]
 ```
+
+#### 进入示例代码目录
+```shell
 cd dubbogo/simple
 ```
 
 可以使用 start.sh 脚本快速启动案例项目,可以执行如下命令来获得更多信息
 
-```
+```shell
 ./start.sh [action] [project]
 ./start.sh help
 ```
 
-下列步骤中,我们将启动 body 案例项目
+下列步骤中,我们将启动简单代理[direct]案例项目
 
-#### 准备配置文件和外部依赖 docker
+#### 准备配置文件
 
 使用 start.sh 的 prepare 命令来准备配置文件和外部docker依赖
 
-```
-./start.sh prepare body
+```shell
+./start.sh prepare direct
 ```
 
 如果想要手动准备文件,需要注意:
 - 将 conf.yaml 中的 $PROJECT_DIR 修改为本地绝对路径
 
-#### 启动 dubbo 服务或者 http 服务
+#### 启动 dubbo 服务或者 http 服务,本地需要有docker环境,
 
-```
-./start.sh startServer body
+```shell
+./start.sh startServer direct
 ```
 
-#### 启动 pixiu
+#### 开启另一个终端,启动 pixiu
 
-```
-./start.sh startPixiu body
+```shell
+./start.sh startPixiu direct
 ```
 
-可以使用下列命令来手动启动 pixiu
+使用下列命令来手动启动 pixiu
 
+```shell
+ go run cmd/pixiu/*.go gateway start -c 
/[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/direct/pixiu/conf.yaml
 ```
- go run cmd/pixiu/*.go gateway start -c 
/[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/body/pixiu/conf.yaml
+
+如果希望启用wasm ,使用下列命令来手动启动 pixiu
+
+```shell
+go build -tags wasm -o pixiu cmd/pixiu/*.go
 ```
 
+手动编译并启动pixiu:
+
+```shell
+go build cmd/pixiu/*.go
+./pixiu gateway start -c 
/[absolute-path]/dubbo-go-pixiu/samples/dubbogo/simple/direct/pixiu/conf.yaml
+```
 
 #### 尝试请求
 
 可以使用 curl 或者执行单元测试来验证一下
 
+```shell
+curl 
http://localhost:8883/UserService/com.dubbogo.pixiu.UserService/GetUserByCode \
+-H "x-dubbo-http1.1-dubbo-version:1.0.0" -H "x-dubbo-service-protocol:dubbo" \
+-H "x-dubbo-service-version:1.0.0" -H "x-dubbo-service-group:test" \
+-H "Content-Type:application/json" \
+ -d '[1]'
+```
+```shell
+curl 
http://localhost:8883/UserService/com.dubbogo.pixiu.UserService/UpdateUserByName
  \
+-H "x-dubbo-http1.1-dubbo-version:1.0.0" -H "x-dubbo-service-protocol:dubbo" \
+-H "x-dubbo-service-version:1.0.0" -H "x-dubbo-service-group:test" \
+-H "Content-Type:application/json" \
+ -d '["tc",{"id":"0002","code":1,"name":"tc","age":15}]'
 ```
-curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d 
'{"id":"0003","code":3,"name":"dubbogo","age":99}' --header 'Content-Type: 
application/json' 
+```shell
+curl 
http://localhost:8883/UserService/com.dubbogo.pixiu.UserService/GetUserByCode \
+-H "x-dubbo-http1.1-dubbo-version:1.0.0" -H "x-dubbo-service-protocol:dubbo" \
+-H "x-dubbo-service-version:1.0.0" -H "x-dubbo-service-group:test" \
+-H "Content-Type:application/json" \
+ -d '[1]'
+```
+
+```shell 
 ./start.sh startTest body
 ```
 
 #### 清除
 
 ```
-./start.sh clean body
+./start.sh clean direct
 ```
 
 
@@ -84,14 +132,14 @@ curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d 
'{"id":"0003","code":3,"
 ```shell
 docker pull dubbogopixiu/dubbo-go-pixiu:latest
 ```
-```
-docker run --name pixiuname -p 8888:8888 \
+
+```shell
+docker run --name pixiu-gateway -p 8888:8888 \
     -v /yourpath/conf.yaml:/etc/pixiu/conf.yaml \
     -v /yourpath/log.yml:/etc/pixiu/log.yml \
     dubbogopixiu/dubbo-go-pixiu:latest
 ```
 
-
 ## 特性
 
 - 多协议支持:目前已支持 Http、Dubbo2、Triple、gRPC 协议代理和转换,其他协议持续集成中
@@ -115,6 +163,9 @@ Pixiu 控制面是 frok 自 [istio](https://github.com/istio/istio) 
v1.14.3 版
 **官方钉钉群(31203920)**:
 
 
[![flowchart](./docs/images/group-pixiu-dingding.jpg)](docs/images/group-pixiu-dingding.jpg)
+
+We welcome the friends who can give us constructing suggestions instead of 
known-nothing.
+
 ## License
 
 Apache License, Version 2.0
diff --git a/pixiu/pkg/pluginregistry/proxywasm_register.go 
b/pixiu/pkg/pluginregistry/proxywasm_register.go
new file mode 100644
index 00000000..c8bfcd9d
--- /dev/null
+++ b/pixiu/pkg/pluginregistry/proxywasm_register.go
@@ -0,0 +1,22 @@
+//go:build wasm
+
+/*
+ * 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 pluginregistry
+
+import _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/http/proxywasm"
diff --git a/pixiu/pkg/pluginregistry/registry.go 
b/pixiu/pkg/pluginregistry/registry.go
index c3446f43..ddd15793 100644
--- a/pixiu/pkg/pluginregistry/registry.go
+++ b/pixiu/pkg/pluginregistry/registry.go
@@ -37,7 +37,6 @@ import (
        _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/http/httpproxy"
        _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/http/loadbalancer"
        _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/http/proxyrewrite"
-       _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/http/proxywasm"
        _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/http/remote"
        _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/metric"
        _ "github.com/apache/dubbo-go-pixiu/pixiu/pkg/filter/network/dubboproxy"

Reply via email to