Skip to content

Commit

Permalink
Optimize docs (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
AngLi2 authored and tianxiaoliang committed Nov 28, 2019
1 parent 91d11d2 commit 75a8c6d
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 151 deletions.
10 changes: 5 additions & 5 deletions docs/configurations/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

### Configurations

admin api server leverage protocol server, it listens on isolated port, by default admin is enabled, and default value of goRuntimeMetrics is false.
Admin API server leverages protocol server, it listens on isolated port. By default admin is enabled, and default value of goRuntimeMetrics is false.

To start api server, set protocol server config in chassis.yaml
To start API server, set protocol server config in chassis.yaml:
```yaml
cse:
protocols:
rest-admin:
listenAddress: 0.0.0.0:30102 # listen addr for adminAPI
listenAddress: 0.0.0.0:30102 # listen addr for admin API
```

tune admin api in mesher.yaml
Tune admin api in mesher.yaml:
```yaml
admin:
enable: true
```


**admin.enable**
>*(optional, bool)* default is false
>*(optional, bool)* Default is false

18 changes: 9 additions & 9 deletions docs/configurations/cli.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Mesher command Line
when you start mesher process, you can use mesher command line to specify configurations like below
When you start a mesher process, you can use mesher command line to specify configurations as follows:
```shell
mesher --config=mesher.yaml --service-ports=rest:8080
```


### Options


**--config**
>*(optional, string)* the path to mesher configuration file, default value is {current_bin_work_dir}/conf/mesher.yaml

>*(optional, string)* The path to mesher configuration file, default value is {current_bin_work_dir}/conf/mesher.yaml
**--mode**
>*(optional, string)* mesher has 2 work mode, sidecar and edge, default is sidecar

>*(optional, string)* Mesher has 2 work modes, sidecar and edge, default is sidecar
**--service-ports**
>*(optional, string)* running as sidecar, mesher need to know local service ports,

>*(optional, string)* Running as sidecar, mesher needs to know local service ports,
this is to tell mesher service port list,
The value format is {protocol}-{suffix} or {protocol}
if service has multiple protocol, you can separate with comma "rest-admin:8080,grpc:9000".
default is empty, in that case mesher will use header X-Forwarded-Port as local service port,
if it is empty also mesher can not communicate to your local service
The value format is {protocol}-{suffix} or {protocol}.
If service has multiple protocols, you can separate with comma "rest-admin:8080, grpc:9000",
default is empty. In that case mesher will use header X-Forwarded-Port as local service port,
if header X-Forwarded-Port is also empty, mesher can not communicate to your local service.
7 changes: 4 additions & 3 deletions docs/configurations/destination_resolver.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Destination Resolver

Destination Resolver is a module to parse each protocol request to get a target service name.
you can write your own resolver implementation for different protocol.
You can write your own resolver implementation for different protocols.

## Configurations

example
Example:
```yaml
plugin:
destinationResolver:
Expand All @@ -16,5 +16,6 @@ plugin:


**plugin.destinationResolver**
>*(optional, map)* here you can define what kind of resolver, a protocol should use

>*(optional, map)* Define what kind of resolver, a protocol should use
38 changes: 20 additions & 18 deletions docs/configurations/edge.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
# API gateway
mesher is able to work as a API gateway to mange traffic,to run mesher as an API gateway
Mesher is able to work as a API gateway to mange traffic, to run mesher as an API gateway:
```shell
mesher --config=mesher.yaml --mode edge
```
the ingress rule is in mesher.yaml
The ingress rule is in mesher.yaml.

### Options

**mesher.ingress.type**
>*(optional, string)* default is servicecomb, it reads servicecomb ingress rule.
>it is a plugin, you can custom your own implementation
>*(optional, string)* Default is servicecomb, it reads servicecomb ingress rule.
>It is a plugin, you can custom your own implementation.
**mesher.ingress.rule.http**
>*(optional, string)* rule about how to forward http traffic. it holds a yaml content as rule.

below explain the content, the rule list is like a filter, all the request will go through this rule list until match one rule.
>*(optional, string)* Rule about how to forward http traffic. It holds a yaml content as rule.


Below explaining the content, the rule list is like a filter, all the request will go through this rule list until matching one rule.

**apiPath**
>*(required, string)* if request's url match this, it will use this rule

>*(required, string)* If request's url matches this, it will use this rule.
**host**
>*(optional, string)* if request HOST match this, mesher will use this rule, it can be empty,
>if you set both host and apiPath, the request's host and api path must match them at the same time
>*(optional, string)* If request HOST matches this, mesher will use this rule. It can be empty.
>If you set both host and apiPath, the request's host and api path must match them both.
>
**service.name**
>*(required, string)* target backend service name in registry service(like ServiceComb service center)
>*(required, string)* Target back-end service name in registry service (like ServiceComb service center).
>
**service.redirectPath**
>*(optional, string)* by default, mesher use original request's url
>*(optional, string)* By default, mesher uses original request's url.
>
**service.port.value**
>*(optional, string)* if you use java chassis or go chassis to develop backend service, no need to set it.
>but if your backend service use mesher-sidecar, you must give your service port here.
>
>*(optional, string)* If using java chassis or go chassis to develop back-end service, no need to set it.
>But if back-end service uses mesher-sidecar, service port must be given here.
### example
```yaml
mesher:
Expand All @@ -59,15 +61,15 @@ mesher:


### Enable TLS
generate private key
Generate private key
```sh
openssl genrsa -out server.key 2048
```
sign cert with private key
Sign cert with private key
```shell script
openssl req -new -x509 -key server.key -out server.crt -days 3650
```
set file path in chassis.yaml
Set file path in chassis.yaml
```yaml
ssl:
mesher-edge.rest.Provider.certFile: server.crt
Expand Down
60 changes: 32 additions & 28 deletions docs/configurations/health.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
# Local Health check
you can use health checker to check local service health,
when service instance is not healthy, mesher will update the instance status in registry service to "DOWN"
so that other service
can not discover this instance. If the service is healthy again, mesher will update status to "UP",
You can use health checker to check local service health.
When service instance is unhealthy, mesher will update the instance status in registry service to "DOWN"
so that other services
can not discover this instance. After the service becoming healthy again, mesher will update the status to "UP",
then other instance can discover it again.
currently this function works only when you use service center as registry

examples:

Check local http service
```yaml
localHealthCheck:
- port: 8080
protocol: rest
uri: /health
interval: 30s
match:
status: 200
body: ok
```
Currently this function works only when using service center as registry.

### Options
Examples:

- Check local http service

```yaml
localHealthCheck:
- port: 8080
protocol: rest
uri: /health
interval: 30s
match:
status: 200
body: ok
```

### Options

**port**
>*(require, string)* must be a port number, mesher is only responsible to check local service,
it use 127.0.0.1:{port} to check service

>*(require, string)* Must be a port number, mesher is only responsible to check local services,
it use 127.0.0.1:{port} to check services.

**protocol**
>*(optional, string)* mesher has a built-in checker "rest",for other protocol,
will use default TCP checker unless you implement your own checker

>*(optional, string)* Mesher has a built-in checker "rest",for other protocols,
will use default TCP checker unless implementing your own checker.

**uri**
>*(optional, string)* uri start with /.

>*(optional, string)* Uri start with /.

**interval**
>*(optional, string)* check interval, you can use number with unit: 1m, 10s.
>*(optional, string)* Check interval, you can use number with unit: 1m, 10s.
**match.status**
>*(optional, string)* the http response status must match status code
>*(optional, string)* The http response status must match status code.
**match.body**
>*(optional, string)* the http response body must match body

>*(optional, string)* The http response body must match body.
10 changes: 5 additions & 5 deletions docs/configurations/profiling.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Profile Mesher

Mesher has a convenience way to enable go pprof, so that you can easily analyze the performance of mesher
Mesher has a convenience way to enable go [pprof]( https://golang.org/pkg/net/http/pprof/ ), so that you can easily analyze the performance of mesher.

## Configurations

Expand All @@ -10,11 +10,11 @@ pprof:
listen: 127.0.0.0.1:6060
```



**enable**
>*(optional, bool)* default is false
>*(optional, bool)* Default is false

**listen**
>*(optional, string)* Listen IP and port

>*(optional, string)* Listen IP and port
6 changes: 3 additions & 3 deletions docs/development/build.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build mesher
you need to build and release your mesher after the customization
You need to build and release your mesher after customization.

### Build binary
you can refer to build/build_proxy to see how we build mesher binary and docker image.
You can refer to build/build_proxy to see how we build mesher binary and docker image.

build/docker/proxy/Dockerfile is a example about how to make a docker image
build/docker/proxy/Dockerfile is a example about making a docker image
17 changes: 9 additions & 8 deletions docs/development/cloud-provider.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# Cloud Provider
By default Mesher do not support any cloud provider.
But there is plugin that helps mesher to do it.
But there is plugin that helps mesher do it.

### Huawei Cloud
Mesher is able to use huawei cloud ServiceComb engine.
#### Access ServiceComb Engine API
import auth in cmd/mesher/mesher.go
Import auth in cmd/mesher/mesher.go
```go
import _ "github.com/huaweicse/auth/adaptor/gochassis"
```

it will sign all requests between mesher to ServiceComb Engine.
It will sign all requests from mesher to ServiceComb Engine.

#### Use Config Center to manage configuration
Mesher use servicecomb-kie as config server,
Mesher uses servicecomb-kie as config server,
```go
_ "github.com/go-chassis/go-chassis-config/servicecombkie"
_ "github.com/apache/servicecomb-kie"
```
when you need to use ServiceComb Engine, you must replace this line.
import config center in cmd/mesher/mesher.go.
When you need to use ServiceComb Engine, you must replace this line.
Import config center in cmd/mesher/mesher.go.

```go
_ "github.com/go-chassis/go-chassis-config/configcenter"
```
set the config center in chassis.yaml
Set the config center in chassis.yaml
```yaml
config:
client:
Expand Down
28 changes: 15 additions & 13 deletions docs/development/handler-chain.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# Handler chain
all the traffic will go through the handler chain.
All the traffic will go through the handler chain.
A chain is composite of handlers, each handler has a particular logic.
Mesher also has a lots of feature working in chain, like route management, circuit breaking, rate-limiting.
In Summary, handler is the middle ware between client and servers,
it is useful, when you want to add authorization to intercept illegal requests.
Mesher also has lots of feature working in chain, like route management, circuit breaking and rate-limiting.
In Summary, handler is the middle ware between clients and servers,
it is useful when adding authorization to intercept illegal requests.

### How to write a handler
https://docs.go-chassis.com/dev-guides/how-to-implement-handler.html

### How to use it in handler chain
in chassis.yaml add your handler name in chain configuration.
as side car and API gateway, mesher's chain has different meaning.
In chassis.yaml add your handler name in chain configuration.
As sidecar and API gateway, mesher's chain has different meanings.

For example, running as mesher-sidecar, service A call another service B,
outgoing chain process all the service A requests before remote call,
incoming chain process all the requests from service A, before access to service B API.
outgoing chain of service A processes all the service A requests before remote call,
incoming chain of service B processes all the requests from service A, before access to service B API.

In summary, outgoing chain works when a service attempt to call other services,
incoming chain works when other services call this service.

In summary outgoing chain works when a service attempt to call other services,
incoming chain works when other services call this service
```yaml
handler:
chain:
Expand All @@ -28,9 +29,10 @@ incoming chain works when other services call this service
incoming: ratelimiter-provider
```

running as API gateway,
incoming chain process all the requests from the external network,
outgoing chain process all the the request between API gateway and backend services
Running as API gateway,
incoming chain processes all the requests from the external network,
outgoing chain processes all the the requests between API gateway and back-end services.

```yaml
handler:
chain:
Expand Down

0 comments on commit 75a8c6d

Please sign in to comment.