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 633b183 SCB-2176 Deprecate app.conf (#949)
633b183 is described below
commit 633b18327385fb0a7d08128ed01bab5d4102fe58
Author: little-cui <[email protected]>
AuthorDate: Fri Apr 16 17:31:31 2021 +0800
SCB-2176 Deprecate app.conf (#949)
* SCB-2176 Deprecate app.conf
* SCB-2176 Fix: Can not make a release
---
Dockerfile.build | 6 +-
control-panel/docker-compose.yml | 23 ++--
datasource/etcd/sd/etcd/adaptor_test.go | 4 +-
datasource/etcd/version.go | 12 +--
datasource/instance_test.go | 4 +-
etc/conf/app.conf | 145 +-------------------------
etc/conf/app.yaml | 24 ++++-
examples/dev/docker-compose.yaml | 4 +-
scripts/build/local.sh | 133 ++---------------------
scripts/build/{local.sh => tools.sh} | 117 ++++++++++++++-------
scripts/docker/build-frontend-image/build.sh | 12 +--
scripts/docker/build-image/build.sh | 30 +-----
scripts/release/README.md | 6 +-
scripts/release/make_release.sh | 44 +-------
server/config/config.go | 73 ++++++++-----
server/config/server.go | 14 ++-
server/config/types.go | 21 ++--
server/config/util.go | 12 +--
server/core/microservice.go | 3 +-
server/core/microservice_test.go | 7 +-
server/resource/v1/gov_resource_test.go | 2 +-
server/service/gov/config_distributor_test.go | 2 +-
server/service/instance_test.go | 4 +-
server/service/rbac/rbac.go | 2 +-
24 files changed, 241 insertions(+), 463 deletions(-)
diff --git a/Dockerfile.build b/Dockerfile.build
index a21740c..10ad313 100644
--- a/Dockerfile.build
+++ b/Dockerfile.build
@@ -17,6 +17,8 @@ FROM golang:1.14
WORKDIR /go/src/github.com/apache/servicecomb-service-center
+ENV GOPROXY https://goproxy.io
+
COPY . .
-RUN export GOPROXY=https://goproxy.io
-RUN bash -x scripts/build/local.sh linux 1.4.0 latest
+
+RUN bash -x scripts/build/local.sh linux 2.0.0 amd64 {{BUILD}}
diff --git a/control-panel/docker-compose.yml b/control-panel/docker-compose.yml
index e64d587..b67b286 100644
--- a/control-panel/docker-compose.yml
+++ b/control-panel/docker-compose.yml
@@ -22,10 +22,10 @@ services:
command: mongod --replSet rs/mongo:27017
ports:
- 27017:27017
- volumes:
- - ./data/db:/data/db
+ #volumes:
+ # - ./data/db:/data/db
healthcheck:
- test: ["CMD-SHELL", "echo 'db.runCommand({serverStatus: 1}).ok | mongo
mongo:27017/test --quiet'"]
+ test: [ "CMD-SHELL", "echo 'db.runCommand({serverStatus: 1}).ok | mongo
mongo:27017 --quiet'" ]
interval: 5s
timeout: 5s
retries: 3
@@ -33,22 +33,33 @@ services:
image: mongo:4.0
container_name: mongo_cfg
command: |
- bash -c "echo 'rs.initiate({_id: \"rs\", members: [{_id: 0, host:
\"mongo:27017\"}]})' | mongo mongo:27017/test --quiet"
+ bash -c "echo 'rs.initiate({_id: \"rs\", members: [{_id: 0, host:
\"mongo:27017\"}]})' | mongo mongo:27017 --quiet"
depends_on:
mongo:
condition: service_healthy
service-center:
- image: servicecomb/service-center:2.0
+ image: servicecomb/service-center:2.0.0
container_name: sc
ports:
- 30100:30100
environment:
+ SERVER_HOST: 0.0.0.0
LOG_LEVEL: DEBUG
+ LOG_FILE: ''
REGISTRY_KIND: mongo
REGISTRY_MONGO_CLUSTER_URI: mongodb://mongo:27017
+ depends_on:
+ mongo_cfg:
+ condition: service_completed_successfully
kie:
- image: servicecomb/kie:0.2
+ image: servicecomb/kie:0.2.1
container_name: kie
+ environment:
+ MONGODB_ADDR: mongo:27017
ports:
- 30110:30110
+ depends_on:
+ mongo_cfg:
+ condition: service_completed_successfully
+ # TODO give me UI here!!!
\ No newline at end of file
diff --git a/datasource/etcd/sd/etcd/adaptor_test.go
b/datasource/etcd/sd/etcd/adaptor_test.go
index 5893f2e..f019c94 100644
--- a/datasource/etcd/sd/etcd/adaptor_test.go
+++ b/datasource/etcd/sd/etcd/adaptor_test.go
@@ -29,12 +29,12 @@ import (
)
func TestNewKvEntity(t *testing.T) {
- config.ServerInfo.Config.EnableCache = false
+ config.Server.Config.EnableCache = false
i := NewEtcdAdaptor("a", sd.Configure().WithInitSize(1))
if _, ok := i.Indexer.(*Indexer); !ok {
t.Fatalf("TestNewIndexer failed")
}
- config.ServerInfo.Config.EnableCache = true
+ config.Server.Config.EnableCache = true
i.Run()
<-i.Ready()
diff --git a/datasource/etcd/version.go b/datasource/etcd/version.go
index cdff2d7..01a5ebe 100644
--- a/datasource/etcd/version.go
+++ b/datasource/etcd/version.go
@@ -42,7 +42,7 @@ func (ds *DataSource) LoadServerVersion(ctx context.Context)
error {
return nil
}
- err = json.Unmarshal(resp.Kvs[0].Value, &config.ServerInfo)
+ err = json.Unmarshal(resp.Kvs[0].Value, &config.Server)
if err != nil {
log.Errorf(err, "load server version failed, maybe
incompatible")
return nil
@@ -51,7 +51,7 @@ func (ds *DataSource) LoadServerVersion(ctx context.Context)
error {
}
func (ds *DataSource) UpgradeServerVersion(ctx context.Context) error {
- bytes, err := json.Marshal(config.ServerInfo)
+ bytes, err := json.Marshal(config.Server)
if err != nil {
return err
}
@@ -71,7 +71,7 @@ func (ds *DataSource) UpgradeVersion(ctx context.Context)
error {
return err
}
if ds.needUpgrade(ctx) {
- config.ServerInfo.Version = version.Ver().Version
+ config.Server.Version = version.Ver().Version
if err := ds.UpgradeServerVersion(ctx); err != nil {
log.Errorf(err, "upgrade server version failed")
@@ -92,12 +92,12 @@ func (ds *DataSource) needUpgrade(ctx context.Context) bool
{
return false
}
- update := !serviceUtil.VersionMatchRule(config.ServerInfo.Version,
+ update := !serviceUtil.VersionMatchRule(config.Server.Version,
fmt.Sprintf("%s+", version.Ver().Version))
- if !update && version.Ver().Version != config.ServerInfo.Version {
+ if !update && version.Ver().Version != config.Server.Version {
log.Warnf(
"there is a higher version '%s' in cluster, now running
'%s' version may be incompatible",
- config.ServerInfo.Version, version.Ver().Version)
+ config.Server.Version, version.Ver().Version)
}
return update
diff --git a/datasource/instance_test.go b/datasource/instance_test.go
index 652d876..d9ce98b 100644
--- a/datasource/instance_test.go
+++ b/datasource/instance_test.go
@@ -703,7 +703,7 @@ func TestInstance_Query(t *testing.T) {
assert.Equal(t, 0, len(respFind.Instances))
log.Info("shared service discovery")
- config.ServerInfo.Config.GlobalVisible =
"query_instance_shared_provider_ms"
+ config.Server.Config.GlobalVisible =
"query_instance_shared_provider_ms"
core.RegisterGlobalServices()
core.Service.Environment = pb.ENV_PROD
respFind, err = datasource.Instance().FindInstances(
@@ -917,7 +917,7 @@ func TestInstance_Query(t *testing.T) {
assert.Equal(t, 0, len(respFind.Services.Updated[0].Instances))
log.Info("shared service discovery")
- config.ServerInfo.Config.GlobalVisible =
"query_instance_shared_provider_ms"
+ config.Server.Config.GlobalVisible =
"query_instance_shared_provider_ms"
core.RegisterGlobalServices()
core.Service.Environment = pb.ENV_PROD
respFind, err = datasource.Instance().BatchFind(
diff --git a/etc/conf/app.conf b/etc/conf/app.conf
index c1d788d..b53ad3c 100644
--- a/etc/conf/app.conf
+++ b/etc/conf/app.conf
@@ -13,161 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-component_name = service_center
-#run mode could be many options to specify the env like prod,dev
-runmode = dev
-
###################################################################
# Frontend Configurations
###################################################################
frontend_host_ip = 127.0.0.1
frontend_host_port = 30103
-###################################################################
-# sever options
-###################################################################
# if you want to listen at ipv6 address, then set the httpaddr value like:
# httpaddr = 2400:A480:AAAA:200::159 (global scope)
# httpaddr = fe80::f816:3eff:fe17:c38b%eth0 (link-local scope)
httpaddr = 127.0.0.1
httpport = 30100
-read_header_timeout = 60s
-read_timeout = 60s
-idle_timeout = 60s
-write_timeout = 60s
-# 32K
-max_header_bytes = 32768
-# 2M
-max_body_bytes = 2097152
-
-enable_pprof = 0
-
-###################################################################
-# plugin options
-###################################################################
-plugins_dir = ./plugins
-
-# pluggable discovery service
-discovery_plugin = etcd
-# the discovery plugins are part of aggregator
-aggregate_mode = ""
-
-# enable to register service center to backend registry
-self_register = 1
-
-# pluggable registry service
-# 'etcd' means app running as an etcd agent
-# 'embeded_etcd' means app running as an etcd server
-registry_plugin = etcd
-
-# registry address
-# 1. if registry_plugin equals to 'embeded_etcd'
-# manager_name = "sc-0"
-# manager_addr = "http://127.0.0.1:2380"
-# manager_cluster = "sc-0=http://127.0.0.1:2380"
-# 2. if registry_plugin equals to 'etcd'
-# manager_cluster = "127.0.0.1:2379"
-manager_cluster = "127.0.0.1:2379"
-
-# heartbeat that sync synchronizes client's endpoints with the known endpoints
from
-# the etcd membership, unit is second and value must greater then 1s, it is set
-# default 30s if value less then 0
-auto_sync_interval = 30s
-
-# the timeout for failing to establish a connection
-connect_timeout = 10s
-# the timeout for failing to read response of registry
-registry_timeout = 30s
-
-# indicate how many revision you want to keep in etcd
-compact_index_delta = 100
-compact_interval = 12h
-
-# registry cache, if this option value set 0, service center can run
-# in lower memory but no longer push the events to client.
-enable_cache = 1
-# the cache will be clear after X, if not set cache will be never clear
-cache_ttl = ""
-
-# pluggable cipher
-cipher_plugin = ""
-
-# suppot buildin
-# in buildin mode(default): microservice capacity is 50000
-# instance capacity is 150000
-# schema capacity of single microservice is 100
-# rule capacity of single microservice is 100
-# tag capacity of single microservice is 100
-quota_plugin = "buildin"
-
-#access control plugin
-auth_plugin = ""
-
-#support om, manage
-auditlog_plugin = ""
-
-#tracing: buildin(zipkin)
-# buildin(zipkin): Can export TRACING_COLLECTOR env variable to select
-# collector type, 'server' means report trace data
-# to zipkin server address specified by
TRACING_SERVER_ADDRESS
-# env variable; 'file' means just output a file stored
-# in path specified by TRACING_FILE_PATH env variable
-trace_plugin = ""
-
-#customize the uuid format
-uuid_plugin = "context"
-
-###################################################################
-# rate limit options
-###################################################################
-#ttl=m, s, ms
-limit_ttl = "s"
-#set 0 to disable rate limit
-limit_conns = 0
-#list of places to look for IP address
-limit_iplookups = "RemoteAddr,X-Forwarded-For,X-Real-IP"
-
-###################################################################
-# ssl/tls options
-###################################################################
-ssl_plugin = ""
-# 0=Non-SSL mode, 1==SSL mode
-ssl_mode = 0
-ssl_verify_client = 1
-# minimal tls protocol, [TLSv1.0, TLSv1.1, TLSv1.2]
-ssl_min_version = TLSv1.2
-ssl_ciphers =
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256
-
-###################################################################
-# log options
-###################################################################
-# MaxSize of a log file before rotate. By M Bytes.
-log_rotate_size = 20
-# Max counts to keep of a log's backup files.
-log_backup_count = 50
-# log format(text or json type)
-log_format = text
-# whether enable record syslog
-log_sys = false
-# access log format: remoteIp requestReceiveTime "method requestUri proto"
statusCode requestBodySize delay(ms)
-# example: 127.0.0.1 2006-01-02T15:04:05.000Z07:00 "GET
/v4/default/registry/microservices HTTP/1.1" 200 0 0
-# access log inherits log's rotate and backup configuration
-# whether enable access log
-# enable_access_log = true
-# access log file
-access_log_file = "./access.log"
-
###################################################################
-# above is the global configurations
-# you can overide above configuration in specific env
+# sever options (deprecated, pls use app.yaml instead)
###################################################################
-[prod]
-# DEBUG, INFO, WARN, ERROR, FATAL
-loglevel = INFO
-logfile = ./service-center.log
-## dev env, if you are a operator,ignore this env
-[dev]
-loglevel = DEBUG
-logfile = ""
-enable_pprof = 1
diff --git a/etc/conf/app.yaml b/etc/conf/app.yaml
index bdfebd0..1d04cc5 100644
--- a/etc/conf/app.yaml
+++ b/etc/conf/app.yaml
@@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# environment can specify the sc running env, like dev or prod
+environment: dev
+
server:
host: 127.0.0.1
port: 30100
@@ -43,15 +46,15 @@ gov:
log:
# DEBUG, INFO, WARN, ERROR, FATAL
- level: DEBUG
+ level: INFO
file: ./service-center.log
- accessEnable: false
# access log format: remoteIp requestReceiveTime "method requestUri proto"
statusCode requestBodySize delay(ms)
# example: 127.0.0.1 2006-01-02T15:04:05.000Z07:00 "GET
/v4/default/registry/microservices HTTP/1.1" 200 0 0
# access log inherits log's rotate and backup configuration
# whether enable access log
- # enable_access_log = true
+ # accessEnable = true
# access log file
+ accessEnable: false
accessFile: ./access.log
# log format(text or json type)
format: text
@@ -62,6 +65,9 @@ log:
# Max counts to keep of a log's backup files.
backupCount: 50
+cipher:
+ kind:
+
ssl:
dir:
# ssl.mode enable ssl or not, set 1 if enable
@@ -74,7 +80,7 @@ ssl:
plugin:
# plugin.dir is the directory of the *.so files
- dir:
+ dir: ./plugins
registry:
# buildin, etcd, embeded_etcd, mongo
@@ -120,7 +126,7 @@ registry:
workerNum: 10
timeout: 10
cluster:
- uri: mongodb://localhost:27017
+ uri: mongodb://127.0.0.1:27017
sslEnabled: false
rootCAFile: /opt/ssl/ca.pem
verifyPeer: false
@@ -185,6 +191,14 @@ quota:
tag:
limit: 100
+uuid:
+ kind: context
+
+auth:
+ kind:
+
+auditlog:
+ kind:
syncer:
enabled: false
diff --git a/examples/dev/docker-compose.yaml b/examples/dev/docker-compose.yaml
index 568f3ba..88e705b 100644
--- a/examples/dev/docker-compose.yaml
+++ b/examples/dev/docker-compose.yaml
@@ -23,7 +23,7 @@ services:
ports:
- 27017:27017
healthcheck:
- test: ["CMD-SHELL", "echo 'db.runCommand({serverStatus: 1}).ok | mongo
mongo:27017/test --quiet'"]
+ test: ["CMD-SHELL", "echo 'db.runCommand({serverStatus: 1}).ok | mongo
mongo:27017 --quiet'"]
interval: 5s
timeout: 5s
retries: 3
@@ -31,7 +31,7 @@ services:
image: mongo:4.0
container_name: mongo_cfg
command: |
- bash -c "echo 'rs.initiate({_id: \"rs\", members: [{_id: 0, host:
\"127.0.0.1:27017\"}]})' | mongo mongo:27017/test --quiet"
+ bash -c "echo 'rs.initiate({_id: \"rs\", members: [{_id: 0, host:
\"127.0.0.1:27017\"}]})' | mongo mongo:27017 --quiet"
depends_on:
mongo:
condition: service_healthy
diff --git a/scripts/build/local.sh b/scripts/build/local.sh
index ba76d94..f73b12a 100644
--- a/scripts/build/local.sh
+++ b/scripts/build/local.sh
@@ -16,136 +16,17 @@
# limitations under the License.
set -e
-export GOOS=${1:-"linux"}
-export GOARCH=${4:-"amd64"}
-export CGO_ENABLED=${CGO_ENABLED:-0} # prevent to compile cgo file
-export GO_EXTLINK_ENABLED=${GO_EXTLINK_ENABLED:-0} # do not use host linker
-export GO_LDFLAGS=${GO_LDFLAGS:-" -s -w"}
-
-RELEASE=${2:-"0.0.1"}
-PACKAGE=${3:-"${RELEASE}"}
+umask 027
-PACKAGE_PREFIX=apache-servicecomb-service-center
+export GOOS=${1:-"linux"}
+export RELEASE=${2:-"0.0.1"}
+export GOARCH=${3:-"amd64"}
+export BUILD=${4:-""}
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.BuildTag=$(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
-}
-
-
-
-## 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
-
- build_scctl
-
- build_syncer
- package
-}
+source ${script_path}/tools.sh
-personal_build
+build
diff --git a/scripts/build/local.sh b/scripts/build/tools.sh
similarity index 65%
copy from scripts/build/local.sh
copy to scripts/build/tools.sh
index ba76d94..c4c71fb 100644
--- a/scripts/build/local.sh
+++ b/scripts/build/tools.sh
@@ -1,5 +1,6 @@
#!/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.
@@ -14,29 +15,67 @@
# 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
-export GOOS=${1:-"linux"}
-export GOARCH=${4:-"amd64"}
+
+# GO flags
+export GOPROXY=${GOPROXY:-"https://goproxy.io"}
+export GOOS=${GOOS:-"linux"}
+export GOARCH=${GOARCH:-"amd64"}
export CGO_ENABLED=${CGO_ENABLED:-0} # prevent to compile cgo file
export GO_EXTLINK_ENABLED=${GO_EXTLINK_ENABLED:-0} # do not use host linker
export GO_LDFLAGS=${GO_LDFLAGS:-" -s -w"}
-
-RELEASE=${2:-"0.0.1"}
-
-PACKAGE=${3:-"${RELEASE}"}
-
-PACKAGE_PREFIX=apache-servicecomb-service-center
+# Inputs
+export RELEASE=${RELEASE:-"0.0.1"}
+export PACKAGE_PREFIX=${PACKAGE_PREFIX:-"apache-servicecomb-service-center"}
+export BUILD=${BUILD:-""} # build all if set value 'ALL'
script_path=$(cd "$(dirname "$0")"; pwd)
+root_path=${script_path}/../..
+
fail() {
echo "$1"
exit 1
}
+install_bower() {
+ set +e
+ BOWER=$(which bower)
+ if [ "$?" == "1" ]; then
+ set -e
+
+ curl -sL https://deb.nodesource.com/setup_8.x | bash -
+ sudo apt-get install -y nodejs
+
+ npm install -g bower
+ else
+ set -e
+ fi
+}
+
+frontend_deps() {
+ install_bower
+
+ ## Download the frontend dependencies using bower
+ cd ${script_path}/../../frontend/app
+ bower install --allow-root
+ cd -
+}
+
+build_frontend() {
+ ## Build Frontend Release
+ frontend_deps
+
+ local BINARY_NAME=$PACKAGE_PREFIX-$RELEASE-$GOOS-$GOARCH/frontend
+ if [ "$GOOS" == "windows" ]; then
+ BINARY_NAME=${BINARY_NAME}.exe
+ fi
+ go build --ldflags "${GO_LDFLAGS}" -o $BINARY_NAME
github.com/apache/servicecomb-service-center/frontend
+}
build_service_center() {
- local app=$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+ local app=$PACKAGE_PREFIX-$RELEASE-$GOOS-$GOARCH
set +e
rm -rf $app
@@ -57,9 +96,8 @@ build_service_center() {
go build --ldflags "${ldflags}" -o $BINARY_NAME
github.com/apache/servicecomb-service-center/cmd/scserver
}
-
build_scctl() {
- local app=../$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+ local app=$PACKAGE_PREFIX-$RELEASE-$GOOS-$GOARCH
## Build the scctl releases
export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
export BUILD_NUMBER=$RELEASE
@@ -74,7 +112,7 @@ build_scctl() {
}
build_syncer() {
- local app=../$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+ local app=$PACKAGE_PREFIX-$RELEASE-$GOOS-$GOARCH
## Build the syncer releases
export GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
export BUILD_NUMBER=$RELEASE
@@ -88,27 +126,25 @@ build_syncer() {
go build --ldflags "${ldflags}" -o $BINARY_NAME
github.com/apache/servicecomb-service-center/cmd/syncer
}
-
-
## Prepare the Configuration and Make package
package() {
- local app=$PACKAGE_PREFIX-$PACKAGE-$GOOS-$GOARCH
+ local app=$PACKAGE_PREFIX-$RELEASE-$GOOS-$GOARCH
- cp -r etc/conf $app/
+ cp -r ${root_path}/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/
+ cp -r ${root_path}/scripts/release/LICENSE $app/
+ cp -r ${root_path}/scripts/release/licenses $app/
+ cp -r ${root_path}/scripts/release/NOTICE $app/
+ cp -r ${root_path}/README.md $app/
## Copy the frontend releases
- cp -r frontend/app $app/
+ cp -r ${root_path}/frontend/app $app/
## Copy Start Scripts
- cp -r scripts/release/start_scripts/$GOOS/* $app/
+ cp -r ${root_path}/scripts/release/start_scripts/$GOOS/* $app/
if [ "$GOOS" != "windows" ]; then
chmod +x $app/*.sh
fi
@@ -117,12 +153,27 @@ package() {
tar -czvf $app.tar.gz $app
}
+build() {
+ build_service_center
+ if [ "${BUILD}" == "ALL" ]; then
+ # tools
+ build_scctl
+ build_syncer
+ # sc frontend
+ build_frontend
+ fi
+ package
+}
+
+# Docker common functions
+
+# docker_builder_pattern execute the local build in docker builder and output
the package to the specify directory
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
+ local app=$PACKAGE_PREFIX-$RELEASE-$GOOS-$GOARCH
set +e
@@ -131,21 +182,11 @@ docker_builder_pattern() {
set -e
cd $dockerfile_dir
- docker build -t $builder_name . -f Dockerfile.build
+ cp -pf Dockerfile.build Dockerfile
+ sed -i "s|{{BUILD}}|${BUILD}|g" Dockerfile
+ docker build -t $builder_name .
docker create --name builder $builder_name
docker cp builder:$builder_path/$app $output
docker rm -f builder
-}
-personal_build() {
-
- build_service_center
-
- build_scctl
-
- build_syncer
-
- package
-}
-
-personal_build
-
+ cd -
+}
\ No newline at end of file
diff --git a/scripts/docker/build-frontend-image/build.sh
b/scripts/docker/build-frontend-image/build.sh
index d64912b..7474a6d 100644
--- a/scripts/docker/build-frontend-image/build.sh
+++ b/scripts/docker/build-frontend-image/build.sh
@@ -24,14 +24,12 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd)
BASE_DIR=${SCRIPT_DIR}/../../../
# build all
-PACKAGE=${1:-"latest"}
-
-PACKAGE_PREFIX=apache-servicecomb-service-center
-
-PACKAGE_DIR=$SCRIPT_DIR/../$PACKAGE_PREFIX-$PACKAGE-linux-amd64
+export RELEASE=${1:-"latest"}
+export BUILD="ALL"
source ${SCRIPT_DIR}/../../build/tools.sh
+PACKAGE_DIR=$SCRIPT_DIR/../$PACKAGE_PREFIX-$RELEASE-linux-amd64
if [ ! -d $PACKAGE_DIR ]; then
docker_builder_pattern $BASE_DIR $SCRIPT_DIR/../
fi
@@ -57,8 +55,8 @@ cp Dockerfile.tmpl Dockerfile
sed -i "s|{{.BASE_IMAGE}}|${BASE_IMAGE}|g" Dockerfile
sed -i "s|{{.BASE_IMAGE_VERSION}}|${BASE_IMAGE_VERSION}|g" Dockerfile
-docker build --no-cache -t servicecomb/scfrontend:$PACKAGE .
-docker save servicecomb/scfrontend:$PACKAGE |gzip >scfrontend-dev.tgz
+docker build --no-cache -t servicecomb/scfrontend:$RELEASE .
+docker save servicecomb/scfrontend:$RELEASE |gzip >scfrontend-dev.tgz
# remove the frontend directory from the build-frontend-image path
rm -rf frontend Dockerfile
diff --git a/scripts/docker/build-image/build.sh
b/scripts/docker/build-image/build.sh
index c22d1b7..fd815d1 100644
--- a/scripts/docker/build-image/build.sh
+++ b/scripts/docker/build-image/build.sh
@@ -24,31 +24,11 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd)
BASE_DIR=${SCRIPT_DIR}/../../../
# build all
-PACKAGE=${1:-"latest"}
+export RELEASE=${1:-"latest"}
-PACKAGE_PREFIX=apache-servicecomb-service-center
+source ${SCRIPT_DIR}/../../build/tools.sh
-PACKAGE_DIR=$SCRIPT_DIR/../$PACKAGE_PREFIX-$PACKAGE-linux-amd64
-
-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
-}
+PACKAGE_DIR=$SCRIPT_DIR/../$PACKAGE_PREFIX-$RELEASE-linux-amd64
if [ ! -d $PACKAGE_DIR ]; then
docker_builder_pattern $BASE_DIR $SCRIPT_DIR/../
fi
@@ -74,8 +54,8 @@ cp Dockerfile.tmpl Dockerfile
sed -i "s|{{.BASE_IMAGE}}|${BASE_IMAGE}|g" Dockerfile
sed -i "s|{{.BASE_IMAGE_VERSION}}|${BASE_IMAGE_VERSION}|g" Dockerfile
-docker build --no-cache -t servicecomb/service-center:$PACKAGE .
-docker save servicecomb/service-center:$PACKAGE |gzip >service-center-dev.tgz
+docker build --no-cache -t servicecomb/service-center:$RELEASE .
+docker save servicecomb/service-center:$RELEASE |gzip >service-center-dev.tgz
# remove the service-center directory from the build-image path
rm -rf service-center Dockerfile
diff --git a/scripts/release/README.md b/scripts/release/README.md
index 84296ac..58427e0 100644
--- a/scripts/release/README.md
+++ b/scripts/release/README.md
@@ -23,20 +23,20 @@ glide install
```
# bash -x scripts/release/make_release.sh OS_NAME VERSION_NUMBER PACKAGE_NUMBER
-bash -x scripts/release/make_release.sh linux 1.1.0 1.1.0
+bash -x scripts/release/make_release.sh linux 1.1.0
```
#### Windows Release
```
# bash -x scripts/release/make_release.sh OS_NAME VERSION_NUMBER PACKAGE_NUMBER
-bash -x scripts/release/make_release.sh windows 1.1.0 1.1.0
+bash -x scripts/release/make_release.sh windows 1.1.0
```
#### Mac OS Release
```
# bash -x scripts/release/make_release.sh OS_NAME VERSION_NUMBER PACKAGE_NUMBER
-bash -x scripts/release/make_release.sh mac 1.1.0 1.1.0
+bash -x scripts/release/make_release.sh mac 1.1.0
```
diff --git a/scripts/release/make_release.sh b/scripts/release/make_release.sh
index 2f154bb..e89534e 100755
--- a/scripts/release/make_release.sh
+++ b/scripts/release/make_release.sh
@@ -17,22 +17,14 @@
set -e
+umask 027
+
## Get the Release Number
if [[ $2 == "" ]]; then
echo "Invalid version number....exiting...."
exit 1
else
- RELEASE=$2
-fi
-
-#Package prefix for the release directory
-PACKAGE_PREFIX=apache-servicecomb-service-center
-
-## Get the PACKAGE NUMBER
-if [ "X"$3 == "X" ]; then
- PACKAGE=RELEASE
-else
- PACKAGE=$3
+ export RELEASE=$2
fi
## Get the OS Version
@@ -57,36 +49,16 @@ esac
## Get the arch type
export GOARCH=${4:-"amd64"}
-export CGO_ENABLED=${CGO_ENABLED:-0} # prevent to compile cgo file
-export GO_EXTLINK_ENABLED=${GO_EXTLINK_ENABLED:-0} # do not use host linker
-export GO_LDFLAGS=${GO_LDFLAGS:-" -s -w"}
-
-root_path=$(cd "$(dirname "$0")"; pwd)
-
-source ${root_path}/../build/tools.sh
-
-build() {
- frontend_deps
- build_service_center
+script_path=$(cd "$(dirname "$0")"; pwd)
- build_frontend
-
- build_scctl
-
- build_syncer
-
- package
-}
+source ${script_path}/../build/tools.sh
# Build Linux Release
build_linux(){
if [ "X"$RELEASE == "X" ] ; then
echo "Error in Making Linux Release.....Release Number not specified"
fi
- if [ "X"$PACKAGE == "X" ]; then
- echo "Error in Making Linux Release.....Package Number not specified"
- fi
export GOOS=linux
@@ -98,9 +70,6 @@ build_windows(){
if [ "X"$RELEASE == "X" ] ; then
echo "Error in Making Windows Release.....Release Number not
specified"
fi
- if [ "X"$PACKAGE == "X" ]; then
- echo "Error in Making Windows Release.....Package Number not specified"
- fi
export GOOS=windows
@@ -112,9 +81,6 @@ build_mac(){
if [ "X"$RELEASE == "X" ] ; then
echo "Error in Making Mac Release.....Release Number not specified"
fi
- if [ "X"$PACKAGE == "X" ]; then
- echo "Error in Making Mac Release.....Package Number not specified"
- fi
export GOOS=darwin
diff --git a/server/config/config.go b/server/config/config.go
index 9a08fd3..0775fe0 100644
--- a/server/config/config.go
+++ b/server/config/config.go
@@ -18,6 +18,8 @@
package config
import (
+ "encoding/json"
+ "fmt"
"path/filepath"
"runtime"
"time"
@@ -44,49 +46,55 @@ const (
maxServiceTTL = 24 * 365 * time.Hour //1 year
)
-//Configurations is kie config items
-var Configurations = &Config{}
+var (
+ Server = NewServerConfig()
+ //App is application root config
+ App = &AppConfig{Server: Server}
+)
-var ServerInfo = NewServerInformation()
+//GetProfile return active profile
+func GetProfile() *ServerConfig {
+ return App.Server
+}
//GetGov return governance configs
func GetGov() *Gov {
- return Configurations.Gov
+ return App.Gov
}
//GetServer return the http server configs
-func GetServer() ServerConfig {
- return Configurations.Server.Config
+func GetServer() serverConfig {
+ return App.Server.Config
}
//GetSSL return the ssl configs
-func GetSSL() ServerConfig {
- return Configurations.Server.Config
+func GetSSL() serverConfig {
+ return App.Server.Config
}
//GetLog return the log configs
-func GetLog() ServerConfig {
- return Configurations.Server.Config
+func GetLog() serverConfig {
+ return App.Server.Config
}
//GetRegistry return the registry configs
-func GetRegistry() ServerConfig {
- return Configurations.Server.Config
+func GetRegistry() serverConfig {
+ return App.Server.Config
}
//GetPlugin return the plugin configs
-func GetPlugin() ServerConfig {
- return Configurations.Server.Config
+func GetPlugin() serverConfig {
+ return App.Server.Config
}
//GetRBAC return the rbac configs
-func GetRBAC() ServerConfig {
- return Configurations.Server.Config
+func GetRBAC() serverConfig {
+ return App.Server.Config
}
//GetMetrics return the metrics configs
-func GetMetrics() ServerConfig {
- return Configurations.Server.Config
+func GetMetrics() serverConfig {
+ return App.Server.Config
}
func Init() {
@@ -97,19 +105,30 @@ func Init() {
if err != nil {
log.Fatal("can not init archaius", err)
}
- err = archaius.UnmarshalConfig(Configurations)
+
+ err = Reload()
if err != nil {
- log.Fatal("archaius unmarshal config failed", err)
+ log.Fatal("reload configs failed", err)
}
- Configurations.Server = ServerInfo
- *ServerInfo = newInfo()
- plugin.RegisterConfigurator(Configurations)
+ plugin.RegisterConfigurator(App)
version.Ver().Log()
}
-func newInfo() ServerInformation {
+//Reload reload the all configurations
+func Reload() error {
+ err := archaius.UnmarshalConfig(App)
+ if err != nil {
+ return err
+ }
+ *Server = loadServerConfig()
+ body, _ := json.MarshalIndent(archaius.GetConfigs(), "", " ")
+ log.Info(fmt.Sprintf("finish to reload configurations\n%s", body))
+ return nil
+}
+
+func loadServerConfig() ServerConfig {
serviceClearInterval := GetDuration("registry.service.clearInterval",
defaultServiceClearInterval, WithENV("SERVICE_CLEAR_INTERVAL"))
if serviceClearInterval < minServiceClearInterval ||
serviceClearInterval > maxServiceClearInterval {
serviceClearInterval = defaultServiceClearInterval
@@ -133,9 +152,11 @@ func newInfo() ServerInformation {
}
accessLogFile := GetString("log.accessFile", "./access.log",
WithENV("SC_ACCESS_LOG_FILE"), WithStandby("access_log_file"))
- return ServerInformation{
+ return ServerConfig{
Version: InitVersion,
- Config: ServerConfig{
+ // compatible with beego config's runmode
+ Environment: GetString("environment", "dev",
WithStandby("runmode")),
+ Config: serverConfig{
MaxHeaderBytes:
GetInt64("server.request.maxHeaderBytes", 16384,
WithStandby("max_header_bytes")),
MaxBodyBytes:
GetInt64("server.request.maxBodyBytes", 2097152, WithStandby("max_body_bytes")),
ReadHeaderTimeout:
GetString("server.request.headerTimeout", "60s",
WithStandby("read_header_timeout")),
diff --git a/server/config/server.go b/server/config/server.go
index ddba080..311933b 100644
--- a/server/config/server.go
+++ b/server/config/server.go
@@ -24,6 +24,11 @@ import (
)
type ServerConfig struct {
+ Version string `json:"version"`
+ Environment string `json:"environment"`
+ Config serverConfig `json:"-"`
+}
+type serverConfig struct {
MaxHeaderBytes int64 `json:"maxHeaderBytes"`
MaxBodyBytes int64 `json:"maxBodyBytes"`
@@ -79,11 +84,10 @@ type ServerConfig struct {
MetricsInterval time.Duration `json:"-"`
}
-type ServerInformation struct {
- Version string `json:"version"`
- Config ServerConfig `json:"-"`
+func (si *ServerConfig) IsDev() bool {
+ return si.Environment == EnvironmentDev
}
-func NewServerInformation() *ServerInformation {
- return &ServerInformation{Config: ServerConfig{Plugins:
make(util.JSONObject)}}
+func NewServerConfig() *ServerConfig {
+ return &ServerConfig{Config: serverConfig{Plugins:
make(util.JSONObject)}}
}
diff --git a/server/config/types.go b/server/config/types.go
index 29f60c3..9b3491b 100644
--- a/server/config/types.go
+++ b/server/config/types.go
@@ -17,12 +17,19 @@
package config
-import "github.com/apache/servicecomb-service-center/pkg/plugin"
+import (
+ "github.com/apache/servicecomb-service-center/pkg/plugin"
+)
-//Config is yaml file struct
-type Config struct {
- Gov *Gov `yaml:"gov"`
- Server *ServerInformation `yaml:"server"`
+const (
+ EnvironmentDev = "dev"
+ EnvironmentProd = "prod"
+)
+
+//AppConfig is yaml file struct
+type AppConfig struct {
+ Gov *Gov `yaml:"gov"`
+ Server *ServerConfig `yaml:"server"`
}
type Gov struct {
DistOptions []DistributorOptions `yaml:"plugins"`
@@ -34,9 +41,9 @@ type DistributorOptions struct {
}
// GetImplName return the impl name
-func (c *Config) GetImplName(kind plugin.Kind) string {
+func (c *AppConfig) GetImplName(kind plugin.Kind) string {
return GetString(kind.String()+".kind", plugin.Buildin,
WithStandby(kind.String()+"_plugin"))
}
-func (c *Config) GetPluginDir() string {
+func (c *AppConfig) GetPluginDir() string {
return c.Server.Config.PluginsDir
}
diff --git a/server/config/util.go b/server/config/util.go
index cb0f6c0..e09dd76 100644
--- a/server/config/util.go
+++ b/server/config/util.go
@@ -41,13 +41,11 @@ func newOptions(key string, opts []Option) *Options {
// GetString return the string type value by specified key
func GetString(key, def string, opts ...Option) string {
options := newOptions(key, opts)
- val := strings.TrimSpace(archaius.GetString(options.ENV, ""))
- if val != "" {
- return val
+ if archaius.Exist(options.ENV) {
+ return strings.TrimSpace(archaius.GetString(options.ENV, def))
}
- val = strings.TrimSpace(archaius.GetString(key, ""))
- if val != "" {
- return val
+ if archaius.Exist(key) {
+ return strings.TrimSpace(archaius.GetString(key, def))
}
return strings.TrimSpace(beego.AppConfig.DefaultString(options.Standby,
def))
}
@@ -93,7 +91,7 @@ func GetInt64(key string, def int64, opts ...Option) int64 {
// GetDuration return the time.Duration type value by specified key
func GetDuration(key string, def time.Duration, opts ...Option) time.Duration {
- str := GetString(key, "", opts...)
+ str := strings.TrimSpace(GetString(key, "", opts...))
if str == "" {
return def
}
diff --git a/server/core/microservice.go b/server/core/microservice.go
index a79e410..f4dc273 100644
--- a/server/core/microservice.go
+++ b/server/core/microservice.go
@@ -25,7 +25,6 @@ import (
"github.com/apache/servicecomb-service-center/pkg/util"
"github.com/apache/servicecomb-service-center/server/config"
"github.com/apache/servicecomb-service-center/version"
- "github.com/astaxie/beego"
"github.com/go-chassis/cari/discovery"
)
@@ -73,7 +72,7 @@ func prepareSelfRegistration() {
discovery.PropAllowCrossApp: "true",
},
}
- if beego.BConfig.RunMode == "dev" {
+ if config.GetProfile().IsDev() {
Service.Environment = discovery.ENV_DEV
}
diff --git a/server/core/microservice_test.go b/server/core/microservice_test.go
index f3d3a58..5e57650 100644
--- a/server/core/microservice_test.go
+++ b/server/core/microservice_test.go
@@ -20,7 +20,6 @@ import (
"testing"
"github.com/apache/servicecomb-service-center/server/config"
- "github.com/astaxie/beego"
"github.com/go-chassis/cari/discovery"
)
@@ -29,13 +28,13 @@ func init() {
}
func TestPrepareSelfRegistration(t *testing.T) {
- beego.BConfig.RunMode = "dev"
+ config.Server.Environment = "dev"
prepareSelfRegistration()
if Service == nil || Service.Environment != "development" {
t.Fatalf("TestPrepareSelfRegistration faild, %v", Service)
}
- beego.BConfig.RunMode = "prod"
+ config.Server.Environment = "prod"
prepareSelfRegistration()
if Service == nil || Service.AppId != "default" || Service.ServiceName
!= "SERVICECENTER" ||
Service.Environment != "production" ||
Service.Properties["allowCrossApp"] != "true" {
@@ -72,7 +71,7 @@ func TestSetSharedMode(t *testing.T) {
t.Fatalf("TestSetSharedMode failed")
}
- config.ServerInfo.Config.GlobalVisible = "shared"
+ config.Server.Config.GlobalVisible = "shared"
RegisterGlobalServices()
if IsGlobal(&discovery.MicroServiceKey{Tenant: "default/default",
AppId: "default", ServiceName: "no-shared"}) {
t.Fatalf("TestSetSharedMode failed")
diff --git a/server/resource/v1/gov_resource_test.go
b/server/resource/v1/gov_resource_test.go
index cfd039d..633594d 100644
--- a/server/resource/v1/gov_resource_test.go
+++ b/server/resource/v1/gov_resource_test.go
@@ -39,7 +39,7 @@ import (
)
func init() {
- config.Configurations.Gov = &config.Gov{
+ config.App.Gov = &config.Gov{
DistOptions: []config.DistributorOptions{
{
Name: "mock",
diff --git a/server/service/gov/config_distributor_test.go
b/server/service/gov/config_distributor_test.go
index a5a38df..250f00c 100644
--- a/server/service/gov/config_distributor_test.go
+++ b/server/service/gov/config_distributor_test.go
@@ -37,7 +37,7 @@ const MockApp = ""
var id = ""
func init() {
- config.Configurations = &config.Config{
+ config.App = &config.AppConfig{
Gov: &config.Gov{
DistOptions: []config.DistributorOptions{
{
diff --git a/server/service/instance_test.go b/server/service/instance_test.go
index 4b78096..2a6ea16 100644
--- a/server/service/instance_test.go
+++ b/server/service/instance_test.go
@@ -1624,7 +1624,7 @@ var _ = Describe("'Instance' service", func() {
Expect(len(respFind.Instances)).To(Equal(0))
By("shared service discovery")
- config.ServerInfo.Config.GlobalVisible =
"query_instance_shared_provider"
+ config.Server.Config.GlobalVisible =
"query_instance_shared_provider"
core.RegisterGlobalServices()
core.Service.Environment = pb.ENV_PROD
@@ -1866,7 +1866,7 @@ var _ = Describe("'Instance' service", func() {
Expect(len(respFind.Services.Updated[0].Instances)).To(Equal(0))
By("shared service discovery")
- config.ServerInfo.Config.GlobalVisible =
"query_instance_shared_provider"
+ config.Server.Config.GlobalVisible =
"query_instance_shared_provider"
core.RegisterGlobalServices()
core.Service.Environment = pb.ENV_PROD
diff --git a/server/service/rbac/rbac.go b/server/service/rbac/rbac.go
index 4268c38..5f85938 100644
--- a/server/service/rbac/rbac.go
+++ b/server/service/rbac/rbac.go
@@ -73,7 +73,7 @@ func Init() {
initAdminRole()
initDevRole()
rbacframe.Add2WhiteAPIList(APITokenGranter)
- config.ServerInfo.Config.EnableRBAC = true
+ config.Server.Config.EnableRBAC = true
log.Info("rbac is enabled")
}