Improve configcenter-apollo sample (#226)
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
index ccbf779..020e61f 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/case-configuration.yml
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-timeout: 120
+timeout: 300
services:
dubbo-samples-configcenter-apollo:
@@ -22,13 +22,19 @@
basedir: .
mainClass: org.apache.dubbo.samples.configcenter.ApolloProvider
systemProps:
+ - zookeeper.address=dubbo-samples-configcenter-apollo
+ - zookeeper.port=2181
- apollo.address=apollo-quick-start
- apollo.port=8080
waitPortsBeforeRun:
- apollo-quick-start:8080
+ - apollo-quick-start:8090
waitTimeout: 100
+ checkPorts:
+ - 20880
depends_on:
- apollo-db
+ - apollo-quick-start
dubbo-samples-configcenter-apollo-test:
type: test
@@ -40,22 +46,37 @@
- zookeeper.port=2181
- dubbo.address=dubbo-samples-configcenter-apollo
- dubbo.port=20880
+ - apollo.address=apollo-quick-start
+ - apollo.port=8080
waitPortsBeforeRun:
- dubbo-samples-configcenter-apollo:2181
- dubbo-samples-configcenter-apollo:20880
+ - apollo-quick-start:8080
+ - apollo-quick-start:8090
waitTimeout: 100
depends_on:
+ - apollo-quick-start
- dubbo-samples-configcenter-apollo
-
+
apollo-quick-start:
image: nobodyiam/apollo-quick-start
depends_on:
- apollo-db
expose:
- 8080
- - 8070
- links:
- - apollo-db
+ - 8090
+ environment:
+ - APOLLO_SERVICE=1
+ - DB_ADDRESS=apollo-db:3306
+ volumes:
+ - ${_basedir}/src/main/resources/docker/demo.sh:/apollo-quick-start/demo.sh
+ - ./logs:/apollo-quick-start/logs
+ healthcheck:
+ #check apollo config service api
+ test: 'curl -Ss http://localhost:8080/services/config\?appId=SampleApp | grep apollo-configservice'
+ interval: 5s
+ timeout: 5s
+ retries: 60
apollo-db:
image: mysql:5.7
@@ -69,10 +90,10 @@
test: ["CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1"]
interval: 5s
timeout: 5s
- retries: 20
+ retries: 40
volumes:
- ${_basedir}/src/main/resources/docker/sql:/docker-entrypoint-initdb.d
-# - ./sql_data:/var/lib/mysql
+ - ./sql_data:/var/lib/mysql
# volumes_from:
# - apollo-dbdata
# depends_on:
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/pom.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/pom.xml
index 22ce7db..ba1005b 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/pom.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/pom.xml
@@ -28,34 +28,45 @@
<artifactId>dubbo-samples-configcenter-apollo</artifactId>
-
-
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
<dubbo.version>2.7.7</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
- <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
- <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
- <image.name>${project.artifactId}:${dubbo.version}</image.name>
- <java-image.name>openjdk:8</java-image.name>
- <dubbo.port>20880</dubbo.port>
- <zookeeper.port>2181</zookeeper.port>
- <main-class>org.apache.dubbo.samples.configcenter.ApolloProvider</main-class>
+ <apollo.version>1.7.0</apollo.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-bom</artifactId>
+ <artifactId>dubbo-bom</artifactId>
<version>${dubbo.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -63,156 +74,44 @@
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
- <version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-configcenter-apollo</artifactId>
- <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.ctrip.framework.apollo</groupId>
+ <artifactId>apollo-openapi</artifactId>
+ <version>${apollo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ctrip.framework.apollo</groupId>
+ <artifactId>apollo-client</artifactId>
+ <version>${apollo.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>4.3.16.RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
- <profile>
- <id>dubbo-integration-test-disable</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-maven-address-plugin</artifactId>
- <version>1.0-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>local-address</goal>
- </goals>
- <configuration>
- <localAddress>dubbo-local-address</localAddress>
- </configuration>
- <phase>initialize</phase>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>com.google.cloud.tools</groupId>
- <artifactId>jib-maven-plugin</artifactId>
- <version>${jib-maven-plugin.version}</version>
- <configuration>
- <from>
- <image>${java-image.name}</image>
- </from>
- <to>
- <image>${image.name}</image>
- </to>
- <container>
- <mainClass>${main-class}</mainClass>
- <ports>
- <port>${dubbo.port}</port>
- <port>${zookeeper.port}</port>
- </ports>
- <environment>
- <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
- </environment>
- <jvmFlags>
- <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
- </jvmFlags>
- </container>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>dockerBuild</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>${docker-maven-plugin.version}</version>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <run>
- <ports>
- <port>${dubbo.port}:${dubbo.port}</port>
- <port>${zookeeper.port}:${zookeeper.port}</port>
- </ports>
- <wait>
- <log>dubbo service started</log>
- </wait>
- </run>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>start</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>${maven-failsafe-plugin.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <zookeeper.address>${dubbo-local-address}</zookeeper.address>
- </systemPropertyVariables>
- <includes>
- <include>**/*IT.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
<!-- For jdk 11 above JavaEE annotation -->
<profile>
<id>javax.annotation</id>
@@ -234,7 +133,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${source.level}</source>
<target>${target.level}</target>
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloProvider.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloProvider.java
index eea7f15..ed822cc 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloProvider.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloProvider.java
@@ -26,6 +26,7 @@
public class ApolloProvider {
public static void main(String[] args) throws Exception {
+ //ApolloUtil.importConfigs();
new EmbeddedZooKeeper(2181, false).start();
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring/configcenter-provider.xml"});
context.start();
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloUtil.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloUtil.java
new file mode 100644
index 0000000..5615c1c
--- /dev/null
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/ApolloUtil.java
@@ -0,0 +1,75 @@
+package org.apache.dubbo.samples.configcenter;
+
+import com.ctrip.framework.apollo.openapi.client.ApolloOpenApiClient;
+import com.ctrip.framework.apollo.openapi.dto.OpenAppDTO;
+import com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO;
+import com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO;
+import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ApolloUtil {
+
+ private static final Logger logger = LoggerFactory.getLogger(ApolloUtil.class);
+
+ public static void importConfigs() {
+ String zookeeperAddress = System.getProperty("zookeeper.address", "127.0.0.1");
+ String zookeeperPort = System.getProperty("zookeeper.port", "2181");
+
+ Map<String,String> props = new LinkedHashMap<>();
+ props.put("dubbo.registry.address", String.format("zookeeper://%s:%s", zookeeperAddress, zookeeperPort));
+
+ logger.info("Importing configs to apollo : {}", props);
+ try {
+ String portalAddress = System.getProperty("apollo.address", "127.0.0.1");
+ String portalPort = System.getProperty("apollo.portal-port", "8070");
+ //How to generate apollo token by program ?
+ String token = System.getProperty("apollo.portal-token");
+
+ ApolloOpenApiClient apolloApiClient = ApolloOpenApiClient
+ .newBuilder()
+ .withPortalUrl(String.format("http://%s:%s", portalAddress, portalPort))
+ .withToken(token)
+ .build();
+
+ //find app
+ List<OpenAppDTO> allApps = apolloApiClient.getAllApps();
+ OpenAppDTO appDTO = allApps.get(0);
+ String appId = appDTO.getAppId();
+
+ //find env
+ List<OpenEnvClusterDTO> envClusterInfo = apolloApiClient.getEnvClusterInfo(appId);
+ OpenEnvClusterDTO openEnvClusterDTO = envClusterInfo.get(0);
+ String env = openEnvClusterDTO.getEnv();
+ List<String> clusters = new ArrayList<>(openEnvClusterDTO.getClusters());
+ String cluster = clusters.get(0);
+
+ //create dubbo namespace
+ String namespace = "dubbo";
+ OpenAppNamespaceDTO appNamespaceDTO = new OpenAppNamespaceDTO();
+ appNamespaceDTO.setName(namespace);
+ appNamespaceDTO.setAppId(appDTO.getAppId());
+ appNamespaceDTO.setFormat("properties");
+ appNamespaceDTO.setDataChangeCreatedBy("dubbo");
+ apolloApiClient.createAppNamespace(appNamespaceDTO);
+
+ //import configs
+ props.forEach((key,value) -> {
+ OpenItemDTO itemDTO = new OpenItemDTO();
+ itemDTO.setKey(key);
+ itemDTO.setValue(value);
+ apolloApiClient.createItem(appId, env, cluster, namespace, itemDTO);
+ } );
+ logger.info("Import configs to apollo successfully.");
+ } catch (Exception e) {
+ logger.error("Import configs failed", e);
+ throw e;
+ }
+ }
+
+}
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/impl/DemoServiceImpl.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/impl/DemoServiceImpl.java
index 83f0a5e..1455b68 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/impl/DemoServiceImpl.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/java/org/apache/dubbo/samples/configcenter/impl/DemoServiceImpl.java
@@ -30,11 +30,6 @@
@Override
public String sayHello(String name) {
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name +
", request from consumer: " + RpcContext.getContext().getRemoteAddress());
return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/META-INF/app.properties b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/META-INF/app.properties
index 21593cb..7fec895 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/META-INF/app.properties
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/META-INF/app.properties
@@ -1 +1 @@
-app.id=dubbo-configcenter-apollo
\ No newline at end of file
+app.id=SampleApp
\ No newline at end of file
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/demo.sh b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/demo.sh
new file mode 100755
index 0000000..05940f5
--- /dev/null
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/demo.sh
@@ -0,0 +1,216 @@
+#!/bin/bash
+
+# apollo config db info
+db_address=${DB_ADDRESS:-localhost:3306}
+
+apollo_config_db_url=jdbc:mysql://$db_address/ApolloConfigDB?characterEncoding=utf8
+apollo_config_db_username=root
+apollo_config_db_password=
+
+# apollo portal db info
+apollo_portal_db_url=jdbc:mysql://$db_address/ApolloPortalDB?characterEncoding=utf8
+apollo_portal_db_username=root
+apollo_portal_db_password=
+
+# =============== Please do not modify the following content =============== #
+
+if [ "$(uname)" == "Darwin" ]; then
+ windows="0"
+elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
+ windows="0"
+elif [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then
+ windows="1"
+else
+ windows="0"
+fi
+
+# meta server url
+config_server_url=${CONFIG_SERVER_URL:-http://localhost:8080}
+admin_server_url=http://localhost:8090
+eureka_service_url=$config_server_url/eureka/
+portal_url=http://localhost:8070
+
+# JAVA OPTS
+BASE_JAVA_OPTS="-Denv=dev -Xmx200m"
+# Disalbe disk free space check of SpringBoot
+BASE_JAVA_OPTS="$BASE_JAVA_OPTS -Dmanagement.health.diskspace.enabled=false"
+CLIENT_JAVA_OPTS="$BASE_JAVA_OPTS -Dapollo.meta=$config_server_url"
+SERVER_JAVA_OPTS="$BASE_JAVA_OPTS -Dspring.profiles.active=github -Deureka.service.url=$eureka_service_url -Deureka.client.registry-fetch-interval-seconds=10"
+PORTAL_JAVA_OPTS="$BASE_JAVA_OPTS -Ddev_meta=$config_server_url -Dspring.profiles.active=github,auth -Deureka.client.enabled=false -Dhibernate.query.plan_cache_max_size=192"
+
+# executable
+JAR_FILE=apollo-all-in-one.jar
+SERVICE_DIR=./service
+LOG_DIR=./logs
+SERVICE_JAR_NAME=apollo-service.jar
+SERVICE_JAR=$SERVICE_DIR/$SERVICE_JAR_NAME
+SERVICE_LOG=$LOG_DIR/apollo-service.log
+ADMIN_LOG=$LOG_DIR/apollo-admin.log
+PORTAL_DIR=./portal
+PORTAL_JAR_NAME=apollo-portal.jar
+PORTAL_JAR=$PORTAL_DIR/$PORTAL_JAR_NAME
+PORTAL_LOG=$LOG_DIR/apollo-portal.log
+CLIENT_DIR=./client
+CLIENT_JAR=$CLIENT_DIR/apollo-demo.jar
+
+# go to script directory
+cd "${0%/*}"
+
+mkdir -p $LOG_DIR
+
+function checkJava {
+ if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
+ if [ "$windows" == "1" ]; then
+ tmp_java_home=`cygpath -sw "$JAVA_HOME"`
+ export JAVA_HOME=`cygpath -u "$tmp_java_home"`
+ echo "Windows new JAVA_HOME is: $JAVA_HOME"
+ fi
+ _java="$JAVA_HOME/bin/java"
+ elif type -p java > /dev/null; then
+ _java=java
+ else
+ echo "Could not find java executable, please check PATH and JAVA_HOME variables."
+ exit 1
+ fi
+
+ if [[ "$_java" ]]; then
+ version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+ if [[ "$version" < "1.8" ]]; then
+ echo "Java version is $version, please make sure java 1.8+ is in the path"
+ exit 1
+ fi
+ fi
+}
+
+function checkServerAlive {
+ declare -i counter=0
+ declare -i max_counter=100 # 24*5=120s
+ declare -i total_time=0
+
+ SERVER_URL="$1"
+
+ until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
+ do
+ printf "."
+ counter+=1
+ sleep 5
+ done
+
+ total_time=counter*5
+
+ if [[ (( counter -ge max_counter )) ]];
+ then
+ return $total_time
+ fi
+
+ return 0
+}
+
+checkJava
+
+if [ "$1" = "start" ] ; then
+ # wait for database ready
+ sleep 5
+
+ if [ "$APOLLO_SERVICE" == "1" ];then
+ echo "==== starting service ===="
+ echo "Service logging file is $SERVICE_LOG"
+ export JAVA_OPTS="$SERVER_JAVA_OPTS -Dlogging.file=./apollo-service.log -Dspring.datasource.url=$apollo_config_db_url -Dspring.datasource.username=$apollo_config_db_username -Dspring.datasource.password=$apollo_config_db_password"
+
+ if [[ -f $SERVICE_JAR ]]; then
+ rm -rf $SERVICE_JAR
+ fi
+
+ ln $JAR_FILE $SERVICE_JAR
+ chmod a+x $SERVICE_JAR
+
+ java $JAVA_OPTS -jar $SERVICE_JAR --configservice --adminservice &> $SERVICE_LOG &
+
+ rc=$?
+ if [[ $rc != 0 ]];
+ then
+ echo "Failed to start service, return code: $rc. Please check $SERVICE_LOG for more information."
+ exit $rc;
+ fi
+
+ printf "Waiting for config service startup"
+ checkServerAlive $config_server_url
+ rc=$?
+ if [[ $rc != 0 ]];
+ then
+ printf "\nConfig service failed to start in $rc seconds! Please check $SERVICE_LOG for more information.\n"
+ exit 1;
+ fi
+ printf "\nConfig service started. You may visit $config_server_url for service status now!\n"
+
+ printf "Waiting for admin service startup"
+ checkServerAlive $admin_server_url
+ rc=$?
+ if [[ $rc != 0 ]];
+ then
+ printf "\nAdmin service failed to start in $rc seconds! Please check $SERVICE_LOG for more information.\n"
+ exit 1;
+ fi
+ printf "\nAdmin service started\n"
+ fi
+
+ if [ "$APOLLO_PORTAL" == "1" ]; then
+ echo "==== starting portal ===="
+ echo "Portal logging file is $PORTAL_LOG"
+ export JAVA_OPTS="$PORTAL_JAVA_OPTS -Dlogging.file=./apollo-portal.log -Dserver.port=8070 -Dspring.datasource.url=$apollo_portal_db_url -Dspring.datasource.username=$apollo_portal_db_username -Dspring.datasource.password=$apollo_portal_db_password"
+
+ if [[ -f $PORTAL_JAR ]]; then
+ rm -rf $PORTAL_JAR
+ fi
+
+ ln $JAR_FILE $PORTAL_JAR
+ chmod a+x $PORTAL_JAR
+
+ java $JAVA_OPTS -jar $PORTAL_JAR --portal &> $PORTAL_LOG &
+ rc=$?
+ if [[ $rc != 0 ]];
+ then
+ echo "Failed to start portal, return code: $rc. Please check $PORTAL_LOG for more information."
+ exit $rc;
+ fi
+
+ printf "Waiting for portal startup"
+ checkServerAlive $portal_url
+ rc=$?
+ if [[ $rc != 0 ]];
+ then
+ printf "\nPortal failed to start in $rc seconds! Please check $PORTAL_LOG for more information.\n"
+ exit 1;
+ fi
+ printf "\nPortal started. You can visit $portal_url now!\n"
+ fi
+
+ wait
+ echo "apollo exit"
+
+elif [ "$1" = "client" ] ; then
+ if [ "$windows" == "1" ]; then
+ java -classpath "$CLIENT_DIR;$CLIENT_JAR" $CLIENT_JAVA_OPTS com.ctrip.framework.apollo.demo.api.SimpleApolloConfigDemo
+ else
+ java -classpath $CLIENT_DIR:$CLIENT_JAR $CLIENT_JAVA_OPTS com.ctrip.framework.apollo.demo.api.SimpleApolloConfigDemo
+ fi
+
+elif [ "$1" = "stop" ] ; then
+ echo "==== stopping portal ===="
+ cd $PORTAL_DIR
+ ./$PORTAL_JAR_NAME stop
+
+ cd ..
+
+ echo "==== stopping service ===="
+ cd $SERVICE_DIR
+ ./$SERVICE_JAR_NAME stop
+
+else
+ echo "Usage: demo.sh ( commands ... )"
+ echo "commands:"
+ echo " start start services and portal"
+ echo " client start client demo program"
+ echo " stop stop services and portal"
+ exit 1
+fi
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/docker-compose.yml b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/docker-compose.yml
deleted file mode 100644
index fd975ba..0000000
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/docker-compose.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-version: '2'
-
-services:
- apollo-quick-start:
- image: nobodyiam/apollo-quick-start
- container_name: apollo-quick-start
- depends_on:
- - apollo-db
- ports:
- - "8080:8080"
- - "8070:8070"
- links:
- - apollo-db
-
- apollo-db:
- image: mysql:5.7
- container_name: apollo-db
- environment:
- TZ: Asia/Shanghai
- MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
- depends_on:
- - apollo-dbdata
- ports:
- - "13306:3306"
- volumes:
- - ./sql:/docker-entrypoint-initdb.d
- volumes_from:
- - apollo-dbdata
-
- apollo-dbdata:
- image: alpine:latest
- container_name: apollo-dbdata
- volumes:
- - /var/lib/mysql
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloconfigdb.sql b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloconfigdb.sql
index b1e8526..246ed71 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloconfigdb.sql
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloconfigdb.sql
@@ -1,22 +1,67 @@
+-- MySQL dump 10.13 Distrib 5.7.32, for Linux (x86_64)
+--
+-- Host: localhost Database: ApolloConfigDB
+-- ------------------------------------------------------
+-- Server version 5.7.32
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-# Create Database
-# ------------------------------------------------------------
-CREATE DATABASE IF NOT EXISTS ApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
+--
+-- Current Database: `ApolloConfigDB`
+--
-Use ApolloConfigDB;
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ApolloConfigDB` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
-# Dump of table app
-# ------------------------------------------------------------
+USE `ApolloConfigDB`;
+
+--
+-- Table structure for table `AccessKey`
+--
+
+DROP TABLE IF EXISTS `AccessKey`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `AccessKey` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `Secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secret',
+ `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `AppId` (`AppId`(191)),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问密钥';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `AccessKey`
+--
+
+LOCK TABLES `AccessKey` WRITE;
+/*!40000 ALTER TABLE `AccessKey` DISABLE KEYS */;
+/*!40000 ALTER TABLE `AccessKey` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `App`
+--
DROP TABLE IF EXISTS `App`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `App` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -34,15 +79,26 @@
KEY `AppId` (`AppId`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Name` (`Name`(191))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `App`
+--
+LOCK TABLES `App` WRITE;
+/*!40000 ALTER TABLE `App` DISABLE KEYS */;
+INSERT INTO `App` VALUES (1,'SampleApp','Sample App','TEST1','样例部门1','apollo','apollo@acme.com',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43');
+/*!40000 ALTER TABLE `App` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table appnamespace
-# ------------------------------------------------------------
+--
+-- Table structure for table `AppNamespace`
+--
DROP TABLE IF EXISTS `AppNamespace`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `AppNamespace` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一',
@@ -59,15 +115,26 @@
KEY `IX_AppId` (`AppId`),
KEY `Name_AppId` (`Name`,`AppId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `AppNamespace`
+--
+LOCK TABLES `AppNamespace` WRITE;
+/*!40000 ALTER TABLE `AppNamespace` DISABLE KEYS */;
+INSERT INTO `AppNamespace` VALUES (1,'application','SampleApp','properties',_binary '\0','default app namespace',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'dubbo','SampleApp','properties',_binary '\0','',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20');
+/*!40000 ALTER TABLE `AppNamespace` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table audit
-# ------------------------------------------------------------
+--
+-- Table structure for table `Audit`
+--
DROP TABLE IF EXISTS `Audit`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Audit` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名',
@@ -81,15 +148,26 @@
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表';
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Audit`
+--
+LOCK TABLES `Audit` WRITE;
+/*!40000 ALTER TABLE `Audit` DISABLE KEYS */;
+INSERT INTO `Audit` VALUES (1,'Namespace',2,'INSERT',NULL,_binary '\0','apollo','2021-01-05 22:07:21',NULL,'2021-01-05 22:07:21'),(2,'AppNamespace',2,'INSERT',NULL,_binary '\0','apollo','2021-01-05 22:07:21',NULL,'2021-01-05 22:07:21'),(3,'Item',2,'INSERT',NULL,_binary '\0','apollo','2021-01-05 22:07:56',NULL,'2021-01-05 22:07:56'),(4,'Item',2,'UPDATE',NULL,_binary '\0','apollo','2021-01-05 22:14:39',NULL,'2021-01-05 22:14:39'),(5,'Release',2,'INSERT',NULL,_binary '\0','apollo','2021-01-05 22:14:43',NULL,'2021-01-05 22:14:43'),(6,'ReleaseHistory',2,'INSERT',NULL,_binary '\0','apollo','2021-01-05 22:14:43',NULL,'2021-01-05 22:14:43');
+/*!40000 ALTER TABLE `Audit` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table cluster
-# ------------------------------------------------------------
+--
+-- Table structure for table `Cluster`
+--
DROP TABLE IF EXISTS `Cluster`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Cluster` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字',
@@ -104,15 +182,26 @@
KEY `IX_AppId_Name` (`AppId`,`Name`),
KEY `IX_ParentClusterId` (`ParentClusterId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群';
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='集群';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Cluster`
+--
+LOCK TABLES `Cluster` WRITE;
+/*!40000 ALTER TABLE `Cluster` DISABLE KEYS */;
+INSERT INTO `Cluster` VALUES (1,'default','SampleApp',0,_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43');
+/*!40000 ALTER TABLE `Cluster` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table commit
-# ------------------------------------------------------------
+--
+-- Table structure for table `Commit`
+--
DROP TABLE IF EXISTS `Commit`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Commit` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`ChangeSets` longtext NOT NULL COMMENT '修改变更集',
@@ -130,13 +219,26 @@
KEY `AppId` (`AppId`(191)),
KEY `ClusterName` (`ClusterName`(191)),
KEY `NamespaceName` (`NamespaceName`(191))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表';
+/*!40101 SET character_set_client = @saved_cs_client */;
-# Dump of table grayreleaserule
-# ------------------------------------------------------------
+--
+-- Dumping data for table `Commit`
+--
+
+LOCK TABLES `Commit` WRITE;
+/*!40000 ALTER TABLE `Commit` DISABLE KEYS */;
+INSERT INTO `Commit` VALUES (1,'{\"createItems\":[{\"namespaceId\":2,\"key\":\"dubbo.registry.address\",\"value\":\"zookeeper://dubbo-samples-configcenter-apollo:2181\",\"lineNum\":1,\"id\":2,\"isDeleted\":false,\"dataChangeCreatedBy\":\"apollo\",\"dataChangeCreatedTime\":\"2021-01-06 20:07:56\",\"dataChangeLastModifiedBy\":\"apollo\",\"dataChangeLastModifiedTime\":\"2021-01-06 20:07:56\"}],\"updateItems\":[],\"deleteItems\":[]}','SampleApp','default','dubbo',NULL,_binary '\0','apollo','2021-01-05 22:07:56','apollo','2021-01-05 22:07:56'),(2,'{\"createItems\":[],\"updateItems\":[{\"oldItem\":{\"namespaceId\":2,\"key\":\"dubbo.registry.address\",\"value\":\"zookeeper://dubbo-samples-configcenter-apollo:2181\",\"lineNum\":1,\"id\":2,\"isDeleted\":false,\"dataChangeCreatedBy\":\"apollo\",\"dataChangeCreatedTime\":\"2021-01-06 20:07:56\",\"dataChangeLastModifiedBy\":\"apollo\",\"dataChangeLastModifiedTime\":\"2021-01-06 20:07:56\"},\"newItem\":{\"namespaceId\":2,\"key\":\"dubbo.registry.address\",\"value\":\"zookeeper://dubbo-samples-configcenter-apollo:2181?backup\\u003d127.0.0.1:2181\",\"comment\":\"\",\"lineNum\":1,\"id\":2,\"isDeleted\":false,\"dataChangeCreatedBy\":\"apollo\",\"dataChangeCreatedTime\":\"2021-01-06 20:07:56\",\"dataChangeLastModifiedBy\":\"apollo\",\"dataChangeLastModifiedTime\":\"2021-01-06 20:14:38\"}}],\"deleteItems\":[]}','SampleApp','default','dubbo',NULL,_binary '\0','apollo','2021-01-05 22:14:39','apollo','2021-01-05 22:14:39');
+/*!40000 ALTER TABLE `Commit` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `GrayReleaseRule`
+--
DROP TABLE IF EXISTS `GrayReleaseRule`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GrayReleaseRule` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -155,13 +257,24 @@
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `GrayReleaseRule`
+--
-# Dump of table instance
-# ------------------------------------------------------------
+LOCK TABLES `GrayReleaseRule` WRITE;
+/*!40000 ALTER TABLE `GrayReleaseRule` DISABLE KEYS */;
+/*!40000 ALTER TABLE `GrayReleaseRule` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Instance`
+--
DROP TABLE IF EXISTS `Instance`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Instance` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -175,14 +288,24 @@
KEY `IX_IP` (`Ip`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Instance`
+--
+LOCK TABLES `Instance` WRITE;
+/*!40000 ALTER TABLE `Instance` DISABLE KEYS */;
+/*!40000 ALTER TABLE `Instance` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table instanceconfig
-# ------------------------------------------------------------
+--
+-- Table structure for table `InstanceConfig`
+--
DROP TABLE IF EXISTS `InstanceConfig`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `InstanceConfig` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id',
@@ -199,14 +322,24 @@
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `InstanceConfig`
+--
+LOCK TABLES `InstanceConfig` WRITE;
+/*!40000 ALTER TABLE `InstanceConfig` DISABLE KEYS */;
+/*!40000 ALTER TABLE `InstanceConfig` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table item
-# ------------------------------------------------------------
+--
+-- Table structure for table `Item`
+--
DROP TABLE IF EXISTS `Item`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Item` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
@@ -222,15 +355,26 @@
PRIMARY KEY (`Id`),
KEY `IX_GroupId` (`NamespaceId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='配置项目';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Item`
+--
+LOCK TABLES `Item` WRITE;
+/*!40000 ALTER TABLE `Item` DISABLE KEYS */;
+INSERT INTO `Item` VALUES (1,1,'timeout','100','sample timeout配置',1,_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,2,'dubbo.registry.address','zookeeper://dubbo-samples-configcenter-apollo:2181?backup=127.0.0.1:2181','',1,_binary '\0','apollo','2021-01-05 22:07:56','apollo','2021-01-05 22:14:39');
+/*!40000 ALTER TABLE `Item` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table namespace
-# ------------------------------------------------------------
+--
+-- Table structure for table `Namespace`
+--
DROP TABLE IF EXISTS `Namespace`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Namespace` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -245,15 +389,26 @@
KEY `AppId_ClusterName_NamespaceName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_NamespaceName` (`NamespaceName`(191))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Namespace`
+--
+LOCK TABLES `Namespace` WRITE;
+/*!40000 ALTER TABLE `Namespace` DISABLE KEYS */;
+INSERT INTO `Namespace` VALUES (1,'SampleApp','default','application',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'SampleApp','default','dubbo',_binary '\0','apollo','2021-01-05 22:07:21','apollo','2021-01-05 22:07:21');
+/*!40000 ALTER TABLE `Namespace` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table namespacelock
-# ------------------------------------------------------------
+--
+-- Table structure for table `NamespaceLock`
+--
DROP TABLE IF EXISTS `NamespaceLock`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `NamespaceLock` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
`NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
@@ -266,14 +421,24 @@
UNIQUE KEY `IX_NamespaceId` (`NamespaceId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `NamespaceLock`
+--
+LOCK TABLES `NamespaceLock` WRITE;
+/*!40000 ALTER TABLE `NamespaceLock` DISABLE KEYS */;
+/*!40000 ALTER TABLE `NamespaceLock` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table release
-# ------------------------------------------------------------
+--
+-- Table structure for table `Release`
+--
DROP TABLE IF EXISTS `Release`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Release` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
@@ -293,14 +458,26 @@
KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_ReleaseKey` (`ReleaseKey`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='发布';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Release`
+--
-# Dump of table releasehistory
-# ------------------------------------------------------------
+LOCK TABLES `Release` WRITE;
+/*!40000 ALTER TABLE `Release` DISABLE KEYS */;
+INSERT INTO `Release` VALUES (1,'20161009155425-d3a0749c6e20bc15','20161009155424-release','Sample发布','SampleApp','default','application','{\"timeout\":\"100\"}',_binary '\0',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'20210106201443-f273857abac82340','20210106201440-release','','SampleApp','default','dubbo','{\"dubbo.registry.address\":\"zookeeper://dubbo-samples-configcenter-apollo:2181?backup\\u003d127.0.0.1:2181\"}',_binary '\0',_binary '\0','apollo','2021-01-05 22:14:43','apollo','2021-01-05 22:14:43');
+/*!40000 ALTER TABLE `Release` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `ReleaseHistory`
+--
DROP TABLE IF EXISTS `ReleaseHistory`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ReleaseHistory` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -320,14 +497,26 @@
KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`),
KEY `IX_ReleaseId` (`ReleaseId`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='发布历史';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `ReleaseHistory`
+--
-# Dump of table releasemessage
-# ------------------------------------------------------------
+LOCK TABLES `ReleaseHistory` WRITE;
+/*!40000 ALTER TABLE `ReleaseHistory` DISABLE KEYS */;
+INSERT INTO `ReleaseHistory` VALUES (1,'SampleApp','default','application','default',1,0,0,'{}',_binary '\0','apollo','2021-01-06 11:52:43','apollo','2021-01-06 11:52:43'),(2,'SampleApp','default','dubbo','default',2,0,0,'{\"isEmergencyPublish\":false}',_binary '\0','apollo','2021-01-05 22:14:43','apollo','2021-01-05 22:14:43');
+/*!40000 ALTER TABLE `ReleaseHistory` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `ReleaseMessage`
+--
DROP TABLE IF EXISTS `ReleaseMessage`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ReleaseMessage` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容',
@@ -335,15 +524,26 @@
PRIMARY KEY (`Id`),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Message` (`Message`(191))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='发布消息';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `ReleaseMessage`
+--
+LOCK TABLES `ReleaseMessage` WRITE;
+/*!40000 ALTER TABLE `ReleaseMessage` DISABLE KEYS */;
+INSERT INTO `ReleaseMessage` VALUES (1,'SampleApp+default+application','2021-01-06 11:52:43'),(2,'SampleApp+default+dubbo','2021-01-05 22:14:43');
+/*!40000 ALTER TABLE `ReleaseMessage` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table serverconfig
-# ------------------------------------------------------------
+--
+-- Table structure for table `ServerConfig`
+--
DROP TABLE IF EXISTS `ServerConfig`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ServerConfig` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
@@ -358,53 +558,26 @@
PRIMARY KEY (`Id`),
KEY `IX_Key` (`Key`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
+/*!40101 SET character_set_client = @saved_cs_client */;
-# Config
-# ------------------------------------------------------------
-INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
-VALUES
- ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
- ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
- ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
- ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
- ('item.key.length.limit', 'default', '128', 'item key 最大长度限制');
+--
+-- Dumping data for table `ServerConfig`
+--
-# Sample Data
-# ------------------------------------------------------------
-INSERT INTO `App` (`AppId`, `Name`, `OrgId`, `OrgName`, `OwnerName`, `OwnerEmail`)
-VALUES
- ('SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com');
+LOCK TABLES `ServerConfig` WRITE;
+/*!40000 ALTER TABLE `ServerConfig` DISABLE KEYS */;
+INSERT INTO `ServerConfig` VALUES (1,'eureka.service.url','default','http://localhost:8080/eureka/','Eureka服务Url,多个service以英文逗号分隔',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'namespace.lock.switch','default','false','一次发布只能有一个人修改开关',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(3,'item.value.length.limit','default','20000','item value最大长度限制',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(4,'config-service.cache.enabled','default','false','ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(5,'item.key.length.limit','default','128','item key 最大长度限制',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43');
+/*!40000 ALTER TABLE `ServerConfig` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-INSERT INTO `AppNamespace` (`Name`, `AppId`, `Format`, `IsPublic`, `Comment`)
-VALUES
- ('application', 'SampleApp', 'properties', 0, 'default app namespace');
-
-INSERT INTO `Cluster` (`Name`, `AppId`)
-VALUES
- ('default', 'SampleApp');
-
-INSERT INTO `Namespace` (`Id`, `AppId`, `ClusterName`, `NamespaceName`)
-VALUES
- (1, 'SampleApp', 'default', 'application');
-
-
-INSERT INTO `Item` (`NamespaceId`, `Key`, `Value`, `Comment`, `LineNum`)
-VALUES
- (1, 'timeout', '100', 'sample timeout配置', 1);
-
-INSERT INTO `Release` (`ReleaseKey`, `Name`, `Comment`, `AppId`, `ClusterName`, `NamespaceName`, `Configurations`)
-VALUES
- ('20161009155425-d3a0749c6e20bc15', '20161009155424-release', 'Sample发布', 'SampleApp', 'default', 'application', '{\"timeout\":\"100\"}');
-
-INSERT INTO `ReleaseHistory` (`AppId`, `ClusterName`, `NamespaceName`, `BranchName`, `ReleaseId`, `PreviousReleaseId`, `Operation`, `OperationContext`, `DataChange_CreatedBy`, `DataChange_LastModifiedBy`)
-VALUES
- ('SampleApp', 'default', 'application', 'default', 1, 0, 0, '{}', 'apollo', 'apollo');
-
-
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2021-01-06 20:17:01
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloportaldb.sql b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloportaldb.sql
index 544ed43..151eccc 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloportaldb.sql
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/docker/sql/apolloportaldb.sql
@@ -1,22 +1,35 @@
+-- MySQL dump 10.13 Distrib 5.7.32, for Linux (x86_64)
+--
+-- Host: localhost Database: ApolloPortalDB
+-- ------------------------------------------------------
+-- Server version 5.7.32
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-# Create Database
-# ------------------------------------------------------------
-CREATE DATABASE IF NOT EXISTS ApolloPortalDB DEFAULT CHARACTER SET = utf8mb4;
+--
+-- Current Database: `ApolloPortalDB`
+--
-Use ApolloPortalDB;
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ApolloPortalDB` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
-# Dump of table app
-# ------------------------------------------------------------
+USE `ApolloPortalDB`;
+
+--
+-- Table structure for table `App`
+--
DROP TABLE IF EXISTS `App`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `App` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -34,15 +47,26 @@
KEY `AppId` (`AppId`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Name` (`Name`(191))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `App`
+--
+LOCK TABLES `App` WRITE;
+/*!40000 ALTER TABLE `App` DISABLE KEYS */;
+INSERT INTO `App` VALUES (1,'SampleApp','Sample App','TEST1','样例部门1','apollo','apollo@acme.com',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43');
+/*!40000 ALTER TABLE `App` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table appnamespace
-# ------------------------------------------------------------
+--
+-- Table structure for table `AppNamespace`
+--
DROP TABLE IF EXISTS `AppNamespace`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `AppNamespace` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一',
@@ -59,15 +83,51 @@
KEY `IX_AppId` (`AppId`),
KEY `Name_AppId` (`Name`,`AppId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `AppNamespace`
+--
+LOCK TABLES `AppNamespace` WRITE;
+/*!40000 ALTER TABLE `AppNamespace` DISABLE KEYS */;
+INSERT INTO `AppNamespace` VALUES (1,'application','SampleApp','properties',_binary '\0','default app namespace',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'dubbo','SampleApp','properties',_binary '\0','',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20');
+/*!40000 ALTER TABLE `AppNamespace` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table consumer
-# ------------------------------------------------------------
+--
+-- Table structure for table `Authorities`
+--
+
+DROP TABLE IF EXISTS `Authorities`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Authorities` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `Username` varchar(64) NOT NULL,
+ `Authority` varchar(50) NOT NULL,
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Authorities`
+--
+
+LOCK TABLES `Authorities` WRITE;
+/*!40000 ALTER TABLE `Authorities` DISABLE KEYS */;
+INSERT INTO `Authorities` VALUES (1,'apollo','ROLE_user');
+/*!40000 ALTER TABLE `Authorities` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Consumer`
+--
DROP TABLE IF EXISTS `Consumer`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Consumer` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
@@ -85,14 +145,24 @@
KEY `AppId` (`AppId`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放API消费者';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Consumer`
+--
+LOCK TABLES `Consumer` WRITE;
+/*!40000 ALTER TABLE `Consumer` DISABLE KEYS */;
+/*!40000 ALTER TABLE `Consumer` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table consumeraudit
-# ------------------------------------------------------------
+--
+-- Table structure for table `ConsumerAudit`
+--
DROP TABLE IF EXISTS `ConsumerAudit`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ConsumerAudit` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
@@ -104,14 +174,24 @@
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_ConsumerId` (`ConsumerId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer审计表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `ConsumerAudit`
+--
+LOCK TABLES `ConsumerAudit` WRITE;
+/*!40000 ALTER TABLE `ConsumerAudit` DISABLE KEYS */;
+/*!40000 ALTER TABLE `ConsumerAudit` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table consumerrole
-# ------------------------------------------------------------
+--
+-- Table structure for table `ConsumerRole`
+--
DROP TABLE IF EXISTS `ConsumerRole`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ConsumerRole` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
@@ -126,14 +206,24 @@
KEY `IX_RoleId` (`RoleId`),
KEY `IX_ConsumerId_RoleId` (`ConsumerId`,`RoleId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer和role的绑定表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `ConsumerRole`
+--
+LOCK TABLES `ConsumerRole` WRITE;
+/*!40000 ALTER TABLE `ConsumerRole` DISABLE KEYS */;
+/*!40000 ALTER TABLE `ConsumerRole` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table consumertoken
-# ------------------------------------------------------------
+--
+-- Table structure for table `ConsumerToken`
+--
DROP TABLE IF EXISTS `ConsumerToken`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ConsumerToken` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'ConsumerId',
@@ -148,12 +238,24 @@
UNIQUE KEY `IX_Token` (`Token`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer token表';
+/*!40101 SET character_set_client = @saved_cs_client */;
-# Dump of table favorite
-# ------------------------------------------------------------
+--
+-- Dumping data for table `ConsumerToken`
+--
+
+LOCK TABLES `ConsumerToken` WRITE;
+/*!40000 ALTER TABLE `ConsumerToken` DISABLE KEYS */;
+/*!40000 ALTER TABLE `ConsumerToken` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Favorite`
+--
DROP TABLE IF EXISTS `Favorite`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Favorite` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`UserId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '收藏的用户',
@@ -168,13 +270,25 @@
KEY `AppId` (`AppId`(191)),
KEY `IX_UserId` (`UserId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表';
+/*!40101 SET character_set_client = @saved_cs_client */;
-# Dump of table permission
-# ------------------------------------------------------------
+--
+-- Dumping data for table `Favorite`
+--
+
+LOCK TABLES `Favorite` WRITE;
+/*!40000 ALTER TABLE `Favorite` DISABLE KEYS */;
+/*!40000 ALTER TABLE `Favorite` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Permission`
+--
DROP TABLE IF EXISTS `Permission`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Permission` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`PermissionType` varchar(32) NOT NULL DEFAULT '' COMMENT '权限类型',
@@ -187,15 +301,26 @@
PRIMARY KEY (`Id`),
KEY `IX_TargetId_PermissionType` (`TargetId`(191),`PermissionType`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='permission表';
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='permission表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Permission`
+--
+LOCK TABLES `Permission` WRITE;
+/*!40000 ALTER TABLE `Permission` DISABLE KEYS */;
+INSERT INTO `Permission` VALUES (1,'CreateCluster','SampleApp',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'CreateNamespace','SampleApp',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(3,'AssignRole','SampleApp',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(4,'ModifyNamespace','SampleApp+application',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(5,'ReleaseNamespace','SampleApp+application',_binary '\0','','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(6,'CreateApplication','SystemRole',_binary '\0','apollo','2021-01-05 21:54:27','apollo','2021-01-05 21:54:27'),(7,'ModifyNamespace','SampleApp+application+DEV',_binary '\0','apollo','2021-01-05 22:00:26','apollo','2021-01-05 22:00:26'),(8,'ReleaseNamespace','SampleApp+application+DEV',_binary '\0','apollo','2021-01-05 22:00:26','apollo','2021-01-05 22:00:26'),(9,'ModifyNamespace','SampleApp+dubbo',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(10,'ReleaseNamespace','SampleApp+dubbo',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(11,'ModifyNamespace','SampleApp+dubbo+DEV',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(12,'ReleaseNamespace','SampleApp+dubbo+DEV',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20');
+/*!40000 ALTER TABLE `Permission` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table role
-# ------------------------------------------------------------
+--
+-- Table structure for table `Role`
+--
DROP TABLE IF EXISTS `Role`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Role` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`RoleName` varchar(256) NOT NULL DEFAULT '' COMMENT 'Role name',
@@ -207,15 +332,26 @@
PRIMARY KEY (`Id`),
KEY `IX_RoleName` (`RoleName`(191)),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Role`
+--
+LOCK TABLES `Role` WRITE;
+/*!40000 ALTER TABLE `Role` DISABLE KEYS */;
+INSERT INTO `Role` VALUES (1,'Master+SampleApp',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'ModifyNamespace+SampleApp+application',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(3,'ReleaseNamespace+SampleApp+application',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(4,'CreateApplication+SystemRole',_binary '\0','apollo','2021-01-05 21:54:27','apollo','2021-01-05 21:54:27'),(5,'ModifyNamespace+SampleApp+application+DEV',_binary '\0','apollo','2021-01-05 22:00:26','apollo','2021-01-05 22:00:26'),(6,'ReleaseNamespace+SampleApp+application+DEV',_binary '\0','apollo','2021-01-05 22:00:26','apollo','2021-01-05 22:00:26'),(7,'ModifyNamespace+SampleApp+dubbo',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(8,'ReleaseNamespace+SampleApp+dubbo',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(9,'ModifyNamespace+SampleApp+dubbo+DEV',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(10,'ReleaseNamespace+SampleApp+dubbo+DEV',_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20');
+/*!40000 ALTER TABLE `Role` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table rolepermission
-# ------------------------------------------------------------
+--
+-- Table structure for table `RolePermission`
+--
DROP TABLE IF EXISTS `RolePermission`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `RolePermission` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
@@ -229,15 +365,26 @@
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_RoleId` (`RoleId`),
KEY `IX_PermissionId` (`PermissionId`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表';
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `RolePermission`
+--
+LOCK TABLES `RolePermission` WRITE;
+/*!40000 ALTER TABLE `RolePermission` DISABLE KEYS */;
+INSERT INTO `RolePermission` VALUES (1,1,1,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(2,1,2,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(3,1,3,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(4,2,4,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(5,3,5,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(6,4,6,_binary '\0','apollo','2021-01-05 21:54:27','apollo','2021-01-05 21:54:27'),(7,5,7,_binary '\0','apollo','2021-01-05 22:00:26','apollo','2021-01-05 22:00:26'),(8,6,8,_binary '\0','apollo','2021-01-05 22:00:26','apollo','2021-01-05 22:00:26'),(9,7,9,_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(10,8,10,_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(11,9,11,_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(12,10,12,_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20');
+/*!40000 ALTER TABLE `RolePermission` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table serverconfig
-# ------------------------------------------------------------
+--
+-- Table structure for table `ServerConfig`
+--
DROP TABLE IF EXISTS `ServerConfig`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ServerConfig` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
@@ -251,15 +398,26 @@
PRIMARY KEY (`Id`),
KEY `IX_Key` (`Key`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `ServerConfig`
+--
+LOCK TABLES `ServerConfig` WRITE;
+/*!40000 ALTER TABLE `ServerConfig` DISABLE KEYS */;
+INSERT INTO `ServerConfig` VALUES (1,'apollo.portal.envs','dev','可支持的环境列表',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(2,'organizations','[{\"orgId\":\"TEST1\",\"orgName\":\"样例部门1\"},{\"orgId\":\"TEST2\",\"orgName\":\"样例部门2\"}]','部门列表',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(3,'superAdmin','apollo','Portal超级管理员',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(4,'api.readTimeout','10000','http接口read timeout',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(5,'consumer.token.salt','someSalt','consumer token salt',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(6,'admin.createPrivateNamespace.switch','true','是否允许项目管理员创建私有namespace',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43'),(7,'configView.memberOnly.envs','dev','只对项目成员显示配置信息的环境列表,多个env以英文逗号分隔',_binary '\0','default','2021-01-06 11:52:43','','2021-01-06 11:52:43');
+/*!40000 ALTER TABLE `ServerConfig` ENABLE KEYS */;
+UNLOCK TABLES;
-# Dump of table userrole
-# ------------------------------------------------------------
+--
+-- Table structure for table `UserRole`
+--
DROP TABLE IF EXISTS `UserRole`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `UserRole` (
`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`UserId` varchar(128) DEFAULT '' COMMENT '用户身份标识',
@@ -273,13 +431,26 @@
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_RoleId` (`RoleId`),
KEY `IX_UserId_RoleId` (`UserId`,`RoleId`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表';
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表';
+/*!40101 SET character_set_client = @saved_cs_client */;
-# Dump of table Users
-# ------------------------------------------------------------
+--
+-- Dumping data for table `UserRole`
+--
+
+LOCK TABLES `UserRole` WRITE;
+/*!40000 ALTER TABLE `UserRole` DISABLE KEYS */;
+INSERT INTO `UserRole` VALUES (1,'apollo',1,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(2,'apollo',2,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(3,'apollo',3,_binary '\0','','2021-01-06 11:52:44','','2021-01-06 11:52:44'),(4,'apollo',7,_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20'),(5,'apollo',8,_binary '\0','apollo','2021-01-05 22:07:20','apollo','2021-01-05 22:07:20');
+/*!40000 ALTER TABLE `UserRole` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Users`
+--
DROP TABLE IF EXISTS `Users`;
-
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Users` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
`Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户名',
@@ -287,81 +458,26 @@
`Email` varchar(64) NOT NULL DEFAULT 'default' COMMENT '邮箱地址',
`Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效',
PRIMARY KEY (`Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+--
+-- Dumping data for table `Users`
+--
-# Dump of table Authorities
-# ------------------------------------------------------------
+LOCK TABLES `Users` WRITE;
+/*!40000 ALTER TABLE `Users` DISABLE KEYS */;
+INSERT INTO `Users` VALUES (1,'apollo','$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS','apollo@acme.com',1);
+/*!40000 ALTER TABLE `Users` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-DROP TABLE IF EXISTS `Authorities`;
-
-CREATE TABLE `Authorities` (
- `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
- `Username` varchar(64) NOT NULL,
- `Authority` varchar(50) NOT NULL,
- PRIMARY KEY (`Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-
-
-# Config
-# ------------------------------------------------------------
-INSERT INTO `ServerConfig` (`Key`, `Value`, `Comment`)
-VALUES
- ('apollo.portal.envs', 'dev', '可支持的环境列表'),
- ('organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\"样例部门1\"},{\"orgId\":\"TEST2\",\"orgName\":\"样例部门2\"}]', '部门列表'),
- ('superAdmin', 'apollo', 'Portal超级管理员'),
- ('api.readTimeout', '10000', 'http接口read timeout'),
- ('consumer.token.salt', 'someSalt', 'consumer token salt'),
- ('admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有namespace'),
- ('configView.memberOnly.envs', 'dev', '只对项目成员显示配置信息的环境列表,多个env以英文逗号分隔');
-
-INSERT INTO `Users` (`Username`, `Password`, `Email`, `Enabled`)
-VALUES
- ('apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo@acme.com', 1);
-
-INSERT INTO `Authorities` (`Username`, `Authority`) VALUES ('apollo', 'ROLE_user');
-
-# Sample Data
-# ------------------------------------------------------------
-INSERT INTO `App` (`AppId`, `Name`, `OrgId`, `OrgName`, `OwnerName`, `OwnerEmail`)
-VALUES
- ('SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com');
-
-INSERT INTO `AppNamespace` (`Name`, `AppId`, `Format`, `IsPublic`, `Comment`)
-VALUES
- ('application', 'SampleApp', 'properties', 0, 'default app namespace');
-
-INSERT INTO `Permission` (`Id`, `PermissionType`, `TargetId`)
-VALUES
- (1, 'CreateCluster', 'SampleApp'),
- (2, 'CreateNamespace', 'SampleApp'),
- (3, 'AssignRole', 'SampleApp'),
- (4, 'ModifyNamespace', 'SampleApp+application'),
- (5, 'ReleaseNamespace', 'SampleApp+application');
-
-INSERT INTO `Role` (`Id`, `RoleName`)
-VALUES
- (1, 'Master+SampleApp'),
- (2, 'ModifyNamespace+SampleApp+application'),
- (3, 'ReleaseNamespace+SampleApp+application');
-
-INSERT INTO `RolePermission` (`RoleId`, `PermissionId`)
-VALUES
- (1, 1),
- (1, 2),
- (1, 3),
- (2, 4),
- (3, 5);
-
-INSERT INTO `UserRole` (`UserId`, `RoleId`)
-VALUES
- ('apollo', 1),
- ('apollo', 2),
- ('apollo', 3);
-
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2021-01-06 20:18:08
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-consumer.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-consumer.xml
index 92965eb..632d630 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-consumer.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-consumer.xml
@@ -27,7 +27,7 @@
<dubbo:application name="dubbo-configcenter-apollo-consumer"/>
- <dubbo:config-center highest-priority="false" protocol="apollo" address="${apollo.address:localhost}:8080"/>
+ <dubbo:config-center highest-priority="false" protocol="apollo" address="${apollo.address:localhost}:8080" />
<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.configcenter.api.DemoService"/>
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-provider.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-provider.xml
index de2b0ea..cd67d45 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-provider.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/main/resources/spring/configcenter-provider.xml
@@ -27,7 +27,7 @@
<dubbo:application name="dubbo-configcenter-apollo-provider"/>
- <dubbo:config-center address="apollo://${apollo.address:localhost}:8080"/>
+ <dubbo:config-center address="apollo://${apollo.address:localhost}:8080" />
<bean id="demoService" class="org.apache.dubbo.samples.configcenter.impl.DemoServiceImpl"/>
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/test/java/org/apache/dubbo/samples/configcenter/DemoServiceIT.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/test/java/org/apache/dubbo/samples/configcenter/DemoServiceIT.java
new file mode 100644
index 0000000..1b93f72
--- /dev/null
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-apollo/src/test/java/org/apache/dubbo/samples/configcenter/DemoServiceIT.java
@@ -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.
+ */
+
+package org.apache.dubbo.samples.configcenter;
+
+import org.apache.dubbo.samples.configcenter.api.DemoService;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = "classpath*:spring/configcenter-consumer.xml")
+public class DemoServiceIT {
+ @Autowired
+ @Qualifier("demoService")
+ private DemoService demoService;
+
+ @Test
+ public void test() throws Exception {
+ Assert.assertTrue(demoService.sayHello("world").startsWith("Hello world"));
+ }
+}
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-xml/pom.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-xml/pom.xml
index c1bd6d7..edd8ba5 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-xml/pom.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-xml/pom.xml
@@ -34,165 +34,68 @@
<dubbo.version>2.7.7</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
- <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
- <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
- <image.name>${project.artifactId}:${dubbo.version}</image.name>
- <java-image.name>openjdk:8</java-image.name>
- <dubbo.port>20880</dubbo.port>
- <zookeeper.port>2181</zookeeper.port>
- <main-class>org.apache.dubbo.samples.configcenter.BasicProvider</main-class>
</properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
- <version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
- <profile>
- <id>dubbo-integration-test</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-maven-address-plugin</artifactId>
- <version>1.0-SNAPSHOT</version>
- <executions>
- <execution>
- <goals>
- <goal>local-address</goal>
- </goals>
- <configuration>
- <localAddress>dubbo-local-address</localAddress>
- </configuration>
- <phase>initialize</phase>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>com.google.cloud.tools</groupId>
- <artifactId>jib-maven-plugin</artifactId>
- <version>${jib-maven-plugin.version}</version>
- <configuration>
- <from>
- <image>${java-image.name}</image>
- </from>
- <to>
- <image>${image.name}</image>
- </to>
- <container>
- <mainClass>${main-class}</mainClass>
- <ports>
- <port>${dubbo.port}</port>
- <port>${zookeeper.port}</port>
- </ports>
- <environment>
- <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
- </environment>
- <jvmFlags>
- <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
- </jvmFlags>
- </container>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>dockerBuild</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>${docker-maven-plugin.version}</version>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <run>
- <ports>
- <port>${dubbo.port}:${dubbo.port}</port>
- <port>${zookeeper.port}:${zookeeper.port}</port>
- </ports>
- <wait>
- <log>dubbo service started</log>
- </wait>
- </run>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>start</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>${maven-failsafe-plugin.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- <configuration>
- <systemPropertyVariables>
- <zookeeper.address>${dubbo-local-address}</zookeeper.address>
- </systemPropertyVariables>
- <includes>
- <include>**/*IT.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
<!-- For jdk 11 above JavaEE annotation -->
<profile>
<id>javax.annotation</id>