You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ma...@apache.org on 2021/10/12 12:56:08 UTC

[dubbo-go-pixiu] branch develop updated: fix: remove api_config concerning from grpc sample

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

mark4z 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 cc0c57c  fix: remove api_config concerning from grpc sample
     new 7234723  Merge pull request #276 from MasterKenway/docs/grpc
cc0c57c is described below

commit cc0c57c71ae8a5f3ad190f0d6e51c05490469271
Author: MasterKenway <zk...@ikenway.net>
AuthorDate: Sun Oct 10 16:33:58 2021 +0800

    fix: remove api_config concerning from grpc sample
---
 docs/sample/http/http-grpc.md           | 85 ++++++++++++++++++++-------------
 samples/http/grpc/pixiu/api_config.yaml | 49 -------------------
 samples/http/grpc/pixiu/conf.yaml       |  3 --
 3 files changed, 53 insertions(+), 84 deletions(-)

diff --git a/docs/sample/http/http-grpc.md b/docs/sample/http/http-grpc.md
index 62b447c..24b8eb8 100644
--- a/docs/sample/http/http-grpc.md
+++ b/docs/sample/http/http-grpc.md
@@ -2,42 +2,63 @@
 
 > Doc metions below fit the code in the `samples/http/grpc`
 
-## Define Apis in the pixiu/api_config.yaml
+## Define Pixiu Config
 
 ```yaml
-name: pixiu
-description: pixiu sample
-resources:
-  - path: '/api/v1/provider.UserProvider/GetUser'
-    type: restful
-    description: user
-    methods:
-      - httpVerb: GET
-        enable: true
-        timeout: 1000ms
-        inboundRequest:
-          requestType: http
-        integrationRequest:
-          requestType: grpc
-          group: "test"
-          version: 1.0.0
-          clusterName: "test_grpc"
-  - path: '/api/v1/provider.UserProvider/GetUser'
-    type: restful
-    description: user
-    methods:
-      - httpVerb: POST
-        enable: true
-        timeout: 1000ms
-        inboundRequest:
-          requestType: http
-        integrationRequest:
-          requestType: grpc
-          group: "test"
-          version: 1.0.0
-          clusterName: "test_grpc"
+static_resources:
+  listeners:
+    - name: "net/http"
+      address:
+        socket_address:
+          protocol_type: "HTTP"
+          address: "0.0.0.0"
+          port: 8881
+      filter_chains:
+        - filter_chain_match:
+          domains:
+            - api.dubbo.com
+            - api.pixiu.com
+          filters:
+            - name: dgp.filter.httpconnectionmanager
+              config:
+                route_config:
+                  routes:
+                    - match:
+                        prefix: "/api/v1"
+                      route:
+                        cluster: "test-grpc"
+                        cluster_not_found_response_code: 505
+                http_filters:
+                  - name: dgp.filter.http.grpcproxy
+                    config:
+                      path: /mnt/d/WorkSpace/GoLandProjects/dubbo-go-pixiu/samples/http/grpc/proto
+                  - name: dgp.filter.http.response
+                    config:
+                server_name: "test-http-grpc"
+                generate_request_id: false
+      config:
+        idle_timeout: 5s
+        read_timeout: 5s
+        write_timeout: 5s
+  clusters:
+    - name: "test-grpc"
+      lb_policy: "RoundRobin"
+      endpoints:
+        - socket_address:
+            address: 127.0.0.1
+            port: 50001
+            protocol_type: "GRPC"
+  timeout_config:
+    connect_timeout: "5s"
+    request_timeout: "10s"
+  shutdown_config:
+    timeout: "60s"
+    step_timeout: "10s"
+    reject_policy: "immediacy"
 ```
 
+> Grpc server is defined in the `clusters`
+
 > WARN: currently http request only support json body to parse params
 
 ## Prepare for the Server 
diff --git a/samples/http/grpc/pixiu/api_config.yaml b/samples/http/grpc/pixiu/api_config.yaml
deleted file mode 100644
index 3ecd311..0000000
--- a/samples/http/grpc/pixiu/api_config.yaml
+++ /dev/null
@@ -1,49 +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.
-#
-name: pixiu
-description: pixiu sample
-resources:
-  - path: '/api/v1/provider.UserProvider/GetUser'
-    type: restful
-    description: user
-    methods:
-      - httpVerb: GET
-        enable: true
-        timeout: 1000ms
-        inboundRequest:
-          requestType: http
-        integrationRequest:
-          requestType: grpc
-          group: "test"
-          version: 1.0.0
-          clusterName: "test_grpc"
-  - path: '/api/v1/provider.UserProvider/GetUser'
-    type: restful
-    description: user
-    methods:
-      - httpVerb: POST
-        enable: true
-        timeout: 1000ms
-        inboundRequest:
-          requestType: http
-        integrationRequest:
-          requestType: grpc
-          group: "test"
-          version: 1.0.0
-          clusterName: "test_grpc"
\ No newline at end of file
diff --git a/samples/http/grpc/pixiu/conf.yaml b/samples/http/grpc/pixiu/conf.yaml
index c018e13..fffb431 100644
--- a/samples/http/grpc/pixiu/conf.yaml
+++ b/samples/http/grpc/pixiu/conf.yaml
@@ -41,9 +41,6 @@ static_resources:
                         cluster: "test-grpc"
                         cluster_not_found_response_code: 505
                 http_filters:
-                  - name: dgp.filter.http.apiconfig
-                    config:
-                      path: $PROJECT_DIR/pixiu/api_config.yaml
                   - name: dgp.filter.http.grpcproxy
                     config:
                       path: $PROJECT_DIR/proto