Skip to content

Commit

Permalink
Merge 180fb0e into ab3773a
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxiaoliang committed Oct 14, 2019
2 parents ab3773a + 180fb0e commit 634bd2b
Show file tree
Hide file tree
Showing 33 changed files with 574 additions and 278 deletions.
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -58,6 +58,19 @@ it will build binary and docker image
- tar file: release/mesher-latest-linux-amd64.tar
- docker image name: servicecomb/mesher-sidecar:latest

#### Build mesher edge service
```shell script
sudo docker build -t servicecomb/mesher-edge -f docker/edge/Dockerfile .
```

### How to run
#### edge service
```shell script
sudo docker run -e PAAS_CSE_SC_ENDPOINT="" \
-e PAAS_CSE_CC_ENDPOINT="" \
-p 80:30101 \
--name mesher-edge servicecomb/mesher-edge
```
# Documentations
You can see more documentations in [here](https://mesher.readthedocs.io/en/latest/),
this online doc is for latest version of mesher, if you want to see your version's doc,
Expand Down
2 changes: 1 addition & 1 deletion cmd/mesher/mesher.go
Expand Up @@ -27,7 +27,7 @@ import (
_ "github.com/apache/servicecomb-mesher/proxy/protocol/dubbo/server"
_ "github.com/apache/servicecomb-mesher/proxy/protocol/dubbo/simpleRegistry"
// config server
_ "github.com/go-chassis/go-chassis-config/servicecombkie"
_ "github.com/go-chassis/go-chassis-config/servicecomb"
//protocols
_ "github.com/apache/servicecomb-mesher/proxy/protocol/grpc"
_ "github.com/apache/servicecomb-mesher/proxy/protocol/http"
Expand Down
29 changes: 29 additions & 0 deletions deployments/docker/db.js
@@ -0,0 +1,29 @@
/*
* 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.
*/

db.createUser(
{
user: "kie",
pwd: "123",
roles:[
{
role: "readWrite",
db: "kie"
}
]
}
);
83 changes: 83 additions & 0 deletions deployments/docker/docker-compose.yaml
@@ -0,0 +1,83 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
version: '3.1'
services:
mongo:
image: mongo:3.4
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_DATABASE: kie
MONGO_INITDB_ROOT_USERNAME: kie
MONGO_INITDB_ROOT_PASSWORD: 123
volumes:
- ./db.js:/docker-entrypoint-initdb.d/db.js:ro
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: kie
ME_CONFIG_MONGODB_ADMINPASSWORD: 123
kie:
image: servicecomb/kie:latest
restart: always
ports:
- 30110:30110
environment:
MONGODB_USER: kie
MONGODB_PWD: 123
MONGODB_ADDR: mongo
etcd:
image: 'quay.io/coreos/etcd:latest'
# restart: always
environment:
ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_INITIAL_CLUSTER: default=http://etcd:2380

service-center:
depends_on:
- etcd
image: 'servicecomb/service-center:latest'
ports:
- "30100:30100"
environment:
BACKEND_ADDRESS: etcd:2379

scfrontend:
depends_on:
- service-center
image: 'servicecomb/scfrontend:latest'
ports:
- "30103:30103"
environment:
SC_ADDRESS: http://service-center:30100
mesher-edge:
depends_on:
- service-center
- kie
image: 'servicecomb/mesher-edge:latest'
ports:
- "80:30101"
environment:
PAAS_CSE_SC_ENDPOINT: service-center:30100
PAAS_CSE_CC_ENDPOINT: kie:30110
40 changes: 40 additions & 0 deletions docker/edge/Dockerfile
@@ -0,0 +1,40 @@
# 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 golang:1.12.10 as builder

COPY . /servicecomb-mesher/
WORKDIR /servicecomb-mesher/
ENV GOPROXY=https://goproxy.io
RUN go build -a github.com/apache/servicecomb-mesher/cmd/mesher


FROM frolvlad/alpine-glibc:latest
RUN mkdir -p /opt/mesher && \
mkdir -p /etc/mesher/conf && \
mkdir -p /etc/ssl/mesher/
# To upload schemas using env enable SCHEMA_ROOT as environment variable using dockerfile or pass while running container
#ENV SCHEMA_ROOT=/etc/chassis-go/schemas umcomment in future

ENV CHASSIS_HOME=/opt/mesher/

COPY --from=builder /servicecomb-mesher/mesher $CHASSIS_HOME
COPY docker/edge/microservice.yaml $CHASSIS_HOME/conf/
COPY docker/edge/chassis.yaml $CHASSIS_HOME/conf/
COPY docker/edge/mesher.yaml /etc/mesher/conf/
COPY docker/edge/lager.yaml $CHASSIS_HOME/conf/
COPY docker/edge/start.sh $CHASSIS_HOME
WORKDIR $CHASSIS_HOME
ENTRYPOINT ["sh", "/opt/mesher/start.sh"]
55 changes: 55 additions & 0 deletions docker/edge/chassis.yaml
@@ -0,0 +1,55 @@
# 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.

---
cse:
protocols:
http:
listenAddress: 127.0.0.1:30101
rest-admin:
listenAddress: 127.0.0.1:30102 # listen addr use to adminAPI
service:
registry:
address: http://127.0.0.1:30100 # uri of service center
scope: full #set full to be able to discover other app's service
config:
client:
serverUri: https://127.0.0.1:30110 #uri of config center
type: servicecomb-kie
refreshMode: 1 # 1: only pull config.
refreshInterval: 30 # unit is second
handler:
chain:
Consumer:
outgoing: router,bizkeeper-consumer,loadbalance,tracing-consumer,transport #consumer handlers
Provider:
incoming: tracing-provider #provider handlers

## Mesher TLS is base on Go Chassis TLS config, https://docs.go-chassis.com/user-guides/tls.html
ssl:
# mesher-edge.rest.Provider.cipherPlugin: default
# mesher-edge.rest.Provider.verifyPeer: false
# mesher-edge.rest.Provider.cipherSuits: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
# mesher-edge.rest.Provider.protocol: TLSv1.2
# mesher-edge.rest.Provider.caFile:
# mesher-edge.rest.Provider.certFile: server.crt
# mesher-edge.rest.Provider.keyFile: server.key
# mesher-edge.rest.Provider.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://localhost: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.
37 changes: 37 additions & 0 deletions docker/edge/lager.yaml
@@ -0,0 +1,37 @@
# 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.

---
# LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL
logger_level: DEBUG

# LoggerFile: used to output the name of log.可配置绝对路径,也可以配置用于拼接CHASSIS_HOME的相对路径。
logger_file: log/mesher.log

# LogFormatText:设定日志的输出格式是 json 还是 plaintext (类似于log4j),默认为 false,不建议修改,如果开发过程中想本地查看日志的话,
# 可以设定 LoggerFile 和 LogFormatText 为 true,这样会输出类似于 log4j 格式的本地日志。
log_format_text: false

#rollingPolicy daily/size;用于配置根据时间,还是根据大小进行日志rotate操作。
rollingPolicy: size

# MaxDaily of a log file before rotate. By D Days.;日志rotate时间配置,单位"day"。
log_rotate_date: 1

# MaxSize of a log file before rotate. By M Bytes.;日志rotate文件大小配置,单位"MB"。
log_rotate_size: 10

# Max counts to keep of a log's backup files.日志最大存储数量,单位“个”。
log_backup_count: 7
55 changes: 55 additions & 0 deletions docker/edge/mesher.yaml
@@ -0,0 +1,55 @@
# 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.

## 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

#mesher:
# ingress:
# type: servicecomb
# rule:
# http: |
# - host: example.com
# limit: 30
# apiPath: /some/api
# service:
# name: example
# redirectPath: /another/api
# port:
# name: http-legacy
# value: 8080
# - apiPath: /sayerror/api
# service:
# name: Server
# redirectPath: /sayerror
# port:
# name: http
# value: 8080
# - apiPath: /some/api
# service:
# name: Server
# port:
# name: http
# value: 8080
18 changes: 18 additions & 0 deletions docker/edge/microservice.yaml
@@ -0,0 +1,18 @@
# 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.

service_description:
name: mesher-edge
version: 1.7.0

0 comments on commit 634bd2b

Please sign in to comment.