diff --git a/docs/sample/http/http-grpc.md b/docs/sample/http/http-grpc.md index 62b447cec..24b8eb89c 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 3ecd3118a..000000000 --- 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 c018e13d9..fffb431f5 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