diff --git a/apollo-adminservice/pom.xml b/apollo-adminservice/pom.xml
index 6a4971be7d047f4b9eb1bdd0831af3099d06d3bc..2eb0856b4670cfa59b76203ff62b672b00d20087 100644
--- a/apollo-adminservice/pom.xml
+++ b/apollo-adminservice/pom.xml
@@ -76,6 +76,22 @@
true
+
+ com.spotify
+ docker-maven-plugin
+ 0.4.13
+
+ ${project.artifactId}
+ src/main/docker
+
+
+ /
+ ${project.build.directory}
+ *.zip
+
+
+
+
maven-assembly-plugin
diff --git a/apollo-adminservice/src/main/docker/Dockerfile b/apollo-adminservice/src/main/docker/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..b1992d3b68c0e5be527a9f5075f84ccff0051286
--- /dev/null
+++ b/apollo-adminservice/src/main/docker/Dockerfile
@@ -0,0 +1,28 @@
+# Dockerfile for apollo-adminservice
+# Build with:
+# docker build -t apollo-adminservice .
+# Run with:
+# docker run -p 8090:8090 -d --name apollo-adminservice apollo-adminservice
+
+FROM openjdk:8-jre-alpine
+MAINTAINER ameizi
+
+ENV VERSION 0.8.0
+
+RUN echo "http://mirrors.aliyun.com/alpine/v3.6/main" > /etc/apk/repositories \
+ && echo "http://mirrors.aliyun.com/alpine/v3.6/community" >> /etc/apk/repositories \
+ && apk update upgrade \
+ && apk add --no-cache unzip curl bash tzdata \
+ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
+ && echo "Asia/Shanghai" > /etc/timezone
+
+ADD apollo-adminservice-${VERSION}-github.zip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip
+
+RUN unzip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip -d /apollo-adminservice \
+ && rm -rf /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip \
+ && sed -i '$d' /apollo-adminservice/scripts/startup.sh \
+ && echo "tail -f /dev/null" >> /apollo-adminservice/scripts/startup.sh
+
+EXPOSE 8090
+
+CMD ["/apollo-adminservice/scripts/startup.sh"]
\ No newline at end of file
diff --git a/apollo-configservice/pom.xml b/apollo-configservice/pom.xml
index 0323f1cef23f4400fc8be8efdc5d98dd4ac06ca7..46171cfc85cc5b9eb183af9efc0afc7248cc7c56 100644
--- a/apollo-configservice/pom.xml
+++ b/apollo-configservice/pom.xml
@@ -82,6 +82,22 @@
true
+
+ com.spotify
+ docker-maven-plugin
+ 0.4.13
+
+ ${project.artifactId}
+ src/main/docker
+
+
+ /
+ ${project.build.directory}
+ *.zip
+
+
+
+
maven-assembly-plugin
diff --git a/apollo-configservice/src/main/docker/Dockerfile b/apollo-configservice/src/main/docker/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..22a123ce8c988ebc88b41a58cfb84871b51a1d85
--- /dev/null
+++ b/apollo-configservice/src/main/docker/Dockerfile
@@ -0,0 +1,28 @@
+# Dockerfile for apollo-configservice
+# Build with:
+# docker build -t apollo-configservice .
+# Run with:
+# docker run -p 8080:8080 -d --name apollo-configservice apollo-configservice
+
+FROM openjdk:8-jre-alpine
+MAINTAINER ameizi
+
+ENV VERSION 0.8.0
+
+RUN echo "http://mirrors.aliyun.com/alpine/v3.6/main" > /etc/apk/repositories \
+ && echo "http://mirrors.aliyun.com/alpine/v3.6/community" >> /etc/apk/repositories \
+ && apk update upgrade \
+ && apk add --no-cache unzip curl bash tzdata \
+ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
+ && echo "Asia/Shanghai" > /etc/timezone
+
+ADD apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-configservice-${VERSION}-github.zip
+
+RUN unzip /apollo-configservice/apollo-configservice-${VERSION}-github.zip -d /apollo-configservice \
+ && rm -rf /apollo-configservice/apollo-configservice-${VERSION}-github.zip \
+ && sed -i '$d' /apollo-configservice/scripts/startup.sh \
+ && echo "tail -f /dev/null" >> /apollo-configservice/scripts/startup.sh
+
+EXPOSE 8080
+
+CMD ["/apollo-configservice/scripts/startup.sh"]
\ No newline at end of file
diff --git a/apollo-portal/pom.xml b/apollo-portal/pom.xml
index ff12add98760af18cc57aaa332d208d40763357c..0676e64ed8765668f6d192be4e41f0b4a31ebacc 100644
--- a/apollo-portal/pom.xml
+++ b/apollo-portal/pom.xml
@@ -33,6 +33,22 @@
true
+
+ com.spotify
+ docker-maven-plugin
+ 0.4.13
+
+ ${project.artifactId}
+ src/main/docker
+
+
+ /
+ ${project.build.directory}
+ *.zip
+
+
+
+
maven-assembly-plugin
diff --git a/apollo-portal/src/main/docker/Dockerfile b/apollo-portal/src/main/docker/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..171ebeb3d3d3bf44c63ec7aa6cc9e584d4fbe159
--- /dev/null
+++ b/apollo-portal/src/main/docker/Dockerfile
@@ -0,0 +1,28 @@
+# Dockerfile for apollo-portal
+# Build with:
+# docker build -t apollo-portal .
+# Run with:
+# docker run -p 9090:8080 -d --name apollo-portal apollo-portal
+
+FROM openjdk:8-jre-alpine
+MAINTAINER ameizi
+
+ENV VERSION 0.8.0
+
+RUN echo "http://mirrors.aliyun.com/alpine/v3.6/main" > /etc/apk/repositories \
+ && echo "http://mirrors.aliyun.com/alpine/v3.6/community" >> /etc/apk/repositories \
+ && apk update upgrade \
+ && apk add --no-cache unzip curl bash tzdata \
+ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
+ && echo "Asia/Shanghai" > /etc/timezone
+
+ADD apollo-portal-${VERSION}-github.zip /apollo-portal/apollo-portal-${VERSION}-github.zip
+
+RUN unzip /apollo-portal/apollo-portal-${VERSION}-github.zip -d /apollo-portal \
+ && rm -rf /apollo-portal/apollo-portal-${VERSION}-github.zip \
+ && sed -i '$d' /apollo-portal/scripts/startup.sh \
+ && echo "tail -f /dev/null" >> /apollo-portal/scripts/startup.sh
+
+EXPOSE 8080
+
+CMD ["/apollo-portal/scripts/startup.sh"]
\ No newline at end of file
diff --git a/apollo-spring-boot-sample/.gitignore b/apollo-spring-boot-sample/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..ba0b52997f6ac04f51dcab9683e420d6a8341632
--- /dev/null
+++ b/apollo-spring-boot-sample/.gitignore
@@ -0,0 +1,26 @@
+target/
+.mvn
+mvnw
+mvnw.cmd
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
\ No newline at end of file
diff --git a/apollo-spring-boot-sample/README.md b/apollo-spring-boot-sample/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..b6fbedf17653718f7f0899227913239102bef98f
--- /dev/null
+++ b/apollo-spring-boot-sample/README.md
@@ -0,0 +1,39 @@
+# apollo-spring-boot-sample
+Demo project for Spring Boot Apollo
+
+Spring Boot整合携程Apollo配置中心
+
+## 客户端maven配置
+
+* apollo-client(必须)
+
+```xml
+
+ com.ctrip.framework.apollo
+ apollo-client
+ 0.8.0
+
+```
+* spring-boot-starter-actuator 和 spring-cloud-context
+
+```xml
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.cloud
+ spring-cloud-context
+ 1.2.2.RELEASE
+
+```
+
+注意:
+
+1、`apollo-client`为必须配置
+
+2、`spring-boot-starter-actuator` 和 `spring-cloud-context`为可选配置。仅在使用`Spring Cloud`的`@RefreshScope`时所需
+
+# 参考文档
+
+https://github.com/ctripcorp/apollo/wiki/
\ No newline at end of file
diff --git a/apollo-spring-boot-sample/pom.xml b/apollo-spring-boot-sample/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..26ee13272c08db8cbd36f57b5273a74877f8ebce
--- /dev/null
+++ b/apollo-spring-boot-sample/pom.xml
@@ -0,0 +1,84 @@
+
+
+ 4.0.0
+
+ net.ameizi
+ apollo-spring-boot-sample
+ 1.0
+ jar
+
+ Apollo Spring Boot Sample
+ Demo project for Spring Boot Apollo
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.4.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.cloud
+ spring-cloud-context
+ 1.2.2.RELEASE
+
+
+ com.ctrip.framework.apollo
+ apollo-client
+ 0.8.0
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ com.spotify
+ docker-maven-plugin
+ 0.4.13
+
+ ${project.artifactId}
+ src/main/docker
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.jar
+
+
+
+
+
+
+
+
+
diff --git a/apollo-spring-boot-sample/src/main/docker/Dockerfile b/apollo-spring-boot-sample/src/main/docker/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..836ced128f59e388c46f04d49e5c3346210967fe
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/docker/Dockerfile
@@ -0,0 +1,16 @@
+FROM openjdk:8-jre-alpine
+MAINTAINER ameizi
+VOLUME /tmp
+RUN echo "http://mirrors.aliyun.com/alpine/v3.6/main" > /etc/apk/repositories \
+ && echo "http://mirrors.aliyun.com/alpine/v3.6/community" >> /etc/apk/repositories \
+ && apk update upgrade \
+ && apk add --no-cache tzdata \
+ && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
+ && echo "Asia/Shanghai" > /etc/timezone
+ADD *.jar app.jar
+RUN sh -c 'touch /app.jar' \
+ && mkdir -p /opt/settings \
+ && echo "env=DEV" > /opt/settings/server.properties
+ENV JAVA_OPTS=""
+EXPOSE 9090
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
\ No newline at end of file
diff --git a/apollo-spring-boot-sample/src/main/java/net/ameizi/ApolloConfigSample.java b/apollo-spring-boot-sample/src/main/java/net/ameizi/ApolloConfigSample.java
new file mode 100644
index 0000000000000000000000000000000000000000..278ed8cf80868778c8cffe7604d70a4ad03cefb4
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/java/net/ameizi/ApolloConfigSample.java
@@ -0,0 +1,24 @@
+package net.ameizi;
+
+import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @EnableApolloConfig要和@Configuration一起使用,不然不会生效。
+ */
+@Configuration
+@EnableApolloConfig
+public class ApolloConfigSample {
+
+ @Bean
+ public JavaConfigSample javaConfigSample(){
+ return new JavaConfigSample();
+ }
+
+ @Bean
+ public ConfigurationPropertiesSample configurationPropertiesSample() {
+ return new ConfigurationPropertiesSample();
+ }
+
+}
diff --git a/apollo-spring-boot-sample/src/main/java/net/ameizi/Application.java b/apollo-spring-boot-sample/src/main/java/net/ameizi/Application.java
new file mode 100644
index 0000000000000000000000000000000000000000..078464ce8b57bb8cb86e6b1ad9e4bef54fb7ca7f
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/java/net/ameizi/Application.java
@@ -0,0 +1,70 @@
+package net.ameizi;
+
+import com.ctrip.framework.apollo.Config;
+import com.ctrip.framework.apollo.ConfigService;
+import com.ctrip.framework.apollo.model.ConfigChange;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@SpringBootApplication
+@RestController
+public class Application {
+
+ @Autowired
+ private JavaConfigSample javaConfigSample;
+
+ @Autowired
+ private ConfigurationPropertiesSample configurationPropertiesSample;
+
+ private Config config = ConfigService.getAppConfig();
+
+ // 监听属性值变化
+ {
+ config.addChangeListener(changeEvent -> {
+ System.out.println("Changes for namespace " + changeEvent.getNamespace());
+ for (String key : changeEvent.changedKeys()) {
+ ConfigChange change = changeEvent.getChange(key);
+ System.out.println(String.format("Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType()));
+ }
+ });
+ }
+
+ /**
+ * 使用apollo client api获取配置文件,apollo管控台修改配置后,实时更新
+ * @return
+ */
+ @GetMapping("/clientapi")
+ public Sample apolloApiClient(){
+ int timeout = config.getIntProperty("sample.timeout",0);
+ int size = config.getIntProperty("sample.size",0);
+ return Sample.builder().timeout(timeout).size(size).build();
+ }
+
+ /**
+ * Java Config方式,JavaConfigSample内部使用了Config API,属性值的修改会立即生效
+ * @return
+ */
+ @GetMapping("/javaconfig")
+ public JavaConfigSample commonProperties(){
+ return javaConfigSample;
+ }
+
+ /**
+ * Spring Boot ConfigurationProperties方式,
+ * ConfigurationPropertiesSample内部没有使用Config API,但因为使用了@RefreshScope注解,执行/refresh端点时会刷新属性的值
+ * @return
+ */
+ @RefreshScope
+ @GetMapping("/configuration")
+ public ConfigurationPropertiesSample configurationPropertiesSample(){
+ return configurationPropertiesSample;
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/apollo-spring-boot-sample/src/main/java/net/ameizi/ConfigurationPropertiesSample.java b/apollo-spring-boot-sample/src/main/java/net/ameizi/ConfigurationPropertiesSample.java
new file mode 100644
index 0000000000000000000000000000000000000000..e5f84e75273ad7e471f411ba41ee1d5bfc3deeab
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/java/net/ameizi/ConfigurationPropertiesSample.java
@@ -0,0 +1,22 @@
+package net.ameizi;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * 使用Spring Boot ConfigurationProperties方式
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@ConfigurationProperties(prefix = "redis.cache")
+public class ConfigurationPropertiesSample {
+
+ private int expireSeconds;
+ private int commandTimeout;
+
+}
diff --git a/apollo-spring-boot-sample/src/main/java/net/ameizi/JavaConfigSample.java b/apollo-spring-boot-sample/src/main/java/net/ameizi/JavaConfigSample.java
new file mode 100644
index 0000000000000000000000000000000000000000..1ef55cd9795da9e8a9ef16f884cb34f9efa95825
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/java/net/ameizi/JavaConfigSample.java
@@ -0,0 +1,54 @@
+package net.ameizi;
+
+import com.ctrip.framework.apollo.Config;
+import com.ctrip.framework.apollo.model.ConfigChange;
+import com.ctrip.framework.apollo.model.ConfigChangeEvent;
+import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
+import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener;
+import org.springframework.beans.factory.annotation.Value;
+
+/**
+ * 使用Java Config方式
+ * 使用@ApolloConfig自动注入Config对象
+ * 使用@ApolloConfigChangeListener自动注入ConfigChangeListener对象
+ * 当监听到属性值发生变化后使用Config API修改属性值
+ */
+public class JavaConfigSample {
+
+ /**
+ * @ApolloConfig用来自动注入Config对象
+ */
+ @ApolloConfig
+ private Config config;
+
+ @Value("${timeout:100}")
+ private int timeout;
+ private int batch;
+
+ @Value("${batch:200}")
+ public void setBatch(int batch) {
+ this.batch = batch;
+ }
+
+ /**
+ * @ApolloConfigChangeListener用来自动注册ConfigChangeListener
+ */
+ @ApolloConfigChangeListener
+ private void someOnChange(ConfigChangeEvent changeEvent) {
+ changeEvent.changedKeys().forEach(key ->{
+ ConfigChange change = changeEvent.getChange(key);
+ System.out.println(String.format("Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType()));
+ });
+ if (changeEvent.isChanged("batch")) {
+ batch = config.getIntProperty("batch", 200);
+ }
+ }
+
+ public int getTimeout() {
+ return config.getIntProperty("timeout",100);
+ }
+
+ public int getBatch() {
+ return this.batch;
+ }
+}
diff --git a/apollo-spring-boot-sample/src/main/java/net/ameizi/Sample.java b/apollo-spring-boot-sample/src/main/java/net/ameizi/Sample.java
new file mode 100644
index 0000000000000000000000000000000000000000..c7074074443648dab256f523c39afb77b9fd5ba4
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/java/net/ameizi/Sample.java
@@ -0,0 +1,17 @@
+package net.ameizi;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@ConfigurationProperties(prefix = "sample")
+public class Sample {
+ private int timeout;
+ private int size;
+}
\ No newline at end of file
diff --git a/apollo-spring-boot-sample/src/main/resources/META-INF/app.properties b/apollo-spring-boot-sample/src/main/resources/META-INF/app.properties
new file mode 100644
index 0000000000000000000000000000000000000000..fde43be05526f041fc171673d7831032cb6d2fcb
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/resources/META-INF/app.properties
@@ -0,0 +1 @@
+app.id=apollo-spring-boot-sample
\ No newline at end of file
diff --git a/apollo-spring-boot-sample/src/main/resources/application.properties b/apollo-spring-boot-sample/src/main/resources/application.properties
new file mode 100644
index 0000000000000000000000000000000000000000..fe4af1c3d873a6449cf437f620865e2d2d336ee7
--- /dev/null
+++ b/apollo-spring-boot-sample/src/main/resources/application.properties
@@ -0,0 +1,2 @@
+server.port=9090
+management.security.enabled=false
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100755
index 0000000000000000000000000000000000000000..606ebfef81fb76139615cfc882764f43241462a2
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,65 @@
+version: '2'
+
+services:
+ apollo-configservice:
+ image: apollo-configservice
+ container_name: apollo-configservice
+ restart: always
+ depends_on:
+ - db
+ ports:
+ - "8080:8080"
+ volumes:
+ - /tmp/logs:/opt/logs
+ links:
+ - db
+
+ apollo-adminservice:
+ image: apollo-adminservice
+ container_name: apollo-adminservice
+ restart: always
+ depends_on:
+ - db
+ ports:
+ - "8090:8090"
+ volumes:
+ - /tmp/logs:/opt/logs
+ links:
+ - db
+
+ apollo-portal:
+ image: apollo-portal
+ container_name: apollo-portal
+ restart: always
+ depends_on:
+ - db
+ ports:
+ - "9090:8080"
+ volumes:
+ - /tmp/logs:/opt/logs
+ links:
+ - db
+
+ apollo-spring-boot-sample:
+ image: apollo-spring-boot-sample
+ container_name: apollo-spring-boot-sample
+ restart: always
+ depends_on:
+ - apollo-configservice
+ - apollo-adminservice
+ - apollo-portal
+ ports:
+ - "9190:9090"
+ volumes:
+ - /tmp:/tmp
+
+ db:
+ image: mariadb:latest
+ container_name: db
+ environment:
+ MYSQL_ROOT_PASSWORD: root
+ ports:
+ - "3306:3306"
+ volumes:
+ - /var/data/mysql:/var/lib/mysql
+ - ./scripts/sql-docker:/docker-entrypoint-initdb.d
\ No newline at end of file
diff --git a/docker.md b/docker.md
new file mode 100644
index 0000000000000000000000000000000000000000..6cf76b6fa4bd0fee9d159756526166e927e963ec
--- /dev/null
+++ b/docker.md
@@ -0,0 +1,41 @@
+# Apollo for Docker
+
+### 修改明细
+
+1、在apollo-configservice、apollo-adminservice、apollo-portal模块中分别添加了`src/main/docker/Dockerfile`以及在`pom.xml`中添加了`docker-maven-plugin`插件
+
+2、docker环境上的sql脚本`scripts/sql-docker`
+
+修改apolloconfigdb.sql数据库脚本中的`eureka.service.url`为`http://apollo-configservice:8080/eureka/`
+
+3、添加了`Docker`环境示例代码`apollo-spring-boot-sample`
+
+4、添加`docker-compose.yml`文件
+
+5、添加`run.sh`脚本
+
+### 如何使用
+
+克隆项目,在项目根目录下执行`./run.sh`,该过程涉及编译、打包、构建镜像会比较漫长
+
+数据库已经映射到宿主机的`3306`端口,用户名密码为`root/root`
+
+Apollo配置中心 http://localhost:9090
+
+Eureka注册中心 http://localhost:8080
+
+apollo-spring-boot-sample 示例应用演示与配置
+
+在Apollo配置中心中创建应用`apollo-spring-boot-sample`,其应用id与`/apollo-spring-boot-sample/src/main/resources/META-INF/app.properties`中的内容一致。配置中心中具体的键值对请参考源码。
+
+http://localhost:9190/clientapi
+
+使用Config API方式实时同步属性值
+
+http://localhost:9190/javaconfig
+
+使用Config API方式实时同步属性值,注入@ApolloConfig和@ApolloConfigChangeListener
+
+http://localhost:9190/configuration
+
+使用Spring Boot ConfigurationProperties方式,没有使用Config API,但使用了Spring Cloud的@RefreshScope注解,执行/refresh端点时会刷新属性的值。Apollo配置中心的值修改后,需要执行`curl -X POST http://localhost:9190/refresh`,才能使其生效。
diff --git a/pom.xml b/pom.xml
index a4c7e36a75e39aa52b348e9a55b01e5ca0c2e331..13a68fc3cc82e282e3d6fe8f8c669dbb82da62d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,6 +101,7 @@
apollo-portal
apollo-assembly
apollo-demo
+ apollo-spring-boot-sample
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000000000000000000000000000000000000..e40377db73688d323166a4ea24f3db34a2203320
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# apollo config db info
+apollo_config_db_url=jdbc:mysql://db:3306/ApolloConfigDB?characterEncoding=utf8
+apollo_config_db_username=root
+apollo_config_db_password=root
+
+# apollo portal db info
+apollo_portal_db_url=jdbc:mysql://db:3306/ApolloPortalDB?characterEncoding=utf8
+apollo_portal_db_username=root
+apollo_portal_db_password=root
+
+# meta server url
+dev_meta=http://apollo-configservice:8080
+fat_meta=http://apollo-configservice:8080
+uat_meta=http://apollo-configservice:8080
+pro_meta=http://apollo-configservice:8080
+
+META_SERVERS_OPTS="-Ddev_meta=$dev_meta -Dfat_meta=$fat_meta -Duat_meta=$uat_meta -Dpro_meta=$pro_meta"
+
+# =============== Please do not modify the following content =============== #
+
+# package config-service and admin-service
+echo "==== starting to build config-service and admin-service ===="
+
+mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=$apollo_config_db_url -Dspring_datasource_username=$apollo_config_db_username -Dspring_datasource_password=$apollo_config_db_password
+
+echo "==== building config-service and admin-service finished ===="
+
+echo "==== starting to build portal ===="
+
+mvn clean package -DskipTests -pl apollo-portal -am -Dapollo_profile=github -Dspring_datasource_url=$apollo_portal_db_url -Dspring_datasource_username=$apollo_portal_db_username -Dspring_datasource_password=$apollo_portal_db_password $META_SERVERS_OPTS
+
+echo "==== building portal finished ===="
+
+echo "==== starting to build client ===="
+
+mvn clean install -DskipTests -pl apollo-client -am $META_SERVERS_OPTS
+
+echo "==== building client finished ===="
+
+echo "==== starting to build apollo-spring-boot-sample ===="
+
+mvn clean package -DskipTests -pl apollo-spring-boot-sample
+
+echo "==== building apollo-spring-boot-sample finished ===="
+
+echo "==== starting to build docker images ===="
+
+cd apollo-configservice
+
+mvn docker:build
+
+cd ../apollo-adminservice
+
+mvn docker:build
+
+cd ../apollo-portal
+
+mvn docker:build
+
+cd ../apollo-spring-boot-sample
+
+mvn docker:build
+
+echo "==== building docker images finished ===="
+
+cd ..
+
+echo "==== starting to run docker images ===="
+
+docker-compose up
+
diff --git a/scripts/sql-docker/apolloconfigdb.sql b/scripts/sql-docker/apolloconfigdb.sql
new file mode 100644
index 0000000000000000000000000000000000000000..f7da053dd2769ffa85fa0d635fc1def88c002818
--- /dev/null
+++ b/scripts/sql-docker/apolloconfigdb.sql
@@ -0,0 +1,378 @@
+/*!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 */;
+/*!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;
+
+Use ApolloConfigDB;
+
+# Dump of table app
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `App`;
+
+CREATE TABLE `App` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
+ `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id',
+ `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
+ `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
+ `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `AppId` (`AppId`(191)),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_Name` (`Name`(191))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
+
+
+
+# Dump of table appnamespace
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `AppNamespace`;
+
+CREATE TABLE `AppNamespace` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一',
+ `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'app id',
+ `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型',
+ `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共',
+ `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_AppId` (`AppId`),
+ KEY `Name_AppId` (`Name`,`AppId`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
+
+
+
+# Dump of table audit
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Audit`;
+
+CREATE TABLE `Audit` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名',
+ `EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录ID',
+ `OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型',
+ `Comment` varchar(500) DEFAULT NULL COMMENT '备注',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `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='日志审计表';
+
+
+
+# Dump of table cluster
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Cluster`;
+
+CREATE TABLE `Cluster` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字',
+ `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'App id',
+ `ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父cluster',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_AppId_Name` (`AppId`,`Name`),
+ KEY `IX_ParentClusterId` (`ParentClusterId`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群';
+
+
+
+# Dump of table commit
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Commit`;
+
+CREATE TABLE `Commit` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `ChangeSets` longtext NOT NULL COMMENT '修改变更集',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
+ `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
+ `Comment` varchar(500) DEFAULT NULL COMMENT '备注',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `AppId` (`AppId`(191)),
+ KEY `ClusterName` (`ClusterName`(191)),
+ KEY `NamespaceName` (`NamespaceName`(191))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表';
+
+# Dump of table grayreleaserule
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `GrayReleaseRule`;
+
+CREATE TABLE `GrayReleaseRule` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
+ `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
+ `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name',
+ `Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则',
+ `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的release',
+ `BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0:删除分支,1:正在使用的规则 2:全量发布',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表';
+
+
+# Dump of table instance
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Instance`;
+
+CREATE TABLE `Instance` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
+ `DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name',
+ `Ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'instance ip',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`),
+ KEY `IX_IP` (`Ip`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例';
+
+
+
+# Dump of table instanceconfig
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `InstanceConfig`;
+
+CREATE TABLE `InstanceConfig` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id',
+ `ConfigAppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config App Id',
+ `ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name',
+ `ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name',
+ `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
+ `ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`),
+ KEY `IX_ReleaseKey` (`ReleaseKey`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息';
+
+
+
+# Dump of table item
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Item`;
+
+CREATE TABLE `Item` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
+ `Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
+ `Value` longtext NOT NULL COMMENT '配置项值',
+ `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
+ `LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_GroupId` (`NamespaceId`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目';
+
+
+
+# Dump of table namespace
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Namespace`;
+
+CREATE TABLE `Namespace` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
+ `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ 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='命名空间';
+
+
+
+# Dump of table namespacelock
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `NamespaceLock`;
+
+CREATE TABLE `NamespaceLock` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId',
+ `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT 'default' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除',
+ PRIMARY KEY (`Id`),
+ UNIQUE KEY `IX_NamespaceId` (`NamespaceId`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁';
+
+
+
+# Dump of table release
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Release`;
+
+CREATE TABLE `Release` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key',
+ `Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字',
+ `Comment` varchar(256) DEFAULT NULL COMMENT '发布说明',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
+ `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
+ `Configurations` longtext NOT NULL COMMENT '发布配置',
+ `IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ 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='发布';
+
+
+# Dump of table releasehistory
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ReleaseHistory`;
+
+CREATE TABLE `ReleaseHistory` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
+ `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
+ `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名',
+ `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的Release Id',
+ `PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的ReleaseId',
+ `Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度',
+ `OperationContext` longtext NOT NULL COMMENT '发布上下文信息',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`),
+ KEY `IX_ReleaseId` (`ReleaseId`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史';
+
+
+# Dump of table releasemessage
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ReleaseMessage`;
+
+CREATE TABLE `ReleaseMessage` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容',
+ `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_Message` (`Message`(191))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息';
+
+
+
+# Dump of table serverconfig
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ServerConfig`;
+
+CREATE TABLE `ServerConfig` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
+ `Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群',
+ `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
+ `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_Key` (`Key`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
+
+# Config
+# ------------------------------------------------------------
+INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
+VALUES
+ ('eureka.service.url', 'default', 'http://apollo-configservice:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
+ ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
+ ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
+ ('appnamespace.private.enable', 'default', 'false', '是否开启private namespace'),
+ ('item.key.length.limit', 'default', '128', 'item key 最大长度限制');
+
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;
diff --git a/scripts/sql-docker/apolloportaldb.sql b/scripts/sql-docker/apolloportaldb.sql
new file mode 100644
index 0000000000000000000000000000000000000000..1ec4a6b60967c6f3c22a3f0545d1aa359089be3b
--- /dev/null
+++ b/scripts/sql-docker/apolloportaldb.sql
@@ -0,0 +1,293 @@
+/*!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 */;
+/*!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;
+
+Use ApolloPortalDB;
+
+# Dump of table app
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `App`;
+
+CREATE TABLE `App` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
+ `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id',
+ `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
+ `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
+ `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
+ `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 ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `AppId` (`AppId`(191)),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_Name` (`Name`(191))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
+
+
+
+# Dump of table appnamespace
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `AppNamespace`;
+
+CREATE TABLE `AppNamespace` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
+ `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一',
+ `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'app id',
+ `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型',
+ `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共',
+ `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_AppId` (`AppId`),
+ KEY `Name_AppId` (`Name`,`AppId`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义';
+
+
+
+# Dump of table consumer
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Consumer`;
+
+CREATE TABLE `Consumer` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
+ `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id',
+ `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
+ `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
+ `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
+ `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 ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp 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='开放API消费者';
+
+
+
+# Dump of table consumeraudit
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ConsumerAudit`;
+
+CREATE TABLE `ConsumerAudit` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
+ `Uri` varchar(1024) NOT NULL DEFAULT '' COMMENT '访问的Uri',
+ `Method` varchar(16) NOT NULL DEFAULT '' COMMENT '访问的Method',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_ConsumerId` (`ConsumerId`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer审计表';
+
+
+
+# Dump of table consumerrole
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ConsumerRole`;
+
+CREATE TABLE `ConsumerRole` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
+ `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_RoleId` (`RoleId`),
+ KEY `IX_ConsumerId_RoleId` (`ConsumerId`,`RoleId`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer和role的绑定表';
+
+
+
+# Dump of table consumertoken
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ConsumerToken`;
+
+CREATE TABLE `ConsumerToken` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'ConsumerId',
+ `Token` varchar(128) NOT NULL DEFAULT '' COMMENT 'token',
+ `Expires` datetime NOT NULL DEFAULT '2099-01-01 00:00:00' COMMENT 'token失效时间',
+ `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 ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ UNIQUE KEY `IX_Token` (`Token`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer token表';
+
+# Dump of table favorite
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Favorite`;
+
+CREATE TABLE `Favorite` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
+ `UserId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '收藏的用户',
+ `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
+ `Position` int(32) NOT NULL DEFAULT '10000' COMMENT '收藏顺序',
+ `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 ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `AppId` (`AppId`(191)),
+ KEY `IX_UserId` (`UserId`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表';
+
+# Dump of table permission
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Permission`;
+
+CREATE TABLE `Permission` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `PermissionType` varchar(32) NOT NULL DEFAULT '' COMMENT '权限类型',
+ `TargetId` varchar(256) NOT NULL DEFAULT '' COMMENT '权限对象类型',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_TargetId_PermissionType` (`TargetId`(191),`PermissionType`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='permission表';
+
+
+
+# Dump of table role
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Role`;
+
+CREATE TABLE `Role` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `RoleName` varchar(256) NOT NULL DEFAULT '' COMMENT 'Role name',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_RoleName` (`RoleName`(191)),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
+
+
+
+# Dump of table rolepermission
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `RolePermission`;
+
+CREATE TABLE `RolePermission` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
+ `PermissionId` int(10) unsigned DEFAULT NULL COMMENT 'Permission Id',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_RoleId` (`RoleId`),
+ KEY `IX_PermissionId` (`PermissionId`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表';
+
+
+
+# Dump of table serverconfig
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `ServerConfig`;
+
+CREATE TABLE `ServerConfig` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key',
+ `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
+ `Comment` varchar(1024) DEFAULT '' COMMENT '注释',
+ `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) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_Key` (`Key`),
+ KEY `DataChange_LastTime` (`DataChange_LastTime`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
+
+
+
+# Dump of table userrole
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `UserRole`;
+
+CREATE TABLE `UserRole` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `UserId` varchar(128) DEFAULT '' COMMENT '用户身份标识',
+ `RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
+ `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
+ `DataChange_CreatedBy` varchar(32) DEFAULT '' COMMENT '创建人邮箱前缀',
+ `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀',
+ `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
+ PRIMARY KEY (`Id`),
+ KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
+ KEY `IX_RoleId` (`RoleId`),
+ KEY `IX_UserId_RoleId` (`UserId`,`RoleId`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和role的绑定表';
+
+# Config
+# ------------------------------------------------------------
+INSERT INTO `ServerConfig` (`Key`, `Value`, `Comment`)
+VALUES
+ ('apollo.portal.envs', 'dev', '可支持的环境列表'),
+ ('organizations', '[{\"orgId\":\"全辅导\",\"orgName\":\"全辅导\"},{\"orgId\":\"全课云\",\"orgName\":\"全课云\"}]', '部门列表'),
+ ('superAdmin', 'apollo', 'Portal超级管理员'),
+ ('api.readTimeout', '10000', 'http接口read timeout'),
+ ('consumer.token.salt', 'someSalt', 'consumer token salt');
+
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */;