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-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 55065ce follow kie package naming convention (#656)
55065ce is described below
commit 55065ce301fe2806d0d398ecfb6086943bdc1710
Author: Shawn <[email protected]>
AuthorDate: Tue Jun 30 16:27:58 2020 +0800
follow kie package naming convention (#656)
---
.github/workflows/static_check.yml | 36 +++++-----
README.md | 15 ++++-
{scctl => cmd/scctl}/main.go | 0
main.go => cmd/scserver/main.go | 0
{syncer => cmd/syncer}/syncer.go | 0
go.mod | 1 +
scripts/build/local.sh | 107 +++++++++++++++++++++++++++++-
scripts/build/tools.sh | 131 -------------------------------------
scripts/integration_test.sh | 2 +-
9 files changed, 140 insertions(+), 152 deletions(-)
diff --git a/.github/workflows/static_check.yml
b/.github/workflows/static_check.yml
index 6be175f..57eb088 100644
--- a/.github/workflows/static_check.yml
+++ b/.github/workflows/static_check.yml
@@ -5,19 +5,32 @@ jobs:
name: Merge check
runs-on: ubuntu-latest
steps:
-
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
-
- name: Check out code into the Go module directory
uses: actions/checkout@v1
-
- - name: Build
- run: go build -v .
-
+ - name: build
+ run: |
+ bash -x scripts/build/local.sh
+ - name: UT
+ run: |
+ bash -x scripts/ut_test_in_docker.sh
+ - name: Integration Testing
+ run: |
+ bash -x scripts/integration_test.sh
+ tests:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up Go 1.13
+ uses: actions/setup-go@v1
+ with:
+ go-version: 1.13
+ id: go
+ - name: Check out code into the Go module directory
+ uses: actions/checkout@v1
- name: Fmt
run: |
bash scripts/ci/formatChecker.sh
@@ -28,13 +41,4 @@ jobs:
- name: Cyclo
run: |
go get github.com/fzipp/gocyclo
- bash scripts/ci/goCycloChecker.sh
- - name: build
- run: |
- bash -x scripts/build/local.sh
- - name: UT
- run: |
- bash -x scripts/ut_test_in_docker.sh
- - name: Integration Testing
- run: |
- bash -x scripts/integration_test.sh
\ No newline at end of file
+ bash scripts/ci/goCycloChecker.sh
\ No newline at end of file
diff --git a/README.md b/README.md
index 810d44e..545ea5d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,16 @@
# Apache-ServiceComb-Service-Center
[](https://www.travis-ci.org/apache/servicecomb-service-center)
[](https://coveralls.io/github/apache/servicecomb-service-center?branch=master)
[](https://goreportcard.com/report/github.com/a
[...]
-Apache ServiceComb Service-Center is a Restful based service-registry that
provides micro-services discovery and micro-service management. It is based on
Open API format and provides features like service-discovery, fault-tolerance,
dynamic routing, notify subscription and scalable by design. It has high
performance cache design and separate entity management for micro-services and
their instances. It provides out of box support for metrics and tracing. It has
a web portal to manage the [...]
+Apache ServiceComb Service-Center is a Restful based service-registry that
provides micro-services discovery and micro-service management.
+It is based on Open API format and provides features like service-discovery,
+fault-tolerance, dynamic routing, notify subscription and scalable by design.
+It has high performance cache design and separate entity management for
micro-services and their instances.
+It provides out of box support for metrics and tracing. It has a web portal to
manage the micro-services.
+
+# Components
+- server: a http server which provide restful API
+- scctl: CLI of server
+- syncer: multiple service centers cluster synchronization tool, designed for
large microservice architectures
## Features
- **[`Open API`](/server/core/swagger/v4.yaml)**: API doc(Open API format)
management for microservice
@@ -107,7 +116,7 @@ GO111MODULE=on go mod vendor
Build the Service-Center
```sh
-go build -o service-center
+go build -o service-center
github.com/apache/servicecomb-service-center/cmd/scserver
```
First, you need to run a etcd(version: 3.x) as a database service and then
modify the etcd IP and port in the Service Center configuration file
(./etc/conf/app.conf : manager_cluster).
@@ -118,7 +127,7 @@ tar -xvf etcd-v3.1.8-linux-amd64.tar.gz
cd etcd-v3.1.8-linux-amd64
./etcd
-cd $GOPATH/src/github.com/apache/servicecomb-service-center
+cd servicecomb-service-center
cp -r ./etc/conf .
./service-center
```
diff --git a/scctl/main.go b/cmd/scctl/main.go
similarity index 100%
rename from scctl/main.go
rename to cmd/scctl/main.go
diff --git a/main.go b/cmd/scserver/main.go
similarity index 100%
rename from main.go
rename to cmd/scserver/main.go
diff --git a/syncer/syncer.go b/cmd/syncer/syncer.go
similarity index 100%
rename from syncer/syncer.go
rename to cmd/syncer/syncer.go
diff --git a/go.mod b/go.mod
index 34c439d..517f1a9 100644
--- a/go.mod
+++ b/go.mod
@@ -19,6 +19,7 @@ require (
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21
// indirect
github.com/eapache/queue v1.1.0 // indirect
+ github.com/fzipp/gocyclo v0.0.0-20150627053110-6acd4345c835 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-chassis/foundation v0.1.1-0.20191113114104-2b05871e9ec4
github.com/go-chassis/go-archaius v1.3.2
diff --git a/scripts/build/local.sh b/scripts/build/local.sh
index fee4806..8b127ea 100644
--- a/scripts/build/local.sh
+++ b/scripts/build/local.sh
@@ -30,9 +30,113 @@ PACKAGE=${3:-"${RELEASE}"}
PACKAGE_PREFIX=apache-servicecomb-service-center
script_path=$(cd "$(dirname "$0")"; pwd)
+fail() {
+ echo "$1"
+ exit 1
+}
+
+
+build_service_center() {
+ local app=$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+
+ set +e
+ rm -rf $app
+ rm -rf $app.tar.gz
+
+ set -e
+ mkdir -p $app
+
+ ## Build the Service-Center releases
+ export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
+ export BUILD_NUMBER=$RELEASE
+ local ldflags="${GO_LDFLAGS} -X
'github.com/apache/servicecomb-service-center/version.BUILD_TAG=$(date
+%Y%m%d%H%M%S).$BUILD_NUMBER.$GIT_COMMIT'"
+ ldflags="${ldflags} -X
'github.com/apache/servicecomb-service-center/version.VERSION=$BUILD_NUMBER'"
+ local BINARY_NAME=$app/service-center
+ if [ "$GOOS" == "windows" ]; then
+ BINARY_NAME=${BINARY_NAME}.exe
+ fi
+ go build --ldflags "${ldflags}" -o $BINARY_NAME
github.com/apache/servicecomb-service-center/cmd/scserver
+}
+
+
+build_scctl() {
+ local app=../$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+ ## Build the scctl releases
+ export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
+ export BUILD_NUMBER=$RELEASE
+ local ldflags="${GO_LDFLAGS} -X
'github.com/apache/servicecomb-service-center/scctl/pkg/version.BUILD_TAG=$(date
+%Y%m%d%H%M%S).$BUILD_NUMBER.$GIT_COMMIT'"
+ ldflags="${ldflags} -X
'github.com/apache/servicecomb-service-center/scctl/pkg/version.VERSION=$BUILD_NUMBER'"
+
+ local BINARY_NAME=$app/scctl
+ if [ "$GOOS" == "windows" ]; then
+ BINARY_NAME=${BINARY_NAME}.exe
+ fi
+ go build --ldflags "${ldflags}" -o $BINARY_NAME
github.com/apache/servicecomb-service-center/cmd/scctl
+}
+
+build_syncer() {
+ local app=../$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+ ## Build the syncer releases
+ export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
+ export BUILD_NUMBER=$RELEASE
+ local ldflags="${GO_LDFLAGS} -X
'github.com/apache/servicecomb-service-center/syncer/version.BUILD_TAG=$(date
+%Y%m%d%H%M%S).$BUILD_NUMBER.$GIT_COMMIT'"
+ ldflags="${ldflags} -X
'github.com/apache/servicecomb-service-center/syncer/version.VERSION=$BUILD_NUMBER'"
+
+ local BINARY_NAME=$app/syncer
+ if [ "$GOOS" == "windows" ]; then
+ BINARY_NAME=${BINARY_NAME}.exe
+ fi
+ go build --ldflags "${ldflags}" -o $BINARY_NAME
github.com/apache/servicecomb-service-center/cmd/syncer
+}
-source ${script_path}/tools.sh
+
+## Prepare the Configuration and Make package
+package() {
+ local app=$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+
+ cp -r etc/conf $app/
+ sed -i 's/^manager_cluster.*=.*/manager_name = \"sr-0\"\nmanager_addr =
\"http:\/\/127.0.0.1:2380\"\nmanager_cluster =
\"sr-0=http:\/\/127.0.0.1:2380\"/g' $app/conf/app.conf
+ sed -i 's/^registry_plugin.*=.*/registry_plugin = embeded_etcd/g'
$app/conf/app.conf
+
+ ## Copy the Service-Center Releases
+ cp -r scripts/release/LICENSE $app/
+ cp -r scripts/release/licenses $app/
+ cp -r scripts/release/NOTICE $app/
+ cp -r README.md $app/
+
+ ## Copy the frontend releases
+ cp -r frontend/app $app/
+
+ ## Copy Start Scripts
+ cp -r scripts/release/start_scripts/$GOOS/* $app/
+ if [ "$GOOS" != "windows" ]; then
+ chmod +x $app/*.sh
+ fi
+
+ ## Archive the release
+ tar -czvf $app.tar.gz $app
+}
+
+docker_builder_pattern() {
+ local dockerfile_dir=${1:-"."}
+ local output=${2:-"."}
+ local builder_name=servicecomb/service-center:build
+ local builder_path=/go/src/github.com/apache/servicecomb-service-center
+ local app=$PACKAGE_PREFIX-$PACKAGE-linux-amd64
+
+ set +e
+
+ docker rmi $builder_name
+
+ set -e
+
+ cd $dockerfile_dir
+ docker build -t $builder_name . -f Dockerfile.build
+ docker create --name builder $builder_name
+ docker cp builder:$builder_path/$app $output
+ docker rm -f builder
+}
personal_build() {
build_service_center
@@ -45,3 +149,4 @@ personal_build() {
}
personal_build
+
diff --git a/scripts/build/tools.sh b/scripts/build/tools.sh
deleted file mode 100644
index 49d32a7..0000000
--- a/scripts/build/tools.sh
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/usr/bin/env bash
-
-# 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.
-
-set -e
-
-fail() {
- echo "$1"
- exit 1
-}
-
-
-build_service_center() {
- local app=$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
-
- set +e
- rm -rf $app
- rm -rf $app.tar.gz
-
- set -e
- mkdir -p $app
-
- ## Build the Service-Center releases
- export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
- export BUILD_NUMBER=$RELEASE
- local ldflags="${GO_LDFLAGS} -X
'github.com/apache/servicecomb-service-center/version.BUILD_TAG=$(date
+%Y%m%d%H%M%S).$BUILD_NUMBER.$GIT_COMMIT'"
- ldflags="${ldflags} -X
'github.com/apache/servicecomb-service-center/version.VERSION=$BUILD_NUMBER'"
-
- local BINARY_NAME=$app/service-center
- if [ "$GOOS" == "windows" ]; then
- BINARY_NAME=${BINARY_NAME}.exe
- fi
- go build --ldflags "${ldflags}" -o $BINARY_NAME
-}
-
-
-build_scctl() {
- local app=../$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
- ## Build the scctl releases
- cd scctl
- export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
- export BUILD_NUMBER=$RELEASE
- local ldflags="${GO_LDFLAGS} -X
'github.com/apache/servicecomb-service-center/scctl/pkg/version.BUILD_TAG=$(date
+%Y%m%d%H%M%S).$BUILD_NUMBER.$GIT_COMMIT'"
- ldflags="${ldflags} -X
'github.com/apache/servicecomb-service-center/scctl/pkg/version.VERSION=$BUILD_NUMBER'"
-
- local BINARY_NAME=$app/scctl
- if [ "$GOOS" == "windows" ]; then
- BINARY_NAME=${BINARY_NAME}.exe
- fi
- go build --ldflags "${ldflags}" -o $BINARY_NAME
- cd -
-}
-
-build_syncer() {
- local app=../$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
- ## Build the syncer releases
- cd syncer
- export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
- export BUILD_NUMBER=$RELEASE
- local ldflags="${GO_LDFLAGS} -X
'github.com/apache/servicecomb-service-center/syncer/version.BUILD_TAG=$(date
+%Y%m%d%H%M%S).$BUILD_NUMBER.$GIT_COMMIT'"
- ldflags="${ldflags} -X
'github.com/apache/servicecomb-service-center/syncer/version.VERSION=$BUILD_NUMBER'"
-
- local BINARY_NAME=$app/syncer
- if [ "$GOOS" == "windows" ]; then
- BINARY_NAME=${BINARY_NAME}.exe
- fi
- go build --ldflags "${ldflags}" -o $BINARY_NAME
- cd -
-}
-
-
-
-## Prepare the Configuration and Make package
-package() {
- local app=$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
-
- cp -r etc/conf $app/
- sed -i 's/^manager_cluster.*=.*/manager_name = \"sr-0\"\nmanager_addr =
\"http:\/\/127.0.0.1:2380\"\nmanager_cluster =
\"sr-0=http:\/\/127.0.0.1:2380\"/g' $app/conf/app.conf
- sed -i 's/^registry_plugin.*=.*/registry_plugin = embeded_etcd/g'
$app/conf/app.conf
-
- ## Copy the Service-Center Releases
- cp -r scripts/release/LICENSE $app/
- cp -r scripts/release/licenses $app/
- cp -r scripts/release/NOTICE $app/
- cp -r README.md $app/
-
- ## Copy the frontend releases
- cp -r frontend/app $app/
-
- ## Copy Start Scripts
- cp -r scripts/release/start_scripts/$GOOS/* $app/
- if [ "$GOOS" != "windows" ]; then
- chmod +x $app/*.sh
- fi
-
- ## Archive the release
- tar -czvf $app.tar.gz $app
-}
-
-docker_builder_pattern() {
- local dockerfile_dir=${1:-"."}
- local output=${2:-"."}
- local builder_name=servicecomb/service-center:build
- local builder_path=/go/src/github.com/apache/servicecomb-service-center
- local app=$PACKAGE_PREFIX-$PACKAGE-linux-amd64
-
- set +e
-
- docker rmi $builder_name
-
- set -e
-
- cd $dockerfile_dir
- docker build -t $builder_name . -f Dockerfile.build
- docker create --name builder $builder_name
- docker cp builder:$builder_path/$app $output
- docker rm -f builder
-}
\ No newline at end of file
diff --git a/scripts/integration_test.sh b/scripts/integration_test.sh
index d0138af..0eecf39 100755
--- a/scripts/integration_test.sh
+++ b/scripts/integration_test.sh
@@ -17,7 +17,7 @@
echo "${green}Building Service-center${reset}"
-go build -o service-center github.com/apache/servicecomb-service-center
+go build -o service-center
github.com/apache/servicecomb-service-center/cmd/scserver
if [ $? == 0 ]; then
echo "${green}Service-center built successfully..${reset}"
else