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

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-mesher.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ece319   Add a quick start. (#60)
7ece319 is described below

commit 7ece3191a62b021421bdf0786df808139d9f9068
Author: surechen <[email protected]>
AuthorDate: Mon Aug 12 09:17:32 2019 +0800

     Add a quick start. (#60)
    
    * Add a quick start.
    
    Signed-off-by: surechen <[email protected]>
    
    * Add a quick start.
    
    Signed-off-by: surechen <[email protected]>
    
    * Fix format errors
    
    Signed-off-by: surechen <[email protected]>
    
    * Fix format error.
    
    Signed-off-by: surechen <[email protected]>
    
    * Add a quick start and fix format err.
    
    Signed-off-by: surechen <[email protected]>
    
    * Add a quick start and fix format err.
    
    Signed-off-by: surechen <[email protected]>
    
    * Add a quick start and fix format err.
    
    Signed-off-by: surechen <[email protected]>
---
 .../httpserver-gateway/httpservergateway.go        |  96 +++++++++++++++
 examples/quick_start/httpserver/httpserver.go      |  87 +++++++++++++
 examples/quick_start/httpserver_py/http_server.py  |  72 +++++++++++
 examples/quick_start/mersher-a/conf/auth.yaml      |   7 ++
 examples/quick_start/mersher-a/conf/chassis.yaml   | 137 +++++++++++++++++++++
 examples/quick_start/mersher-a/conf/egress.yaml    |  17 +++
 examples/quick_start/mersher-a/conf/fault.yaml     |  51 ++++++++
 examples/quick_start/mersher-a/conf/lager.yaml     |  23 ++++
 examples/quick_start/mersher-a/conf/mesher.yaml    |  23 ++++
 .../quick_start/mersher-a/conf/microservice.yaml   |   7 ++
 examples/quick_start/mersher-a/conf/router.yaml    |  12 ++
 examples/quick_start/mersher-b/conf/auth.yaml      |   7 ++
 examples/quick_start/mersher-b/conf/chassis.yaml   | 120 ++++++++++++++++++
 examples/quick_start/mersher-b/conf/egress.yaml    |  17 +++
 examples/quick_start/mersher-b/conf/fault.yaml     |  51 ++++++++
 examples/quick_start/mersher-b/conf/lager.yaml     |  23 ++++
 examples/quick_start/mersher-b/conf/mesher.yaml    |  23 ++++
 .../quick_start/mersher-b/conf/microservice.yaml   |   7 ++
 examples/quick_start/mersher-b/conf/router.yaml    |  12 ++
 examples/quick_start/mersher-g/conf/auth.yaml      |   7 ++
 examples/quick_start/mersher-g/conf/chassis.yaml   | 120 ++++++++++++++++++
 examples/quick_start/mersher-g/conf/egress.yaml    |  17 +++
 examples/quick_start/mersher-g/conf/fault.yaml     |  51 ++++++++
 examples/quick_start/mersher-g/conf/lager.yaml     |  23 ++++
 examples/quick_start/mersher-g/conf/mesher.yaml    |  23 ++++
 .../quick_start/mersher-g/conf/microservice.yaml   |   7 ++
 examples/quick_start/mersher-g/conf/router.yaml    |  10 ++
 examples/quick_start/webapp/application.yaml       |  33 +++++
 examples/quick_start/webapp/index.html             | 104 ++++++++++++++++
 29 files changed, 1187 insertions(+)

diff --git a/examples/quick_start/httpserver-gateway/httpservergateway.go 
b/examples/quick_start/httpserver-gateway/httpservergateway.go
new file mode 100644
index 0000000..0792c7a
--- /dev/null
+++ b/examples/quick_start/httpserver-gateway/httpservergateway.go
@@ -0,0 +1,96 @@
+/*
+ * 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 main
+
+import (
+       "fmt"
+       "io/ioutil"
+       "net/http"
+       "net/url"
+)
+
+func handlerGateway(w http.ResponseWriter, r *http.Request) {
+
+       queryInfo, err := url.ParseQuery(r.URL.RawQuery)
+       if err != nil {
+               fmt.Println("parse queryInfo wrong: ", queryInfo)
+               fmt.Fprintln(w, "parse queryInfo wrong")
+               return
+       }
+       fmt.Println("height:%s,weight:%s", queryInfo.Get("height"), 
queryInfo.Get("weight"))
+       strReqURL := "http://mersher-provider:4540/bmi?height="; + 
queryInfo.Get("height") + "&weight=" + queryInfo.Get("weight")
+       resp, err := http.Get(strReqURL)
+       if err != nil {
+               // handle error
+       }
+       defer resp.Body.Close()
+       body, err := ioutil.ReadAll(resp.Body)
+       if err != nil {
+               // handle error
+               fmt.Println("body err: ", body, err)
+               return
+       }
+       fmt.Println("body: " + string(body))
+       w.Header().Set("Content-Type", "application/json")
+       w.Header().Set("Access-Control-Allow-Origin", "*")
+       w.Write(body)
+
+}
+
+func handlerGateway2(w http.ResponseWriter, r *http.Request) {
+       queryInfo, err := url.ParseQuery(r.URL.RawQuery)
+       if err != nil {
+               fmt.Println("parse queryInfo wrong: ", queryInfo)
+               fmt.Fprintln(w, "parse queryInfo wrong")
+               return
+       }
+       fmt.Println("height:%s,weight:%s", queryInfo.Get("height"), 
queryInfo.Get("weight"))
+       strReqURL := "http://mersher-provider/bmi?height="; + 
queryInfo.Get("height") + "&weight=" + queryInfo.Get("weight")
+       //strReqURL := "http://mersher-ht-provider/bmi?height="; + 
queryInfo.Get("height") + "&weight=" + queryInfo.Get("weight")
+       //strReqURL := "http://mersher-ht-provider:4555/bmi?height="; + 
queryInfo.Get("height") + "&weight=" + queryInfo.Get("weight")
+       proxy, _ := url.Parse("http://127.0.0.1:30101";) //将mesher设置为http代理
+       httpClient := http.Client{
+               Transport: &http.Transport{
+                       Proxy: http.ProxyURL(proxy),
+               },
+       }
+       req, err := http.NewRequest(http.MethodGet, strReqURL, nil)
+       if err != nil {
+               fmt.Println("make req err: ", err)
+       }
+       resp, err := httpClient.Do(req)
+       if err != nil {
+               fmt.Println("Do err: ", resp, err)
+       }
+       defer resp.Body.Close()
+       body, err := ioutil.ReadAll(resp.Body)
+       if err != nil {
+               // handle error
+               fmt.Println("body err: ", body, err)
+               return
+       }
+       fmt.Println("body: " + string(body))
+       w.Header().Set("Content-Type", "application/json")
+       w.Header().Set("Access-Control-Allow-Origin", "*")
+       w.Write(body)
+}
+
+func main() {
+       http.HandleFunc("/bmi", handlerGateway2)
+       http.ListenAndServe("192.168.88.64:4538", nil)
+}
diff --git a/examples/quick_start/httpserver/httpserver.go 
b/examples/quick_start/httpserver/httpserver.go
new file mode 100644
index 0000000..e8a0b45
--- /dev/null
+++ b/examples/quick_start/httpserver/httpserver.go
@@ -0,0 +1,87 @@
+/*
+ * 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 main
+
+import (
+       "encoding/json"
+       "fmt"
+       "net/http"
+       "net/url"
+       "strconv"
+       "strings"
+       "time"
+)
+
+type resultInfo struct {
+       Result     float64 `json:"result"`
+       InstanceId string  `json:"instanceId"`
+       CallTime   string  `json:"callTime"`
+}
+
+func handlerCalculator(w http.ResponseWriter, r *http.Request) {
+       fmt.Println("HandlerCalculator1 begin")
+       queryInfo, err := url.ParseQuery(r.URL.RawQuery)
+       if err != nil {
+               fmt.Println("parse queryInfo wrong: ", queryInfo)
+               fmt.Fprintln(w, "parse queryInfo wrong")
+               return
+       }
+       fmt.Println("height:%s,weight:%s", queryInfo.Get("height"), 
queryInfo.Get("weight"))
+       ddwHeight, err := strconv.ParseFloat(queryInfo.Get("height"), 64)
+       if err != nil {
+               fmt.Println("para height wrong: %s", queryInfo.Get("height"))
+               fmt.Fprintln(w, "para height wrong")
+       }
+       if ddwHeight <= 0 {
+               time.Sleep(10 * time.Second)
+               panic("err input height: ")
+       }
+       ddwHeight /= 100
+       ddwWeight, err := strconv.ParseFloat(queryInfo.Get("weight"), 64)
+       if err != nil {
+               fmt.Println("para height wrong: %s", queryInfo.Get("weight"))
+               fmt.Fprintln(w, "para height wrong")
+       }
+       if ddwWeight <= 0 {
+               time.Sleep(10 * time.Second)
+               panic("err input weight: ")
+       }
+       ddwBmi := ddwWeight / (ddwHeight * ddwHeight)
+       fmt.Println("bmi:", ddwBmi)
+       var result resultInfo
+       result.Result, _ = strconv.ParseFloat(fmt.Sprintf("%.1f", ddwBmi), 64)
+       strTime := time.Now().Format("2006-01-02 15:04:05")
+       arrTime := strings.Split(strTime, " ")
+       result = resultInfo{result.Result, "goHttpServer", arrTime[1]}
+       bResult, err := json.Marshal(result)
+       if err != nil {
+               fmt.Println("result err ", result, string(bResult), err)
+               http.Error(w, err.Error(), http.StatusInternalServerError)
+               return
+       }
+       fmt.Println("result ", result, string(bResult))
+       w.Header().Set("Content-Type", "application/json")
+       w.Header().Set("Access-Control-Allow-Origin", "*")
+       w.Write(bResult)
+
+}
+
+func main() {
+       http.HandleFunc("/bmi", handlerCalculator)
+       http.ListenAndServe("127.0.0.1:4537", nil)
+}
diff --git a/examples/quick_start/httpserver_py/http_server.py 
b/examples/quick_start/httpserver_py/http_server.py
new file mode 100644
index 0000000..8038a61
--- /dev/null
+++ b/examples/quick_start/httpserver_py/http_server.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+'''
+ * 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.
+'''
+
+from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
+import urllib
+import os
+import json
+import time
+
+def Calculator(dwHeight, dwWeight):
+    ddwHeight = float(dwHeight)
+    ddwWeight = float(dwWeight)
+    ddwHeight /= 100
+    ddwBmi = ddwWeight / (ddwHeight * ddwHeight)
+    return float('%.2f' % ddwBmi)
+
+class CalculatorHandler(BaseHTTPRequestHandler):
+    #Handler for the GET requests
+    def do_GET(self):
+        mpath,margs=urllib.splitquery(self.path)
+        print mpath
+        print margs
+        margs.replace("&&", "&")
+        inputPara = margs.split("&", 1)
+        print inputPara
+        if len(inputPara) != 2:
+            print 'err input:' + inputPara
+            return
+        arrHeight = str(inputPara[0]).split("=")
+        arrWeight = str(inputPara[1]).split("=")
+        if len(arrHeight) != 2 or  len(arrWeight) != 2 :
+            return
+        dwHeight = float(arrHeight[1])
+        dwWeight = float(arrWeight[1])
+        ddwBmi = Calculator(dwHeight, dwWeight)
+        print "calculator result:" + str(ddwBmi)
+        self.send_response(200)
+        self.send_header('Content-type','application/json')
+        self.send_header('Access-Control-Allow-Origin', '*')
+        self.end_headers()
+        # Send the html message
+        date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        arrDate = str.split(date, " ")
+        result = {"result": ddwBmi, "instanceId": "pythonServer", "callTime": 
str(arrDate[1])}
+        strResult = json.dumps(result)
+        print "json result:" + strResult
+        self.wfile.write(strResult)
+        return
+
+try:
+    server = HTTPServer(('127.0.0.1', 4540), CalculatorHandler)
+    print 'http server begin:\n'
+    server.serve_forever()
+
+except KeyboardInterrupt:
+    print 'stop'
+    server.socket.close()
\ No newline at end of file
diff --git a/examples/quick_start/mersher-a/conf/auth.yaml 
b/examples/quick_start/mersher-a/conf/auth.yaml
new file mode 100644
index 0000000..56d7e02
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/auth.yaml
@@ -0,0 +1,7 @@
+## Huawei Public Cloud ak/sk
+cse:
+  credentials:
+    accessKey:
+    secretKey:
+    project:
+    akskCustomCipher: default #used to decrypt sk when it is encrypted
diff --git a/examples/quick_start/mersher-a/conf/chassis.yaml 
b/examples/quick_start/mersher-a/conf/chassis.yaml
new file mode 100644
index 0000000..2361c2b
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/chassis.yaml
@@ -0,0 +1,137 @@
+---
+cse:
+  protocols:
+    grpc:
+      listenAddress: 192.168.88.64:40107
+    http:
+      listenAddress: 192.168.88.64:30111
+    rest-admin:
+      listenAddress: 192.168.88.64:30112 # listen addr use to adminAPI
+  service:
+    registry:
+      address: http://127.0.0.1:30100 # uri of service center
+      #address: https://cse.cn-north-1.myhuaweicloud.com:443 # uri of service 
center
+      scope: full #set full to be able to discover other app's service
+      watch: false # set if you want to watch instance change event
+      autoIPIndex: true # set to true if u want to resolve source IP to 
microservice
+  #  config:
+  #    client:
+  #      serverUri: https://cse.cn-north-1.myhuaweicloud.com:443 #uri of 
config center
+  #      refreshMode: 1 # 1: only pull config.
+  #      refreshInterval: 30 # unit is second
+  #  monitor: #Send monitoring data to CSE monitor Server
+  #    client:
+  #      serverUri: https://cse.cn-north-1.myhuaweicloud.com:443   # monitor 
server url
+  handler:
+    chain:
+      Consumer:
+        outgoing:  #tracing-consumer #consumer handlers
+        #If registry type is pilot then to make sure traffic goes through 
mesher provider new handler needs to be added to consumer after loadbalance 
handler
+        #ex: router, ratelimiter-consumer, bizkeeper-consumer, loadbalance, 
port-selector, transport
+      Provider:
+        incoming:   #tracing-provider,bizkeeper-provider #provider handlers
+#  loadbalance:
+#    strategy:
+#      name: RoundRobin  # Random|RoundRobin|SessionStickiness
+#    retryEnabled: false # if there is error, retry request or not
+#    retryOnNext: 2      # times to switch to another instance based on 
strategy
+#    retryOnSame: 3      # times to retry on the same instance
+#    backoff:            # backoff policy of retried request
+#      kind: constant    # jittered/constant/zero
+#      MinMs: 200        # millisecond, Minimum duration to backoff
+#      MaxMs: 400        # millisecond, Maximum duration to backoff
+## circuit breaker configurations
+#  isolation:
+#    Consumer:
+#      timeout:
+#        enabled: true
+#      timeoutInMilliseconds: 500
+#      maxConcurrentRequests: 10
+#    Provider:
+#      timeout:
+#        enabled: true
+#      timeoutInMilliseconds: 500
+#      maxConcurrentRequests: 10
+#  circuitBreaker:
+#    Consumer:
+#      enabled: true
+#      forceOpen: false
+#      forceClosed: false
+#      sleepWindowInMilliseconds: 10000
+#      requestVolumeThreshold: 1
+#      errorThresholdPercentage: 1
+#    Provider:
+#      enabled: true
+#      forceOpen: true
+#      forceClosed: false
+#      sleepWindowInMilliseconds: 10000
+#      requestVolumeThreshold: 1
+#      errorThresholdPercentage: 20
+#  fallback:
+#    Consumer:
+#      enabled: true
+#      maxConcurrentRequests: 1
+#    Provider:
+#      enabled: true
+#      maxConcurrentRequests: 1
+#  fallbackpolicy:
+#    Consumer:
+#      policy: returnnull
+#    Provider:
+#      policy: returnnull
+#  flowcontrol:
+#    Consumer: # for consumer
+#      qps:
+#        enabled: true  # enable rate limiting or not
+#        global:
+#          limit: 100   # default limit of consumer
+#        limit:
+#          Server: 100  # rate limit for request to a provider,it represents 
100 request per second
+#    Provider:
+#      qps:
+#        enabled: true  # enable rate limiting or not
+#        global:
+#          limit: 100   # default limit of provider
+#        limit:
+#          Server: 100  # rate limit for request from a provider, it 
represents 100 request per second
+
+#ssl:
+## Set those config to make mesher as https service
+#  mesher.Provider.cipherPlugin: default
+#  mesher.Provider.verifyPeer: false
+#  mesher.Provider.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  mesher.Provider.protocol: TLSv1.2
+#  mesher.Provider.caFile:
+#  mesher.Provider.certFile:
+#  mesher.Provider.keyFile:
+#  mesher.Provider.certPwdFile:
+## Mesher TLS is base on Go Chassis TLS config
+## If users wan't to use transparent, ssl config for consumer and provider 
must be supplied.
+## The provider is the service which run in the same host/pod with mesher. for 
example the service name of provider is AccountService, then the ssl tag is 
AccountService.rest.Provider
+## if u set this , no need to consider about expose your own service as https 
service,
+## your service can only listen on 127.0.0.1, mesher wil expose https and use 
http to communicate with your service
+#  AccountService.rest.Provider.cipherPlugin: default
+#  AccountService.rest.Provider.verifyPeer: false
+#  AccountService.rest.Provider.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  AccountService.rest.Provider.protocol: TLSv1.2
+#  AccountService.rest.Provider.caFile:
+#  AccountService.rest.Provider.certFile:
+#  AccountService.rest.Provider.keyFile:
+#  AccountService.rest.Provider.certPwdFile:
+## If a service want to use transparent tls to call other services, it must 
supplies consumer ssl config for these services.
+## for example StoreWeb want to communicate with Account service the  config 
is like below
+#  AccountService.rest.Consumer.cipherPlugin: default
+#  AccountService.rest.Consumer.verifyPeer: false
+#  AccountService.rest.Consumer.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  AccountService.rest.Consumer.protocol: TLSv1.2
+#  AccountService.rest.Consumer.caFile:
+#  AccountService.rest.Consumer.certFile:
+#  AccountService.rest.Consumer.keyFile:
+#  AccountService.rest.Consumer.certPwdFile:
+tracing:
+  enabled: true #enable distribution tracing
+  collectorType: zipkin       #zipkin: Send tracing info to zipkin server
+                              #namedPipe: Write tracing info to linux named 
pipe.
+  collectorTarget: http://127.0.0.1:9411/api/v1/spans #If the collectorType is 
"zipkin", the target is a zipkin server url, if the collecterType is "file" or 
"namedPipe", the target is a file path.
+  batchSize: 1
+  batchInterval: 2s
\ No newline at end of file
diff --git a/examples/quick_start/mersher-a/conf/egress.yaml 
b/examples/quick_start/mersher-a/conf/egress.yaml
new file mode 100644
index 0000000..de36a85
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/egress.yaml
@@ -0,0 +1,17 @@
+#egress:
+#  infra: cse  # pilot or cse
+#  address: http://istio-pilot.istio-system:15010
+#egressRule:
+#  google-ext:
+#    - hosts:
+#        - "google.com"
+#        - "*.yahoo.com"
+#      ports:
+#        - port: 80
+#          protocol: HTTP
+#  facebook-ext:
+#    - hosts:
+#        - "www.facebook.com"
+#      ports:
+#        - port: 80
+#          protocol: HTTP
diff --git a/examples/quick_start/mersher-a/conf/fault.yaml 
b/examples/quick_start/mersher-a/conf/fault.yaml
new file mode 100644
index 0000000..d55c9e7
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/fault.yaml
@@ -0,0 +1,51 @@
+#cse:
+#  governance:
+#    Consumer:
+#      _global: #最低优先级配置
+#        policy: #治理策略 包括fault,loadbalance,circuit 
breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持
+#          fault: #
+#            protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计
+#              rest:
+#                delay:
+#                  fixedDelay: 5
+#                  percent: 10
+#                abort:
+#                  httpStatus: 421
+#                  percent: 100
+#              highway:
+#                delay:
+#                  fixedDelay: 2
+#                  percent: 100
+#                abort:
+#                  percent: 30
+#      ms1:
+#        route: |
+#            - precedence: 2
+#              match:
+#                source: source.service
+#              traffic:
+#                - tags:
+#                    version: 1.0
+#                  weight: 90
+#                - tags:
+#                    version: 1.1
+#                  weight: 10
+#                  policy:
+#                    fault:
+#                    schemas:
+#                      sid1:
+#                        policy:
+#                          fault:
+#                        operations:
+#                          policy:
+#                            fault:
+#        policy: # 微服务名级别治理策略
+#          fault:
+#        schemas: #schema级别治理策略
+#          sid1:
+#            policy:
+#              fault:
+#            operations: #operation级别治理策略
+#              policy:
+#                fault:
+#    Provider: # format same as Consumer
\ No newline at end of file
diff --git a/examples/quick_start/mersher-a/conf/lager.yaml 
b/examples/quick_start/mersher-a/conf/lager.yaml
new file mode 100644
index 0000000..3788335
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/lager.yaml
@@ -0,0 +1,23 @@
+---
+writers: file,stdout
+# LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL
+logger_level: DEBUG
+
+# LoggerFile: used to output the name of log
+logger_file: log/mesher.log
+
+# LogFormatText: json/plaintext (such as log4j),default to false
+# if set logger_file and log_format_text to true, turns out log4j format log
+log_format_text: false
+
+#rollingPolicy daily/size; defines rotate according to daily or size
+rollingPolicy: size
+
+# MaxDaily of a log file before rotate. By D Days.
+log_rotate_date: 1
+
+# MaxSize of a log file before rotate. By M Bytes.
+log_rotate_size: 10
+
+# Max counts to keep of a log's backup files.
+log_backup_count: 7
\ No newline at end of file
diff --git a/examples/quick_start/mersher-a/conf/mesher.yaml 
b/examples/quick_start/mersher-a/conf/mesher.yaml
new file mode 100644
index 0000000..024810c
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/mesher.yaml
@@ -0,0 +1,23 @@
+## Router rules and fault injection rules are moved to router.yaml
+#plugin:
+#  destinationResolver:
+#    http: host # how to turn host to destination name. default to service 
name,
+
+admin: #admin API
+  goRuntimeMetrics : true # enable metrics
+  enable: true
+
+## enable pprof to profile mesher runtime
+#pprof:
+#  enable: false
+
+
+# this health check will ping local service port to check if service is still 
alive, if service can not reachable, mesher
+# will update status to OUT_OF_SERVICE in service center
+#localHealthCheck:
+#  - port: 8080
+#    uri: /health
+#    interval: 30s
+#    match:
+#      status: 200
+#      body: ok
diff --git a/examples/quick_start/mersher-a/conf/microservice.yaml 
b/examples/quick_start/mersher-a/conf/microservice.yaml
new file mode 100644
index 0000000..dc70a0a
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/microservice.yaml
@@ -0,0 +1,7 @@
+## microservice property
+service_description:
+  name: mersher-provider
+  version: 1.1.1
+  environment:  #microservice environment
+  properties:
+    allowCrossApp: true #whether to allow calls across applications
diff --git a/examples/quick_start/mersher-a/conf/router.yaml 
b/examples/quick_start/mersher-a/conf/router.yaml
new file mode 100644
index 0000000..1146860
--- /dev/null
+++ b/examples/quick_start/mersher-a/conf/router.yaml
@@ -0,0 +1,12 @@
+#routeRule:
+#  ShoppingCart:        #service name
+#    - precedence: 2    #precedence of route rule
+#      route:           #route rule list
+#      - tags:
+#          version: 0.2 
+#          app: HelloWorld 
+#        weight: 80     #weight of 80%
+#      - tags:
+#          version: 1.2
+#          app: HelloWorld
+#        weight: 20     #weight of 20%
\ No newline at end of file
diff --git a/examples/quick_start/mersher-b/conf/auth.yaml 
b/examples/quick_start/mersher-b/conf/auth.yaml
new file mode 100644
index 0000000..56d7e02
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/auth.yaml
@@ -0,0 +1,7 @@
+## Huawei Public Cloud ak/sk
+cse:
+  credentials:
+    accessKey:
+    secretKey:
+    project:
+    akskCustomCipher: default #used to decrypt sk when it is encrypted
diff --git a/examples/quick_start/mersher-b/conf/chassis.yaml 
b/examples/quick_start/mersher-b/conf/chassis.yaml
new file mode 100644
index 0000000..71f12fd
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/chassis.yaml
@@ -0,0 +1,120 @@
+---
+cse:
+  protocols:
+    grpc:
+      listenAddress: 192.168.88.64:40102
+    http:
+      listenAddress: 192.168.88.64:30108
+    rest-admin:
+      listenAddress: 192.168.88.64:30109 # listen addr use to adminAPI
+  service:
+    registry:
+      address: http://127.0.0.1:30100 # uri of service center
+      #address: https://cse.cn-north-1.myhuaweicloud.com:443 # uri of service 
center
+      scope: full #set full to be able to discover other app's service
+      watch: false # set if you want to watch instance change event
+      autoIPIndex: true # set to true if u want to resolve source IP to 
microservice
+  #  config:
+  #    client:
+  #      serverUri: https://cse.cn-north-1.myhuaweicloud.com:443 #uri of 
config center
+  #      refreshMode: 1 # 1: only pull config.
+  #      refreshInterval: 30 # unit is second
+  #  monitor: #Send monitoring data to CSE monitor Server
+  #    client:
+  #      serverUri: https://cse.cn-north-1.myhuaweicloud.com:443   # monitor 
server url
+  handler:
+    chain:
+      Consumer:
+        outgoing:  #consumer handlers
+        #If registry type is pilot then to make sure traffic goes through 
mesher provider new handler needs to be added to consumer after loadbalance 
handler
+        #ex: router, ratelimiter-consumer, bizkeeper-consumer, loadbalance, 
port-selector, transport
+      Provider:
+        incoming:   #provider handlers
+#  loadbalance:
+#    strategy:
+#      name: RoundRobin  # Random|RoundRobin|SessionStickiness
+#    retryEnabled: false # if there is error, retry request or not
+#    retryOnNext: 2      # times to switch to another instance based on 
strategy
+#    retryOnSame: 3      # times to retry on the same instance
+#    backoff:            # backoff policy of retried request
+#      kind: constant    # jittered/constant/zero
+#      MinMs: 200        # millisecond, Minimum duration to backoff
+#      MaxMs: 400        # millisecond, Maximum duration to backoff
+## circuit breaker configurations
+#  isolation:
+#    Consumer:
+#      timeout:
+#        enabled: true
+#      timeoutInMilliseconds: 1000
+#      maxConcurrentRequests: 100
+#  circuitBreaker:
+#    Consumer:
+#      enabled: true
+#      forceOpen: false
+#      forceClosed: false
+#      sleepWindowInMilliseconds: 10000
+#      requestVolumeThreshold: 20
+#      errorThresholdPercentage: 50
+#  fallback:
+#    Consumer:
+#      enabled: true
+#      maxConcurrentRequests: 20
+#  fallbackpolicy:
+#    Consumer:
+#      policy: throwexception
+#  flowcontrol:
+#    Consumer: # for consumer
+#      qps:
+#        enabled: true  # enable rate limiting or not
+#        global:
+#          limit: 100   # default limit of consumer
+#        limit:
+#          Server: 100  # rate limit for request to a provider,it represents 
100 request per second
+#    Provider:
+#      qps:
+#        enabled: true  # enable rate limiting or not
+#        global:
+#          limit: 100   # default limit of provider
+#        limit:
+#          Server: 100  # rate limit for request from a provider, it 
represents 100 request per second
+
+#ssl:
+## Set those config to make mesher as https service
+#  mesher.Provider.cipherPlugin: default
+#  mesher.Provider.verifyPeer: false
+#  mesher.Provider.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  mesher.Provider.protocol: TLSv1.2
+#  mesher.Provider.caFile:
+#  mesher.Provider.certFile:
+#  mesher.Provider.keyFile:
+#  mesher.Provider.certPwdFile:
+## Mesher TLS is base on Go Chassis TLS config
+## If users wan't to use transparent, ssl config for consumer and provider 
must be supplied.
+## The provider is the service which run in the same host/pod with mesher. for 
example the service name of provider is AccountService, then the ssl tag is 
AccountService.rest.Provider
+## if u set this , no need to consider about expose your own service as https 
service,
+## your service can only listen on 127.0.0.1, mesher wil expose https and use 
http to communicate with your service
+#  AccountService.rest.Provider.cipherPlugin: default
+#  AccountService.rest.Provider.verifyPeer: false
+#  AccountService.rest.Provider.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  AccountService.rest.Provider.protocol: TLSv1.2
+#  AccountService.rest.Provider.caFile:
+#  AccountService.rest.Provider.certFile:
+#  AccountService.rest.Provider.keyFile:
+#  AccountService.rest.Provider.certPwdFile:
+## If a service want to use transparent tls to call other services, it must 
supplies consumer ssl config for these services.
+## for example StoreWeb want to communicate with Account service the  config 
is like below
+#  AccountService.rest.Consumer.cipherPlugin: default
+#  AccountService.rest.Consumer.verifyPeer: false
+#  AccountService.rest.Consumer.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  AccountService.rest.Consumer.protocol: TLSv1.2
+#  AccountService.rest.Consumer.caFile:
+#  AccountService.rest.Consumer.certFile:
+#  AccountService.rest.Consumer.keyFile:
+#  AccountService.rest.Consumer.certPwdFile:
+tracing:
+  enabled: true #enable distribution tracing
+  collectorType: zipkin       #zipkin: Send tracing info to zipkin server
+                              #namedPipe: Write tracing info to linux named 
pipe.
+  collectorTarget: http://127.0.0.1:9411/api/v1/spans #If the collectorType is 
"zipkin", the target is a zipkin server url, if the collecterType is "file" or 
"namedPipe", the target is a file path.
+  batchSize: 1
+  batchInterval: 2s
\ No newline at end of file
diff --git a/examples/quick_start/mersher-b/conf/egress.yaml 
b/examples/quick_start/mersher-b/conf/egress.yaml
new file mode 100644
index 0000000..de36a85
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/egress.yaml
@@ -0,0 +1,17 @@
+#egress:
+#  infra: cse  # pilot or cse
+#  address: http://istio-pilot.istio-system:15010
+#egressRule:
+#  google-ext:
+#    - hosts:
+#        - "google.com"
+#        - "*.yahoo.com"
+#      ports:
+#        - port: 80
+#          protocol: HTTP
+#  facebook-ext:
+#    - hosts:
+#        - "www.facebook.com"
+#      ports:
+#        - port: 80
+#          protocol: HTTP
diff --git a/examples/quick_start/mersher-b/conf/fault.yaml 
b/examples/quick_start/mersher-b/conf/fault.yaml
new file mode 100644
index 0000000..d55c9e7
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/fault.yaml
@@ -0,0 +1,51 @@
+#cse:
+#  governance:
+#    Consumer:
+#      _global: #最低优先级配置
+#        policy: #治理策略 包括fault,loadbalance,circuit 
breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持
+#          fault: #
+#            protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计
+#              rest:
+#                delay:
+#                  fixedDelay: 5
+#                  percent: 10
+#                abort:
+#                  httpStatus: 421
+#                  percent: 100
+#              highway:
+#                delay:
+#                  fixedDelay: 2
+#                  percent: 100
+#                abort:
+#                  percent: 30
+#      ms1:
+#        route: |
+#            - precedence: 2
+#              match:
+#                source: source.service
+#              traffic:
+#                - tags:
+#                    version: 1.0
+#                  weight: 90
+#                - tags:
+#                    version: 1.1
+#                  weight: 10
+#                  policy:
+#                    fault:
+#                    schemas:
+#                      sid1:
+#                        policy:
+#                          fault:
+#                        operations:
+#                          policy:
+#                            fault:
+#        policy: # 微服务名级别治理策略
+#          fault:
+#        schemas: #schema级别治理策略
+#          sid1:
+#            policy:
+#              fault:
+#            operations: #operation级别治理策略
+#              policy:
+#                fault:
+#    Provider: # format same as Consumer
\ No newline at end of file
diff --git a/examples/quick_start/mersher-b/conf/lager.yaml 
b/examples/quick_start/mersher-b/conf/lager.yaml
new file mode 100644
index 0000000..3788335
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/lager.yaml
@@ -0,0 +1,23 @@
+---
+writers: file,stdout
+# LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL
+logger_level: DEBUG
+
+# LoggerFile: used to output the name of log
+logger_file: log/mesher.log
+
+# LogFormatText: json/plaintext (such as log4j),default to false
+# if set logger_file and log_format_text to true, turns out log4j format log
+log_format_text: false
+
+#rollingPolicy daily/size; defines rotate according to daily or size
+rollingPolicy: size
+
+# MaxDaily of a log file before rotate. By D Days.
+log_rotate_date: 1
+
+# MaxSize of a log file before rotate. By M Bytes.
+log_rotate_size: 10
+
+# Max counts to keep of a log's backup files.
+log_backup_count: 7
\ No newline at end of file
diff --git a/examples/quick_start/mersher-b/conf/mesher.yaml 
b/examples/quick_start/mersher-b/conf/mesher.yaml
new file mode 100644
index 0000000..024810c
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/mesher.yaml
@@ -0,0 +1,23 @@
+## Router rules and fault injection rules are moved to router.yaml
+#plugin:
+#  destinationResolver:
+#    http: host # how to turn host to destination name. default to service 
name,
+
+admin: #admin API
+  goRuntimeMetrics : true # enable metrics
+  enable: true
+
+## enable pprof to profile mesher runtime
+#pprof:
+#  enable: false
+
+
+# this health check will ping local service port to check if service is still 
alive, if service can not reachable, mesher
+# will update status to OUT_OF_SERVICE in service center
+#localHealthCheck:
+#  - port: 8080
+#    uri: /health
+#    interval: 30s
+#    match:
+#      status: 200
+#      body: ok
diff --git a/examples/quick_start/mersher-b/conf/microservice.yaml 
b/examples/quick_start/mersher-b/conf/microservice.yaml
new file mode 100644
index 0000000..dc70a0a
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/microservice.yaml
@@ -0,0 +1,7 @@
+## microservice property
+service_description:
+  name: mersher-provider
+  version: 1.1.1
+  environment:  #microservice environment
+  properties:
+    allowCrossApp: true #whether to allow calls across applications
diff --git a/examples/quick_start/mersher-b/conf/router.yaml 
b/examples/quick_start/mersher-b/conf/router.yaml
new file mode 100644
index 0000000..1146860
--- /dev/null
+++ b/examples/quick_start/mersher-b/conf/router.yaml
@@ -0,0 +1,12 @@
+#routeRule:
+#  ShoppingCart:        #service name
+#    - precedence: 2    #precedence of route rule
+#      route:           #route rule list
+#      - tags:
+#          version: 0.2 
+#          app: HelloWorld 
+#        weight: 80     #weight of 80%
+#      - tags:
+#          version: 1.2
+#          app: HelloWorld
+#        weight: 20     #weight of 20%
\ No newline at end of file
diff --git a/examples/quick_start/mersher-g/conf/auth.yaml 
b/examples/quick_start/mersher-g/conf/auth.yaml
new file mode 100644
index 0000000..56d7e02
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/auth.yaml
@@ -0,0 +1,7 @@
+## Huawei Public Cloud ak/sk
+cse:
+  credentials:
+    accessKey:
+    secretKey:
+    project:
+    akskCustomCipher: default #used to decrypt sk when it is encrypted
diff --git a/examples/quick_start/mersher-g/conf/chassis.yaml 
b/examples/quick_start/mersher-g/conf/chassis.yaml
new file mode 100644
index 0000000..1129aac
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/chassis.yaml
@@ -0,0 +1,120 @@
+---
+cse:
+  protocols:
+    grpc:
+      listenAddress: 192.168.88.64:40101
+    http:
+      listenAddress: 192.168.88.64:30101
+    rest-admin:
+      listenAddress: 192.168.88.64:30102 # listen addr use to adminAPI
+  service:
+    registry:
+      address: http://127.0.0.1:30100 # uri of service center
+      #address: https://cse.cn-north-1.myhuaweicloud.com:443 # uri of service 
center
+      scope: full #set full to be able to discover other app's service
+      watch: false # set if you want to watch instance change event
+      autoIPIndex: true # set to true if u want to resolve source IP to 
microservice
+  #  config:
+  #    client:
+  #      serverUri: https://cse.cn-north-1.myhuaweicloud.com:443 #uri of 
config center
+  #      refreshMode: 1 # 1: only pull config.
+  #      refreshInterval: 30 # unit is second
+  #  monitor: #Send monitoring data to CSE monitor Server
+  #    client:
+  #      serverUri: https://cse.cn-north-1.myhuaweicloud.com:443   # monitor 
server url
+  handler:
+    chain:
+      Consumer:
+        outgoing:  #consumer handlers
+        #If registry type is pilot then to make sure traffic goes through 
mesher provider new handler needs to be added to consumer after loadbalance 
handler
+        #ex: router, ratelimiter-consumer, bizkeeper-consumer, loadbalance, 
port-selector, transport
+      Provider:
+        incoming:   #provider handlers
+#  loadbalance:
+#    strategy:
+#      name: RoundRobin  # Random|RoundRobin|SessionStickiness
+#    retryEnabled: false # if there is error, retry request or not
+#    retryOnNext: 2      # times to switch to another instance based on 
strategy
+#    retryOnSame: 3      # times to retry on the same instance
+#    backoff:            # backoff policy of retried request
+#      kind: constant    # jittered/constant/zero
+#      MinMs: 200        # millisecond, Minimum duration to backoff
+#      MaxMs: 400        # millisecond, Maximum duration to backoff
+## circuit breaker configurations
+#  isolation:
+#    Consumer:
+#      timeout:
+#        enabled: true
+#      timeoutInMilliseconds: 1000
+#      maxConcurrentRequests: 1
+#  circuitBreaker:
+#    Consumer:
+#      enabled: true
+#      forceOpen: false
+#      forceClosed: false
+#      sleepWindowInMilliseconds: 10000
+#      requestVolumeThreshold: 1
+#      errorThresholdPercentage: 1
+#  fallback:
+#    Consumer:
+#      enabled: true
+#      maxConcurrentRequests: 1
+#  fallbackpolicy:
+#    Consumer:
+#      policy: returnnull
+#  flowcontrol:
+#    Consumer: # for consumer
+#      qps:
+#        enabled: true  # enable rate limiting or not
+#        global:
+#          limit: 100   # default limit of consumer
+#        limit:
+#          Server: 100  # rate limit for request to a provider,it represents 
100 request per second
+#    Provider:
+#      qps:
+#        enabled: true  # enable rate limiting or not
+#        global:
+#          limit: 100   # default limit of provider
+#        limit:
+#          Server: 100  # rate limit for request from a provider, it 
represents 100 request per second
+
+#ssl:
+## Set those config to make mesher as https service
+#  mesher.Provider.cipherPlugin: default
+#  mesher.Provider.verifyPeer: false
+#  mesher.Provider.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  mesher.Provider.protocol: TLSv1.2
+#  mesher.Provider.caFile:
+#  mesher.Provider.certFile:
+#  mesher.Provider.keyFile:
+#  mesher.Provider.certPwdFile:
+## Mesher TLS is base on Go Chassis TLS config
+## If users wan't to use transparent, ssl config for consumer and provider 
must be supplied.
+## The provider is the service which run in the same host/pod with mesher. for 
example the service name of provider is AccountService, then the ssl tag is 
AccountService.rest.Provider
+## if u set this , no need to consider about expose your own service as https 
service,
+## your service can only listen on 127.0.0.1, mesher wil expose https and use 
http to communicate with your service
+#  AccountService.rest.Provider.cipherPlugin: default
+#  AccountService.rest.Provider.verifyPeer: false
+#  AccountService.rest.Provider.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  AccountService.rest.Provider.protocol: TLSv1.2
+#  AccountService.rest.Provider.caFile:
+#  AccountService.rest.Provider.certFile:
+#  AccountService.rest.Provider.keyFile:
+#  AccountService.rest.Provider.certPwdFile:
+## If a service want to use transparent tls to call other services, it must 
supplies consumer ssl config for these services.
+## for example StoreWeb want to communicate with Account service the  config 
is like below
+#  AccountService.rest.Consumer.cipherPlugin: default
+#  AccountService.rest.Consumer.verifyPeer: false
+#  AccountService.rest.Consumer.cipherSuits: 
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
+#  AccountService.rest.Consumer.protocol: TLSv1.2
+#  AccountService.rest.Consumer.caFile:
+#  AccountService.rest.Consumer.certFile:
+#  AccountService.rest.Consumer.keyFile:
+#  AccountService.rest.Consumer.certPwdFile:
+tracing:
+  enabled: true #enable distribution tracing
+  collectorType: zipkin       #zipkin: Send tracing info to zipkin server
+#                              #namedPipe: Write tracing info to linux named 
pipe.
+  collectorTarget: http://127.0.0.1:9411/api/v1/spans #If the collectorType is 
"zipkin", the target is a zipkin server url, if the collecterType is "file" or 
"namedPipe", the target is a file path.
+  batchSize: 1
+  batchInterval: 2s
\ No newline at end of file
diff --git a/examples/quick_start/mersher-g/conf/egress.yaml 
b/examples/quick_start/mersher-g/conf/egress.yaml
new file mode 100644
index 0000000..de36a85
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/egress.yaml
@@ -0,0 +1,17 @@
+#egress:
+#  infra: cse  # pilot or cse
+#  address: http://istio-pilot.istio-system:15010
+#egressRule:
+#  google-ext:
+#    - hosts:
+#        - "google.com"
+#        - "*.yahoo.com"
+#      ports:
+#        - port: 80
+#          protocol: HTTP
+#  facebook-ext:
+#    - hosts:
+#        - "www.facebook.com"
+#      ports:
+#        - port: 80
+#          protocol: HTTP
diff --git a/examples/quick_start/mersher-g/conf/fault.yaml 
b/examples/quick_start/mersher-g/conf/fault.yaml
new file mode 100644
index 0000000..d55c9e7
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/fault.yaml
@@ -0,0 +1,51 @@
+#cse:
+#  governance:
+#    Consumer:
+#      _global: #最低优先级配置
+#        policy: #治理策略 包括fault,loadbalance,circuit 
breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持
+#          fault: #
+#            protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计
+#              rest:
+#                delay:
+#                  fixedDelay: 5
+#                  percent: 10
+#                abort:
+#                  httpStatus: 421
+#                  percent: 100
+#              highway:
+#                delay:
+#                  fixedDelay: 2
+#                  percent: 100
+#                abort:
+#                  percent: 30
+#      ms1:
+#        route: |
+#            - precedence: 2
+#              match:
+#                source: source.service
+#              traffic:
+#                - tags:
+#                    version: 1.0
+#                  weight: 90
+#                - tags:
+#                    version: 1.1
+#                  weight: 10
+#                  policy:
+#                    fault:
+#                    schemas:
+#                      sid1:
+#                        policy:
+#                          fault:
+#                        operations:
+#                          policy:
+#                            fault:
+#        policy: # 微服务名级别治理策略
+#          fault:
+#        schemas: #schema级别治理策略
+#          sid1:
+#            policy:
+#              fault:
+#            operations: #operation级别治理策略
+#              policy:
+#                fault:
+#    Provider: # format same as Consumer
\ No newline at end of file
diff --git a/examples/quick_start/mersher-g/conf/lager.yaml 
b/examples/quick_start/mersher-g/conf/lager.yaml
new file mode 100644
index 0000000..3788335
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/lager.yaml
@@ -0,0 +1,23 @@
+---
+writers: file,stdout
+# LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL
+logger_level: DEBUG
+
+# LoggerFile: used to output the name of log
+logger_file: log/mesher.log
+
+# LogFormatText: json/plaintext (such as log4j),default to false
+# if set logger_file and log_format_text to true, turns out log4j format log
+log_format_text: false
+
+#rollingPolicy daily/size; defines rotate according to daily or size
+rollingPolicy: size
+
+# MaxDaily of a log file before rotate. By D Days.
+log_rotate_date: 1
+
+# MaxSize of a log file before rotate. By M Bytes.
+log_rotate_size: 10
+
+# Max counts to keep of a log's backup files.
+log_backup_count: 7
\ No newline at end of file
diff --git a/examples/quick_start/mersher-g/conf/mesher.yaml 
b/examples/quick_start/mersher-g/conf/mesher.yaml
new file mode 100644
index 0000000..024810c
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/mesher.yaml
@@ -0,0 +1,23 @@
+## Router rules and fault injection rules are moved to router.yaml
+#plugin:
+#  destinationResolver:
+#    http: host # how to turn host to destination name. default to service 
name,
+
+admin: #admin API
+  goRuntimeMetrics : true # enable metrics
+  enable: true
+
+## enable pprof to profile mesher runtime
+#pprof:
+#  enable: false
+
+
+# this health check will ping local service port to check if service is still 
alive, if service can not reachable, mesher
+# will update status to OUT_OF_SERVICE in service center
+#localHealthCheck:
+#  - port: 8080
+#    uri: /health
+#    interval: 30s
+#    match:
+#      status: 200
+#      body: ok
diff --git a/examples/quick_start/mersher-g/conf/microservice.yaml 
b/examples/quick_start/mersher-g/conf/microservice.yaml
new file mode 100644
index 0000000..83e53c2
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/microservice.yaml
@@ -0,0 +1,7 @@
+## microservice property
+service_description:
+  name: mersher-consumer
+  version: 0.0.1
+  environment:  #microservice environment
+  properties:
+    allowCrossApp: true #whether to allow calls across applications
diff --git a/examples/quick_start/mersher-g/conf/router.yaml 
b/examples/quick_start/mersher-g/conf/router.yaml
new file mode 100644
index 0000000..d2bc227
--- /dev/null
+++ b/examples/quick_start/mersher-g/conf/router.yaml
@@ -0,0 +1,10 @@
+#routeRule:
+#  mersher-provider:        #service name
+#    - precedence: 2    #precedence of route rule
+#      route:           #route rule list
+#      - tags:
+#          version: 1.1.1
+#        weight: 50     #weight of 20%
+#      - tags:
+#          version: 1.1.2
+#        weight: 50     #weight of 20%
\ No newline at end of file
diff --git a/examples/quick_start/webapp/application.yaml 
b/examples/quick_start/webapp/application.yaml
new file mode 100644
index 0000000..e4bad11
--- /dev/null
+++ b/examples/quick_start/webapp/application.yaml
@@ -0,0 +1,33 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+zuul:
+  routes:
+    calculator: /calculator/**
+
+# disable netflix eurkea since it's not used for service discovery
+ribbon:
+  eureka:
+    enabled: false
+
+server:
+  address: 192.168.88.64
+  port: 8889
+
+servicecomb:
+  tracing:
+    enabled: false
diff --git a/examples/quick_start/webapp/index.html 
b/examples/quick_start/webapp/index.html
new file mode 100644
index 0000000..c7681e8
--- /dev/null
+++ b/examples/quick_start/webapp/index.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML>
+<!--
+  ~ 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.
+  -->
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, 
shrink-to-fit=no">
+
+    <link rel="stylesheet" 
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css";
 
integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M"
 crossorigin="anonymous">
+    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
+    <script src="https://code.jquery.com/jquery-3.2.1.min.js"; 
crossorigin="anonymous"></script>
+    <script 
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"; 
integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4"
 crossorigin="anonymous"></script>
+    <script 
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"; 
integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1"
 crossorigin="anonymous"></script>
+  </head>
+  <body>
+    <div class="container">
+
+      <div class="col-md-1"></div>
+      <div class="col-md-10">
+        <h2 align="center">BMI Calculator</h2>
+
+        <div class="form-group">
+          <label for="height" class="col-form-label"><b>Height(cm):</b></label>
+          <input type="number" class="form-control" id="height" name="height" 
placeholder="Please input your height">
+        </div>
+        <div class="form-group">
+            <label for="weight" 
class="col-form-label"><b>Weight(kg):</b></label>
+            <input type="number" class="form-control" id="weight" 
name="weight" placeholder="Please input your weight">
+        </div>
+        <button type="submit" class="btn btn-primary" 
id="submit">Submit</button>
+
+        <br/>
+        <div class="alert alert-light" role="alert" id="bmi">
+          <h3>BMI Result: <span id="bmi_result"></span></h3>
+          <h3>BMI Instance ID: <span id="bmi_instanceId"></span></h3>
+          <h3>BMI Called Time: <span id="bmi_callTime"></span></h3>
+        </div>
+        <div class="alert alert-secondary" role="alert">
+          <b>Note: </b>Range of healthy weight is between <b>18.5</b> and 
<b>24.9</b>.
+        </div>
+        <div id="error" class="alert alert-danger" role="alert"><p 
id="error_message"></p></div>
+      </div>
+    </div>
+
+  </body>
+  <script>
+      $("#error").hide();
+      $("#submit").click(function () {
+        if ( !$("#height").val() || !$("#weight").val() ) {
+          alert("Please input both the height and weight");
+          return;
+        }
+        $.ajax({
+          url: "http://192.168.88.64:4538/bmi?height="; + $("#height").val() + 
"&weight=" + $("#weight").val(),
+          type: "GET",
+          success: function (data) {
+            $("#error").hide();
+            $("#bmi_result").text(data.result);
+            $("#bmi_instanceId").text(data.instanceId);
+            $("#bmi_callTime").text(data.callTime);
+            if ( data.result < 18.5 || (data.result < 30 && data.result >= 25) 
) {
+              
$("#bmi").removeClass().addClass("alert").addClass("alert-warning");
+            } else if ( data.result < 25 && data.result >= 18.5 ) {
+              
$("#bmi").removeClass().addClass("alert").addClass("alert-success");
+            } else {
+              
$("#bmi").removeClass().addClass("alert").addClass("alert-danger");
+            }
+          },
+          error: function (xhr) {
+            $("#bmi").removeClass().addClass("alert").addClass("alert-light");
+            $("#bmi_result").text('');
+            if (xhr.responseText.length == 0) {
+              $("#error_message").text("empty fallback called");
+              
$("#error").removeClass().addClass("alert").addClass("alert-success").show();
+              return;
+            }
+            var resp = JSON.parse(xhr.responseText);
+            if (xhr.status == 429) {
+              $("#error_message").text(resp.message);
+              
$("#error").removeClass().addClass("alert").addClass("alert-danger").show();
+            } else {
+              $("#error_message").text(resp.error + ": " + resp.exception)
+              
$("#error").removeClass().addClass("alert").addClass("alert-danger").show();
+            }
+          }
+        });
+      });
+    </script>
+
+</html>

Reply via email to