diff --git a/apollo-portal/src/main/docker/Dockerfile b/apollo-portal/src/main/docker/Dockerfile
index cb5abe562dbcbe2b6ce777d38da16a35c88a2e6b..b4451f63bbe24058b972a9ce4a43add7a9e0b410 100755
--- a/apollo-portal/src/main/docker/Dockerfile
+++ b/apollo-portal/src/main/docker/Dockerfile
@@ -25,6 +25,6 @@ RUN unzip /apollo-portal/apollo-portal-${VERSION}-github.zip -d /apollo-portal \
&& sed -i '$d' /apollo-portal/scripts/startup.sh \
&& echo "tail -f /dev/null" >> /apollo-portal/scripts/startup.sh
-EXPOSE 8080
+EXPOSE 8070
CMD ["/apollo-portal/scripts/startup.sh"]
diff --git a/scripts/apollo-on-kubernetes/README.md b/scripts/apollo-on-kubernetes/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..450557ce22a62592455282b986c91b8b5e2a0a5e
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/README.md
@@ -0,0 +1,156 @@
+# 使用方法
+
+## 一、构建镜像
+
+### 1.1 获取 apollo 压缩包
+从 https://github.com/ctripcorp/apollo/releases 下载预先打好的 java 包
+例如你下载的是:
+apollo-portal-1.0.0-github.zip
+apollo-adminservice-1.0.0-github.zip
+apollo-configservice-1.0.0-github.zip
+
+### 1.2 解压压缩包, 获取程序 jar 包
+- 解压 apollo-portal-1.0.0-github.zip
+获取 apollo-portal-1.0.0.jar, 重命名为 apollo-portal.jar, 放到 scripts/apollo-on-kubernetes/apollo-portal-server
+- 解压 apollo-adminservice-1.0.0-github.zip
+获取 apollo-adminservice-1.0.0.jar, 重命名为 apollo-adminservice.jar, 放到 scripts/apollo-on-kubernetes/apollo-admin-server
+- 解压 apollo-configservice-1.0.0-github.zip
+获取 apollo-configservice-1.0.0.jar, 重命名为 apollo-configservice.jar, 放到 scripts/apollo-on-kubernetes/apollo-config-server
+
+### 1.3 build image
+以 build apollo-config-server image 为例, 其他类似
+
+```bash
+scripts/apollo-on-kubernetes/apollo-config-server$ tree -L 2
+.
+├── apollo-configservice.conf
+├── apollo-configservice.jar
+├── config
+│ ├── application-github.properties
+│ └── app.properties
+├── Dockerfile
+├── entrypoint.sh
+└── scripts
+ └── startup-kubernetes.sh
+```
+
+build image
+
+```bash
+# 在 scripts/apollo-on-kubernetes/apollo-config-server 路径下
+docker build -t apollo-config-server:v1.0.0 .
+```
+
+push image
+将 image push 到你的 docker registry, 例如 vmware harbor
+
+## 二、Deploy apollo on kubernetes
+
+### 2.1 部署 MySQL 服务
+你可以选用 MySQL-Galera-WSrep 或 TiDB 来提高你的 MySQL 服务的可用性
+MySQL 部署步骤略
+
+### 2.1 导入 MySQL DB 文件
+由于上面部署了分布式的 MySQL, 所有 config-server、admin-server、portal-server 使用同一个 MySQL 服务的不同数据库
+
+示例假设你的 apollo 开启了 4 个环境, 即 dev、test-alpha、test-beta、prod, 在你的 MySQL 中导入 scripts/apollo-on-kubernetes/db 下的文件即可
+
+如果有需要, 你可以更改 eureka.service.url 的地址, 格式为 http://config-server-pod-name-index.meta-server-service-name:8080/eureka/ , 例如 http://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/
+
+### 2.2 Deploy apollo on kubernetes
+
+示例假设你有 4 台 kubernetes node 来部署 apollo, apollo 开启了 4 个环境, 即 dev、test-alpha、test-beta、prod
+
+按照 scripts/apollo-on-kubernetes/kubernetes/kubectl-apply.sh 文件的内容部署 apollo 即可
+
+```bash
+scripts/apollo-on-kubernetes/kubernetes$ cat kubectl-apply.sh
+# create namespace
+kubectl create namespace sre
+
+# dev-env
+kubectl apply -f service-mysql-for-apollo-dev-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-dev.yaml --record && \
+kubectl apply -f service-apollo-admin-server-dev.yaml --record
+
+# fat-env(test-alpha-env)
+kubectl apply -f service-mysql-for-apollo-test-alpha-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-test-alpha.yaml --record && \
+kubectl apply -f service-apollo-admin-server-test-alpha.yaml --record
+
+# uat-env(test-beta-env)
+kubectl apply -f service-mysql-for-apollo-test-beta-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-test-beta.yaml --record && \
+kubectl apply -f service-apollo-admin-server-test-beta.yaml --record
+
+# prod-env
+kubectl apply -f service-mysql-for-apollo-prod-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-prod.yaml --record && \
+kubectl apply -f service-apollo-admin-server-prod.yaml --record
+
+# portal
+kubectl apply -f service-apollo-portal-server.yaml --record
+```
+
+你需要注意的是, 应当尽量让同一个 server 的不同 pod 在不同 node 上, 这个通过 kubernetes nodeSelector 实现
+
+### 2.3 验证所有 pod 处于 Running 并且 READY 状态
+
+```bash
+kubectl get pod -n sre -o wide
+
+# 示例结果
+NAME READY STATUS RESTARTS AGE IP NODE
+deployment-apollo-admin-server-dev-b7bbd657-4d5jx 1/1 Running 0 2d 10.247.4.79 k8s-apollo-node-2
+deployment-apollo-admin-server-dev-b7bbd657-lwz5x 1/1 Running 0 2d 10.247.8.7 k8s-apollo-node-3
+deployment-apollo-admin-server-dev-b7bbd657-xs4wt 1/1 Running 0 2d 10.247.1.23 k8s-apollo-node-1
+deployment-apollo-admin-server-prod-699bbd894f-j977p 1/1 Running 0 2d 10.247.4.83 k8s-apollo-node-2
+deployment-apollo-admin-server-prod-699bbd894f-n9m54 1/1 Running 0 2d 10.247.8.11 k8s-apollo-node-3
+deployment-apollo-admin-server-prod-699bbd894f-vs56w 1/1 Running 0 2d 10.247.1.27 k8s-apollo-node-1
+deployment-apollo-admin-server-test-beta-7c855cd4f5-9br65 1/1 Running 0 2d 10.247.1.25 k8s-apollo-node-1
+deployment-apollo-admin-server-test-beta-7c855cd4f5-cck5g 1/1 Running 0 2d 10.247.8.9 k8s-apollo-node-3
+deployment-apollo-admin-server-test-beta-7c855cd4f5-x6gt4 1/1 Running 0 2d 10.247.4.81 k8s-apollo-node-2
+deployment-apollo-portal-server-6d4bbc879c-bv7cn 1/1 Running 0 2d 10.247.8.12 k8s-apollo-node-3
+deployment-apollo-portal-server-6d4bbc879c-c4zrb 1/1 Running 0 2d 10.247.1.28 k8s-apollo-node-1
+deployment-apollo-portal-server-6d4bbc879c-qm4mn 1/1 Running 0 2d 10.247.4.84 k8s-apollo-node-2
+statefulset-apollo-config-server-dev-0 1/1 Running 0 2d 10.247.8.6 k8s-apollo-node-3
+statefulset-apollo-config-server-dev-1 1/1 Running 0 2d 10.247.4.78 k8s-apollo-node-2
+statefulset-apollo-config-server-dev-2 1/1 Running 0 2d 10.247.1.22 k8s-apollo-node-1
+statefulset-apollo-config-server-prod-0 1/1 Running 0 2d 10.247.8.10 k8s-apollo-node-3
+statefulset-apollo-config-server-prod-1 1/1 Running 0 2d 10.247.4.82 k8s-apollo-node-2
+statefulset-apollo-config-server-prod-2 1/1 Running 0 2d 10.247.1.26 k8s-apollo-node-1
+statefulset-apollo-config-server-test-beta-0 1/1 Running 0 2d 10.247.8.8 k8s-apollo-node-3
+statefulset-apollo-config-server-test-beta-1 1/1 Running 0 2d 10.247.4.80 k8s-apollo-node-2
+statefulset-apollo-config-server-test-beta-2 1/1 Running 0 2d 10.247.1.24 k8s-apollo-node-1
+```
+
+### 2.4 访问 apollo service
+
+- server 端(即 portal)
+ kubernetes-master-ip:30001
+
+- client 端, 在 client 端无需再实现负载均衡
+Dev
+ kubernetes-master-ip:30002
+Test-Alpha
+ kubernetes-master-ip:30003
+Test-Beta
+ kubernetes-master-ip:30004
+Prod
+ kubernetes-master-ip:30005
+
+# FAQ
+
+- 关于修改的 Dockerfile
+添加 ENV 和 entrypoint.sh, 启动 server 需要的配置, 在 kubernetes yaml 文件中可以通过 configmap 传入、也可以通过 ENV 传入
+关于 Dockerfile、entrypoint.sh 具体内容, 你可以查看文件里的内容
+
+- 关于 kubernetes yaml 文件
+具体内容请查看 scripts/apollo-on-kubernetes/kubernetes/service-apollo-portal-server.yaml 注释
+其他类似
+
+- 关于 eureka.service.url
+请在 ApolloConfigDB.ServerConfig 表中配置, 使用 meta-server(即 config-server) 的 pod name, config-server 务必使用 statefulset
+以 apollo-env-dev 为例:
+('eureka.service.url', 'default', 'http://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-1.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-2.service-apollo-meta-server-dev:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔')
+你可以精简 config-server pod 的 name, 示例的长名字是为了更好的阅读与理解
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/alpine-bash-3.8-image/Dockerfile b/scripts/apollo-on-kubernetes/alpine-bash-3.8-image/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..b1dc00dcee7566e36487ecf19559502f10f16749
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/alpine-bash-3.8-image/Dockerfile
@@ -0,0 +1,14 @@
+# Build with:
+# docker build -t alpine-bash:3.8 .
+
+FROM alpine:3.8
+
+RUN \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories && \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
+ apk update upgrade && \
+ apk add --no-cache procps curl bash && \
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
+ echo "Asia/Shanghai" > /etc/timezone
+
+CMD ["bash"]
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/.dockerignore b/scripts/apollo-on-kubernetes/apollo-admin-server/.dockerignore
new file mode 100755
index 0000000000000000000000000000000000000000..799fbb3a7d8f3eb4c87319b63d09e1fca29e0090
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/.dockerignore
@@ -0,0 +1 @@
+./Dockerfile*
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/Dockerfile b/scripts/apollo-on-kubernetes/apollo-admin-server/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..37735c69d6f4380a1859dd7289b86f562cae0c7b
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/Dockerfile
@@ -0,0 +1,29 @@
+# Dockerfile for apollo-admin-server
+
+# Build with:
+# docker build -t apollo-admin-server:v1.0.0 .
+
+FROM openjdk:8-jre-alpine3.8
+
+RUN \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories && \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
+ apk update upgrade && \
+ apk add --no-cache procps curl bash tzdata && \
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
+ echo "Asia/Shanghai" > /etc/timezone && \
+ mkdir -p /apollo-admin-server
+
+ADD . /apollo-admin-server/
+
+ENV APOLLO_ADMIN_SERVICE_NAME="service-apollo-admin-server.sre"
+
+ENV DATASOURCES_URL="jdbc:mysql://service-mysql-for-apollo.sre:3306/ApolloConfigDB?characterEncoding=utf8"
+ENV DATASOURCES_USERNAME="FillInCorrectUser"
+ENV DATASOURCES_PASSWORD="FillInCorrectPassword"
+
+EXPOSE 8090
+
+ENTRYPOINT ["/apollo-admin-server/entrypoint.sh"]
+
+CMD ["/apollo-admin-server/scripts/startup-kubernetes.sh"]
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/apollo-adminservice.conf b/scripts/apollo-on-kubernetes/apollo-admin-server/apollo-adminservice.conf
new file mode 100755
index 0000000000000000000000000000000000000000..73bf6dcd42d0e800cddce21fabddabdc0181da12
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/apollo-adminservice.conf
@@ -0,0 +1,3 @@
+MODE=service
+PID_FOLDER=.
+LOG_FOLDER=/opt/logs/apollo-admin-server
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/config/app.properties b/scripts/apollo-on-kubernetes/apollo-admin-server/config/app.properties
new file mode 100755
index 0000000000000000000000000000000000000000..8600faeb09726843506ef67fe563afc5043a265c
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/config/app.properties
@@ -0,0 +1,2 @@
+appId=100003172
+jdkVersion=1.8
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/config/application-github.properties b/scripts/apollo-on-kubernetes/apollo-admin-server/config/application-github.properties
new file mode 100755
index 0000000000000000000000000000000000000000..16b36bdf18b15c3be11c52c3b04fb2e1b6060251
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/config/application-github.properties
@@ -0,0 +1,4 @@
+# DataSource
+spring.datasource.url = DATASOURCES_URL
+spring.datasource.username = DATASOURCES_USERNAME
+spring.datasource.password = DATASOURCES_PASSWORD
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/entrypoint.sh b/scripts/apollo-on-kubernetes/apollo-admin-server/entrypoint.sh
new file mode 100755
index 0000000000000000000000000000000000000000..41be229c96ef80f3f2f468ffaf4ed45d6249d435
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/entrypoint.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# admin-server config
+admin_server_config=/apollo-admin-server/config/application-github.properties
+cp ${admin_server_config} ${admin_server_config}.cp
+
+sed -i -E "s#DATASOURCES_URL#${DATASOURCES_URL}#g" ${admin_server_config}.cp
+sed -i -E "s#DATASOURCES_USERNAME#${DATASOURCES_USERNAME}#g" ${admin_server_config}.cp
+sed -i -E "s#DATASOURCES_PASSWORD#${DATASOURCES_PASSWORD}#g" ${admin_server_config}.cp
+
+cat ${admin_server_config}.cp > ${admin_server_config}
+rm -rf ${admin_server_config}.cp
+
+exec "$@"
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh b/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh
new file mode 100755
index 0000000000000000000000000000000000000000..197e5a6be53e7b8f3679f8582d4848fae1f198c0
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+SERVICE_NAME=apollo-adminservice
+## Adjust log dir if necessary
+LOG_DIR=/opt/logs/apollo-admin-server
+## Adjust server port if necessary
+SERVER_PORT=8090
+
+# SERVER_URL="http://localhost:${SERVER_PORT}"
+SERVER_URL="http://${APOLLO_ADMIN_SERVICE_NAME}:${SERVER_PORT}"
+
+## Adjust memory settings if necessary
+#export JAVA_OPTS="-Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=8"
+
+## Only uncomment the following when you are using server jvm
+#export JAVA_OPTS="$JAVA_OPTS -server -XX:-ReduceInitialCardMarks"
+
+########### The following is the same for configservice, adminservice, portal ###########
+export JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -Xloggc:$LOG_DIR/heap_trace.txt -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+
+printf "$(date) ==== Starting ==== \n"
+
+cd `dirname $0`/..
+chmod 755 $SERVICE_NAME".jar"
+./$SERVICE_NAME".jar" start
+
+rc=$?;
+
+if [[ $rc != 0 ]];
+then
+ echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
+ exit $rc;
+fi
+
+tail -f /dev/null
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/.dockerignore b/scripts/apollo-on-kubernetes/apollo-config-server/.dockerignore
new file mode 100755
index 0000000000000000000000000000000000000000..799fbb3a7d8f3eb4c87319b63d09e1fca29e0090
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/.dockerignore
@@ -0,0 +1 @@
+./Dockerfile*
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/Dockerfile b/scripts/apollo-on-kubernetes/apollo-config-server/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..3f2f2ee0456f5cd2b09972110fcfd5eecdb513ad
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/Dockerfile
@@ -0,0 +1,29 @@
+# Dockerfile for apollo-config-server
+
+# Build with:
+# docker build -t apollo-config-server:v1.0.0 .
+
+FROM openjdk:8-jre-alpine3.8
+
+RUN \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories && \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
+ apk update upgrade && \
+ apk add --no-cache procps curl bash tzdata && \
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
+ echo "Asia/Shanghai" > /etc/timezone && \
+ mkdir -p /apollo-config-server
+
+ADD . /apollo-config-server/
+
+ENV APOLLO_CONFIG_SERVICE_NAME="service-apollo-config-server.sre"
+
+ENV DATASOURCES_URL="jdbc:mysql://service-mysql-for-apollo.sre:3306/ApolloConfigDB?characterEncoding=utf8"
+ENV DATASOURCES_USERNAME="FillInCorrectUser"
+ENV DATASOURCES_PASSWORD="FillInCorrectPassword"
+
+EXPOSE 8080
+
+ENTRYPOINT ["/apollo-config-server/entrypoint.sh"]
+
+CMD ["/apollo-config-server/scripts/startup-kubernetes.sh"]
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/apollo-configservice.conf b/scripts/apollo-on-kubernetes/apollo-config-server/apollo-configservice.conf
new file mode 100755
index 0000000000000000000000000000000000000000..a01287c6d221ff4cd08a0ba80a8c0984b94c0583
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/apollo-configservice.conf
@@ -0,0 +1,3 @@
+MODE=service
+PID_FOLDER=.
+LOG_FOLDER=/opt/logs/apollo-config-server
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/config/app.properties b/scripts/apollo-on-kubernetes/apollo-config-server/config/app.properties
new file mode 100755
index 0000000000000000000000000000000000000000..e3def7c21e92c277292bf87f5b6ea459327f8f41
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/config/app.properties
@@ -0,0 +1,2 @@
+appId=100003171
+jdkVersion=1.8
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/config/application-github.properties b/scripts/apollo-on-kubernetes/apollo-config-server/config/application-github.properties
new file mode 100755
index 0000000000000000000000000000000000000000..16b36bdf18b15c3be11c52c3b04fb2e1b6060251
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/config/application-github.properties
@@ -0,0 +1,4 @@
+# DataSource
+spring.datasource.url = DATASOURCES_URL
+spring.datasource.username = DATASOURCES_USERNAME
+spring.datasource.password = DATASOURCES_PASSWORD
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/entrypoint.sh b/scripts/apollo-on-kubernetes/apollo-config-server/entrypoint.sh
new file mode 100755
index 0000000000000000000000000000000000000000..22cb0b9f067bfb8c00b17674ce2e96ece24642ba
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/entrypoint.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# config-server config
+config_server_config=/apollo-config-server/config/application-github.properties
+cp ${config_server_config} ${config_server_config}.cp
+
+sed -i -E "s#DATASOURCES_URL#${DATASOURCES_URL}#g" ${config_server_config}.cp
+sed -i -E "s#DATASOURCES_USERNAME#${DATASOURCES_USERNAME}#g" ${config_server_config}.cp
+sed -i -E "s#DATASOURCES_PASSWORD#${DATASOURCES_PASSWORD}#g" ${config_server_config}.cp
+
+cat ${config_server_config}.cp > ${config_server_config}
+rm -rf ${config_server_config}.cp
+
+exec "$@"
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh b/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh
new file mode 100755
index 0000000000000000000000000000000000000000..e44d82daec0f27d27641e06aab37e2abcc546820
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+SERVICE_NAME=apollo-configservice
+## Adjust log dir if necessary
+LOG_DIR=/opt/logs/apollo-config-server
+## Adjust server port if necessary
+SERVER_PORT=8080
+
+SERVER_URL="http://${APOLLO_CONFIG_SERVICE_NAME}:${SERVER_PORT}"
+
+## Adjust memory settings if necessary
+#export JAVA_OPTS="-Xms6144m -Xmx6144m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=4096m -XX:MaxNewSize=4096m -XX:SurvivorRatio=8"
+
+## Only uncomment the following when you are using server jvm
+#export JAVA_OPTS="$JAVA_OPTS -server -XX:-ReduceInitialCardMarks"
+
+########### The following is the same for configservice, adminservice, portal ###########
+export JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -Xloggc:$LOG_DIR/heap_trace.txt -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+
+printf "$(date) ==== Starting ==== \n"
+
+cd `dirname $0`/..
+chmod 755 $SERVICE_NAME".jar"
+./$SERVICE_NAME".jar" start
+
+rc=$?;
+
+if [[ $rc != 0 ]];
+then
+ echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
+ exit $rc;
+fi
+
+tail -f /dev/null
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/.dockerignore b/scripts/apollo-on-kubernetes/apollo-portal-server/.dockerignore
new file mode 100755
index 0000000000000000000000000000000000000000..62539ffcba5709597d09aa331eee015de1b9a77f
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/.dockerignore
@@ -0,0 +1 @@
+./Dockerfile*
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/Dockerfile b/scripts/apollo-on-kubernetes/apollo-portal-server/Dockerfile
new file mode 100755
index 0000000000000000000000000000000000000000..cfb87395dce6319b8143ca06379dc2ad6fe2bcb4
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/Dockerfile
@@ -0,0 +1,34 @@
+# Dockerfile for apollo-portal-server
+
+# Build with:
+# docker build -t apollo-portal-server:v1.0.0 .
+
+FROM openjdk:8-jre-alpine3.8
+
+RUN \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories && \
+ echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
+ apk update upgrade && \
+ apk add --no-cache procps curl bash tzdata && \
+ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
+ echo "Asia/Shanghai" > /etc/timezone && \
+ mkdir -p /apollo-portal-server
+
+ADD . /apollo-portal-server/
+
+ENV APOLLO_PORTAL_SERVICE_NAME="service-apollo-portal-server.sre"
+
+ENV DATASOURCES_URL="jdbc:mysql://service-mysql-for-apollo.sre:3306/ApolloPortalDB?characterEncoding=utf8"
+ENV DATASOURCES_USERNAME="FillInCorrectUser"
+ENV DATASOURCES_PASSWORD="FillInCorrectPassword"
+
+ENV DEV_META_SERVICE_NAME="service-apollo-config-server-dev.sre"
+ENV TEST_ALPHA_META_SERVICE_NAME="service-apollo-config-server-test-alpha.sre"
+ENV TEST_BETA_META_SERVICE_NAME="service-apollo-config-server-test-beta.sre"
+ENV PROD_META_SERVICE_NAME="service-apollo-config-server-prod.sre"
+
+EXPOSE 8070
+
+ENTRYPOINT ["/apollo-portal-server/entrypoint.sh"]
+
+CMD ["/apollo-portal-server/scripts/startup-kubernetes.sh"]
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/apollo-portal.conf b/scripts/apollo-on-kubernetes/apollo-portal-server/apollo-portal.conf
new file mode 100755
index 0000000000000000000000000000000000000000..ee09842a64d4bc7f7238b9d41f2d898a17d48d21
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/apollo-portal.conf
@@ -0,0 +1,3 @@
+MODE=service
+PID_FOLDER=.
+LOG_FOLDER=/opt/logs/apollo-portal-server
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/config/apollo-env.properties b/scripts/apollo-on-kubernetes/apollo-portal-server/config/apollo-env.properties
new file mode 100755
index 0000000000000000000000000000000000000000..4b533069993bcf39da77882f073ec4045f2e195f
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/config/apollo-env.properties
@@ -0,0 +1,4 @@
+dev.meta=http://DEV_META_SERVICE_NAME:8080
+fat.meta=http://TEST_ALPHA_META_SERVICE_NAME:8080
+uat.meta=http://TEST_BETA_META_SERVICE_NAME:8080
+pro.meta=http://PROD_META_SERVICE_NAME:8080
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/config/app.properties b/scripts/apollo-on-kubernetes/apollo-portal-server/config/app.properties
new file mode 100755
index 0000000000000000000000000000000000000000..ba1a76d612304de0d4a0d290e0f60ae3c924ba0a
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/config/app.properties
@@ -0,0 +1,2 @@
+appId=100003173
+jdkVersion=1.8
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/config/application-github.properties b/scripts/apollo-on-kubernetes/apollo-portal-server/config/application-github.properties
new file mode 100755
index 0000000000000000000000000000000000000000..16b36bdf18b15c3be11c52c3b04fb2e1b6060251
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/config/application-github.properties
@@ -0,0 +1,4 @@
+# DataSource
+spring.datasource.url = DATASOURCES_URL
+spring.datasource.username = DATASOURCES_USERNAME
+spring.datasource.password = DATASOURCES_PASSWORD
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/entrypoint.sh b/scripts/apollo-on-kubernetes/apollo-portal-server/entrypoint.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8b2913eea85cf9c0172d768035cacfcb4212e00e
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/entrypoint.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+# portal-server config
+portal_server_config=/apollo-portal-server/config/application-github.properties
+cp ${portal_server_config} ${portal_server_config}.cp
+
+sed -i -E "s#DATASOURCES_URL#${DATASOURCES_URL}#g" ${portal_server_config}.cp
+sed -i -E "s#DATASOURCES_USERNAME#${DATASOURCES_USERNAME}#g" ${portal_server_config}.cp
+sed -i -E "s#DATASOURCES_PASSWORD#${DATASOURCES_PASSWORD}#g" ${portal_server_config}.cp
+
+cat ${portal_server_config}.cp > ${portal_server_config}
+rm -rf ${portal_server_config}.cp
+
+# meta-server config
+meta_server_config=/apollo-portal-server/config/apollo-env.properties
+cp ${meta_server_config} ${meta_server_config}.cp
+
+sed -i -E "s#DEV_META_SERVICE_NAME#${DEV_META_SERVICE_NAME}#g" ${meta_server_config}.cp
+sed -i -E "s#TEST_ALPHA_META_SERVICE_NAME#${TEST_ALPHA_META_SERVICE_NAME}#g" ${meta_server_config}.cp
+sed -i -E "s#TEST_BETA_META_SERVICE_NAME#${TEST_BETA_META_SERVICE_NAME}#g" ${meta_server_config}.cp
+sed -i -E "s#PROD_META_SERVICE_NAME#${PROD_META_SERVICE_NAME}#g" ${meta_server_config}.cp
+
+cat ${meta_server_config}.cp > ${meta_server_config}
+rm -rf ${meta_server_config}.cp
+
+exec "$@"
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh b/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f335bec69e6e3dfbfdce88172e738728ef03a77a
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+SERVICE_NAME=apollo-portal
+## Adjust log dir if necessary
+LOG_DIR=/opt/logs/apollo-portal-server
+## Adjust server port if necessary
+SERVER_PORT=8070
+
+# SERVER_URL="http://localhost:$SERVER_PORT"
+SERVER_URL="http://${APOLLO_PORTAL_SERVICE_NAME}:${SERVER_PORT}"
+
+## Adjust memory settings if necessary
+#export JAVA_OPTS="-Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=8"
+
+## Only uncomment the following when you are using server jvm
+#export JAVA_OPTS="$JAVA_OPTS -server -XX:-ReduceInitialCardMarks"
+
+########### The following is the same for configservice, adminservice, portal ###########
+export JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -Xloggc:$LOG_DIR/heap_trace.txt -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+
+printf "$(date) ==== Starting ==== \n"
+
+cd `dirname $0`/..
+chmod 755 $SERVICE_NAME".jar"
+./$SERVICE_NAME".jar" start
+
+rc=$?;
+
+if [[ $rc != 0 ]];
+then
+ echo "$(date) Failed to start $SERVICE_NAME.jar, return code: $rc"
+ exit $rc;
+fi
+
+tail -f /dev/null
diff --git a/scripts/apollo-on-kubernetes/db/config-db-dev/apolloconfigdb.sql b/scripts/apollo-on-kubernetes/db/config-db-dev/apolloconfigdb.sql
new file mode 100755
index 0000000000000000000000000000000000000000..10d43e45e822e30cd267d98495403a2500644dcc
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/db/config-db-dev/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 DevApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
+
+Use DevApolloConfigDB;
+
+# 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://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-1.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-2.service-apollo-meta-server-dev:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
+ ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
+ ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
+ ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
+ ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
+
+/*!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/apollo-on-kubernetes/db/config-db-prod/apolloconfigdb.sql b/scripts/apollo-on-kubernetes/db/config-db-prod/apolloconfigdb.sql
new file mode 100755
index 0000000000000000000000000000000000000000..40050da7baeb41f97b5dec3df4499cef19c2b327
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/db/config-db-prod/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 ProdApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
+
+Use ProdApolloConfigDB;
+
+# 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://statefulset-apollo-config-server-prod-0.service-apollo-meta-server-prod:8080/eureka/,http://statefulset-apollo-config-server-prod-1.service-apollo-meta-server-prod:8080/eureka/,http://statefulset-apollo-config-server-prod-2.service-apollo-meta-server-prod:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
+ ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
+ ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
+ ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
+ ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
+
+/*!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/apollo-on-kubernetes/db/config-db-test-alpha/apolloconfigdb.sql b/scripts/apollo-on-kubernetes/db/config-db-test-alpha/apolloconfigdb.sql
new file mode 100755
index 0000000000000000000000000000000000000000..63b8a6a58e9124e550b01770bf0d2b33f41f582e
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/db/config-db-test-alpha/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 TestAlphaApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
+
+Use TestAlphaApolloConfigDB;
+
+# 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://statefulset-apollo-config-server-test-alpha-0.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-1.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-2.service-apollo-meta-server-test-alpha:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
+ ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
+ ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
+ ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
+ ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
+
+/*!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/apollo-on-kubernetes/db/config-db-test-beta/apolloconfigdb.sql b/scripts/apollo-on-kubernetes/db/config-db-test-beta/apolloconfigdb.sql
new file mode 100755
index 0000000000000000000000000000000000000000..fc2091496d7d397b40378bcb4f4a6427c798dbdb
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/db/config-db-test-beta/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 TestBetaApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
+
+Use TestBetaApolloConfigDB;
+
+# 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://statefulset-apollo-config-server-test-beta-0.service-apollo-meta-server-test-beta:8080/eureka/,http://statefulset-apollo-config-server-test-beta-1.service-apollo-meta-server-test-beta:8080/eureka/,http://statefulset-apollo-config-server-test-beta-2.service-apollo-meta-server-test-beta:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'),
+ ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
+ ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
+ ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
+ ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
+
+/*!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/apollo-on-kubernetes/db/portal-db/apolloportaldb.sql b/scripts/apollo-on-kubernetes/db/portal-db/apolloportaldb.sql
new file mode 100755
index 0000000000000000000000000000000000000000..76a66f8aaaabb786337a56d3ecaf341e5e9ff636
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/db/portal-db/apolloportaldb.sql
@@ -0,0 +1,328 @@
+/*!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 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 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 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 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的绑定表';
+
+# Dump of table Users
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Users`;
+
+CREATE TABLE `Users` (
+ `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户名',
+ `Password` varchar(64) NOT NULL DEFAULT 'default' COMMENT '密码',
+ `Email` varchar(64) NOT NULL DEFAULT 'default' COMMENT '邮箱地址',
+ `Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效',
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
+
+
+# Dump of table Authorities
+# ------------------------------------------------------------
+
+DROP TABLE IF EXISTS `Authorities`;
+
+CREATE TABLE `Authorities` (
+ `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id',
+ `Username` varchar(50) 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, fat, uat, pro', '可支持的环境列表'),
+ ('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');
+
+INSERT INTO `Users` (`Username`, `Password`, `Email`, `Enabled`)
+VALUES
+ ('apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo@admin.com', 1);
+
+INSERT INTO `Authorities` (`Username`, `Authority`) VALUES ('apollo', 'ROLE_user');
+
+/*!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/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-admin-server-dev.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-admin-server-dev.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..9c3e88c9f9d17882f4d456e6f688f30854485b70
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-admin-server-dev.yaml
@@ -0,0 +1,104 @@
+
+---
+# configmap for apollo-admin-server-dev
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-admin-server-dev
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-dev-env.sre:3306/DevApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-admin-server-dev
+ labels:
+ app: service-apollo-admin-server-dev
+spec:
+ ports:
+ - protocol: TCP
+ port: 8090
+ targetPort: 8090
+ selector:
+ app: pod-apollo-admin-server-dev
+ type: ClusterIP
+ sessionAffinity: ClientIP
+
+---
+kind: Deployment
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: deployment-apollo-admin-server-dev
+ labels:
+ app: deployment-apollo-admin-server-dev
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-admin-server-dev
+ strategy:
+ rollingUpdate:
+ maxSurge: 1
+ maxUnavailable: 1
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-admin-server-dev
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-admin-server-dev
+ configMap:
+ name: configmap-apollo-admin-server-dev
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ initContainers:
+ - image: alpine-bash:3.8
+ name: check-service-apollo-config-server-dev
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-dev.sre:8080"]
+
+ containers:
+ - image: apollo-admin-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-admin-server-dev
+ ports:
+ - protocol: TCP
+ containerPort: 8090
+
+ volumeMounts:
+ - name: volume-configmap-apollo-admin-server-dev
+ mountPath: /apollo-admin-server/config/application-github.properties
+ subPath: application-github.properties
+
+ env:
+ - name: APOLLO_ADMIN_SERVICE_NAME
+ value: "service-apollo-admin-server-dev.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-config-server-dev.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-config-server-dev.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..468065fc008c742a0e6474c1db2e1d6cac12fb5a
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-config-server-dev.yaml
@@ -0,0 +1,117 @@
+
+---
+# configmap for apollo-config-server-dev
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-config-server-dev
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-dev-env.sre:3306/DevApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-meta-server-dev
+ labels:
+ app: service-apollo-meta-server-dev
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ selector:
+ app: pod-apollo-config-server-dev
+ type: ClusterIP
+ clusterIP: None
+ sessionAffinity: ClientIP
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-config-server-dev
+ labels:
+ app: service-apollo-config-server-dev
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ nodePort: 30002
+ selector:
+ app: pod-apollo-config-server-dev
+ type: NodePort
+ sessionAffinity: ClientIP
+
+---
+kind: StatefulSet
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: statefulset-apollo-config-server-dev
+ labels:
+ app: statefulset-apollo-config-server-dev
+spec:
+ serviceName: service-apollo-meta-server-dev
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-config-server-dev
+ updateStrategy:
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-config-server-dev
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-config-server-dev
+ configMap:
+ name: configmap-apollo-config-server-dev
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ containers:
+ - image: apollo-config-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-config-server-dev
+ ports:
+ - protocol: TCP
+ containerPort: 8080
+
+ volumeMounts:
+ - name: volume-configmap-apollo-config-server-dev
+ mountPath: /apollo-config-server/config/application-github.properties
+ subPath: application-github.properties
+
+ env:
+ - name: APOLLO_CONFIG_SERVICE_NAME
+ value: "service-apollo-config-server-dev.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-mysql-for-apollo-dev-env.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-mysql-for-apollo-dev-env.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..e2dd03e5b32df320385c10335dc5a4d9adc2b089
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-mysql-for-apollo-dev-env.yaml
@@ -0,0 +1,29 @@
+---
+# 为外部 mysql 服务设置 service
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-dev-env
+ labels:
+ app: service-mysql-for-apollo-dev-env
+spec:
+ ports:
+ - protocol: TCP
+ port: 3306
+ targetPort: 3306
+ type: ClusterIP
+ sessionAffinity: None
+
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-dev-env
+subsets:
+ - addresses:
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-apollo-admin-server-prod.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-apollo-admin-server-prod.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..8310e461756dcd8d79c67c3cb9ab3b8f0620f11f
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-apollo-admin-server-prod.yaml
@@ -0,0 +1,104 @@
+
+---
+# configmap for apollo-admin-server-prod
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-admin-server-prod
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-prod-env.sre:3306/ProdApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-admin-server-prod
+ labels:
+ app: service-apollo-admin-server-prod
+spec:
+ ports:
+ - protocol: TCP
+ port: 8090
+ targetPort: 8090
+ selector:
+ app: pod-apollo-admin-server-prod
+ type: ClusterIP
+ sessionAffinity: ClientIP
+
+---
+kind: Deployment
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: deployment-apollo-admin-server-prod
+ labels:
+ app: deployment-apollo-admin-server-prod
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-admin-server-prod
+ strategy:
+ rollingUpdate:
+ maxSurge: 1
+ maxUnavailable: 1
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-admin-server-prod
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-admin-server-prod
+ configMap:
+ name: configmap-apollo-admin-server-prod
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ initContainers:
+ - image: alpine-bash:3.8
+ name: check-service-apollo-config-server-prod
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 50 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-prod.sre:8080"]
+
+ containers:
+ - image: apollo-admin-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-admin-server-prod
+ ports:
+ - protocol: TCP
+ containerPort: 8090
+
+ volumeMounts:
+ - name: volume-configmap-apollo-admin-server-prod
+ mountPath: /apollo-admin-server/config/application-github.properties
+ subPath: application-github.properties
+
+ env:
+ - name: APOLLO_ADMIN_SERVICE_NAME
+ value: "service-apollo-admin-server-prod.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-apollo-config-server-prod.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-apollo-config-server-prod.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..de5920437faf6bf524ce41fc44334b1e0ce62afd
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-apollo-config-server-prod.yaml
@@ -0,0 +1,116 @@
+
+---
+# configmap for apollo-config-server-prod
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-config-server-prod
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-prod-env.sre:3306/ProdApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-meta-server-prod
+ labels:
+ app: service-apollo-meta-server-prod
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ selector:
+ app: pod-apollo-config-server-prod
+ type: ClusterIP
+ clusterIP: None
+ sessionAffinity: ClientIP
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-config-server-prod
+ labels:
+ app: service-apollo-config-server-prod
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ nodePort: 30005
+ selector:
+ app: pod-apollo-config-server-prod
+ type: NodePort
+ sessionAffinity: ClientIP
+
+---
+kind: StatefulSet
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: statefulset-apollo-config-server-prod
+ labels:
+ app: statefulset-apollo-config-server-prod
+spec:
+ serviceName: service-apollo-meta-server-prod
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-config-server-prod
+ updateStrategy:
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-config-server-prod
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-config-server-prod
+ configMap:
+ name: configmap-apollo-config-server-prod
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ containers:
+ - image: apollo-config-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-config-server-prod
+ ports:
+ - protocol: TCP
+ containerPort: 8080
+
+ volumeMounts:
+ - name: volume-configmap-apollo-config-server-prod
+ mountPath: /apollo-config-server/config/application-github.properties
+ subPath: application-github.properties
+ env:
+ - name: APOLLO_CONFIG_SERVICE_NAME
+ value: "service-apollo-config-server-prod.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-mysql-for-apollo-prod-env.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-mysql-for-apollo-prod-env.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..8b5b493d561b1b4a42b3ee4cecc15dc67d48fdc8
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-prod/service-mysql-for-apollo-prod-env.yaml
@@ -0,0 +1,28 @@
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-prod-env
+ labels:
+ app: service-mysql-for-apollo-prod-env
+spec:
+ ports:
+ - protocol: TCP
+ port: 3306
+ targetPort: 3306
+ type: ClusterIP
+ sessionAffinity: None
+
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-prod-env
+subsets:
+ - addresses:
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-apollo-admin-server-test-alpha.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-apollo-admin-server-test-alpha.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..52966e53a21d67bd4a2a48abe998268644a8478d
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-apollo-admin-server-test-alpha.yaml
@@ -0,0 +1,104 @@
+
+---
+# configmap for apollo-admin-server-test-alpha
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-admin-server-test-alpha
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-test-alpha-env.sre:3306/TestAlphaApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-admin-server-test-alpha
+ labels:
+ app: service-apollo-admin-server-test-alpha
+spec:
+ ports:
+ - protocol: TCP
+ port: 8090
+ targetPort: 8090
+ selector:
+ app: pod-apollo-admin-server-test-alpha
+ type: ClusterIP
+ sessionAffinity: ClientIP
+
+---
+kind: Deployment
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: deployment-apollo-admin-server-test-alpha
+ labels:
+ app: deployment-apollo-admin-server-test-alpha
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-admin-server-test-alpha
+ strategy:
+ rollingUpdate:
+ maxSurge: 1
+ maxUnavailable: 1
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-admin-server-test-alpha
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-admin-server-test-alpha
+ configMap:
+ name: configmap-apollo-admin-server-test-alpha
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ initContainers:
+ - image: alpine-bash:3.8
+ name: check-service-apollo-config-server-test-alpha
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-test-alpha.sre:8080"]
+
+ containers:
+ - image: apollo-admin-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-admin-server-test-alpha
+ ports:
+ - protocol: TCP
+ containerPort: 8090
+
+ volumeMounts:
+ - name: volume-configmap-apollo-admin-server-test-alpha
+ mountPath: /apollo-admin-server/config/application-github.properties
+ subPath: application-github.properties
+
+ env:
+ - name: APOLLO_ADMIN_SERVICE_NAME
+ value: "service-apollo-admin-server-test-alpha.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-apollo-config-server-test-alpha.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-apollo-config-server-test-alpha.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..b9cb94f97e2cbd71451381756caef8a4c26340f6
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-apollo-config-server-test-alpha.yaml
@@ -0,0 +1,116 @@
+
+---
+# configmap for apollo-config-server-test-alpha
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-config-server-test-alpha
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-test-alpha-env.sre:3306/TestAlphaApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-meta-server-test-alpha
+ labels:
+ app: service-apollo-meta-server-test-alpha
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ selector:
+ app: pod-apollo-config-server-test-alpha
+ type: ClusterIP
+ clusterIP: None
+ sessionAffinity: ClientIP
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-config-server-test-alpha
+ labels:
+ app: service-apollo-config-server-test-alpha
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ nodePort: 30003
+ selector:
+ app: pod-apollo-config-server-test-alpha
+ type: NodePort
+ sessionAffinity: ClientIP
+
+---
+kind: StatefulSet
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: statefulset-apollo-config-server-test-alpha
+ labels:
+ app: statefulset-apollo-config-server-test-alpha
+spec:
+ serviceName: service-apollo-meta-server-test-alpha
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-config-server-test-alpha
+ updateStrategy:
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-config-server-test-alpha
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-config-server-test-alpha
+ configMap:
+ name: configmap-apollo-config-server-test-alpha
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ containers:
+ - image: apollo-config-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-config-server-test-alpha
+ ports:
+ - protocol: TCP
+ containerPort: 8080
+
+ volumeMounts:
+ - name: volume-configmap-apollo-config-server-test-alpha
+ mountPath: /apollo-config-server/config/application-github.properties
+ subPath: application-github.properties
+ env:
+ - name: APOLLO_CONFIG_SERVICE_NAME
+ value: "service-apollo-config-server-test-alpha.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-mysql-for-apollo-test-alpha-env.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-mysql-for-apollo-test-alpha-env.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..812eebefb4b11b09120083da34d41c511ee15ac8
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-alpha/service-mysql-for-apollo-test-alpha-env.yaml
@@ -0,0 +1,28 @@
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-test-alpha-env
+ labels:
+ app: service-mysql-for-apollo-test-alpha-env
+spec:
+ ports:
+ - protocol: TCP
+ port: 3306
+ targetPort: 3306
+ type: ClusterIP
+ sessionAffinity: None
+
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-test-alpha-env
+subsets:
+ - addresses:
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-apollo-admin-server-test-beta.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-apollo-admin-server-test-beta.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..998e4d62b3a8ae829a38d6e23b1e86b55aab13e2
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-apollo-admin-server-test-beta.yaml
@@ -0,0 +1,102 @@
+
+---
+# configmap for apollo-admin-server-test-beta
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-admin-server-test-beta
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-test-beta-env.sre:3306/TestBetaApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-admin-server-test-beta
+ labels:
+ app: service-apollo-admin-server-test-beta
+spec:
+ ports:
+ - protocol: TCP
+ port: 8090
+ targetPort: 8090
+ selector:
+ app: pod-apollo-admin-server-test-beta
+ type: ClusterIP
+ sessionAffinity: ClientIP
+
+---
+kind: Deployment
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: deployment-apollo-admin-server-test-beta
+ labels:
+ app: deployment-apollo-admin-server-test-beta
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-admin-server-test-beta
+ strategy:
+ rollingUpdate:
+ maxSurge: 1
+ maxUnavailable: 1
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-admin-server-test-beta
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-admin-server-test-beta
+ configMap:
+ name: configmap-apollo-admin-server-test-beta
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ initContainers:
+ - image: alpine-bash:3.8
+ name: check-service-apollo-config-server-test-beta
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-test-beta.sre:8080"]
+
+ containers:
+ - image: apollo-admin-server:v1.0.0
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-admin-server-test-beta
+ ports:
+ - protocol: TCP
+ containerPort: 8090
+
+ volumeMounts:
+ - name: volume-configmap-apollo-admin-server-test-beta
+ mountPath: /apollo-admin-server/config/application-github.properties
+ subPath: application-github.properties
+
+ env:
+ - name: APOLLO_ADMIN_SERVICE_NAME
+ value: "service-apollo-admin-server-test-beta.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8090
+ initialDelaySeconds: 120
+ periodSeconds: 10
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-apollo-config-server-test-beta.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-apollo-config-server-test-beta.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..ee7a2c9487ee2cd9e728326b6dc2bbf321da506f
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-apollo-config-server-test-beta.yaml
@@ -0,0 +1,116 @@
+
+---
+# configmap for apollo-config-server-test-beta
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-config-server-test-beta
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-test-beta-env.sre:3306/TestBetaApolloConfigDB?characterEncoding=utf8
+ spring.datasource.username = FillInCorrectUser
+ spring.datasource.password = FillInCorrectPassword
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-meta-server-test-beta
+ labels:
+ app: service-apollo-meta-server-test-beta
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ selector:
+ app: pod-apollo-config-server-test-beta
+ type: ClusterIP
+ clusterIP: None
+ sessionAffinity: ClientIP
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-config-server-test-beta
+ labels:
+ app: service-apollo-config-server-test-beta
+spec:
+ ports:
+ - protocol: TCP
+ port: 8080
+ targetPort: 8080
+ nodePort: 30004
+ selector:
+ app: pod-apollo-config-server-test-beta
+ type: NodePort
+ sessionAffinity: ClientIP
+
+---
+kind: StatefulSet
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: statefulset-apollo-config-server-test-beta
+ labels:
+ app: statefulset-apollo-config-server-test-beta
+spec:
+ serviceName: service-apollo-meta-server-test-beta
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-config-server-test-beta
+ updateStrategy:
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-config-server-test-beta
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-config-server-test-beta
+ configMap:
+ name: configmap-apollo-config-server-test-beta
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+
+ containers:
+ - image: apollo-config-server:v1.0.0
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-config-server-test-beta
+ ports:
+ - protocol: TCP
+ containerPort: 8080
+
+ volumeMounts:
+ - name: volume-configmap-apollo-config-server-test-beta
+ mountPath: /apollo-config-server/config/application-github.properties
+ subPath: application-github.properties
+ env:
+ - name: APOLLO_CONFIG_SERVICE_NAME
+ value: "service-apollo-config-server-test-beta.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8080
+ initialDelaySeconds: 120
+ periodSeconds: 15
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-mysql-for-apollo-test-beta-env.yaml b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-mysql-for-apollo-test-beta-env.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..66b559575dcd17cf052b609ebc061131a9a5db34
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/apollo-env-test-beta/service-mysql-for-apollo-test-beta-env.yaml
@@ -0,0 +1,28 @@
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-test-beta-env
+ labels:
+ app: service-mysql-for-apollo-test-beta-env
+spec:
+ ports:
+ - protocol: TCP
+ port: 3306
+ targetPort: 3306
+ type: ClusterIP
+ sessionAffinity: None
+
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-apollo-test-beta-env
+subsets:
+ - addresses:
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
\ No newline at end of file
diff --git a/scripts/apollo-on-kubernetes/kubernetes/kubectl-apply.sh b/scripts/apollo-on-kubernetes/kubernetes/kubectl-apply.sh
new file mode 100755
index 0000000000000000000000000000000000000000..38fcb4d09628e8444a1921da37c52a5d6530d58a
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/kubectl-apply.sh
@@ -0,0 +1,25 @@
+# create namespace
+kubectl create namespace sre
+
+# dev-env
+kubectl apply -f service-mysql-for-apollo-dev-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-dev.yaml --record && \
+kubectl apply -f service-apollo-admin-server-dev.yaml --record
+
+# fat-env(test-alpha-env)
+kubectl apply -f service-mysql-for-apollo-test-alpha-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-test-alpha.yaml --record && \
+kubectl apply -f service-apollo-admin-server-test-alpha.yaml --record
+
+# uat-env(test-beta-env)
+kubectl apply -f service-mysql-for-apollo-test-beta-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-test-beta.yaml --record && \
+kubectl apply -f service-apollo-admin-server-test-beta.yaml --record
+
+# prod-env
+kubectl apply -f service-mysql-for-apollo-prod-env.yaml --record && \
+kubectl apply -f service-apollo-config-server-prod.yaml --record && \
+kubectl apply -f service-apollo-admin-server-prod.yaml --record
+
+# portal
+kubectl apply -f service-apollo-portal-server.yaml --record
diff --git a/scripts/apollo-on-kubernetes/kubernetes/service-apollo-portal-server.yaml b/scripts/apollo-on-kubernetes/kubernetes/service-apollo-portal-server.yaml
new file mode 100755
index 0000000000000000000000000000000000000000..3eadc3905b8c3cb95ddb2a6eb04eab90f80db62d
--- /dev/null
+++ b/scripts/apollo-on-kubernetes/kubernetes/service-apollo-portal-server.yaml
@@ -0,0 +1,173 @@
+
+---
+# 为外部 mysql 服务设置 service
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-portal-server
+ labels:
+ app: service-mysql-for-portal-server
+spec:
+ ports:
+ - protocol: TCP
+ port: 3306
+ targetPort: 3306
+ type: ClusterIP
+ sessionAffinity: None
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-mysql-for-portal-server
+subsets:
+ - addresses:
+ # 更改为你的 mysql addresses, 例如 1.1.1.1
+ # 其中 1.1.1.1、2.2.2.2、3.3.3.3 为你的 mysql 集群, 例如 MySQL-Galera-WSrep 或 TiDB
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
+ - addresses:
+ # 更改为你的 mysql addresses, 例如 2.2.2.2
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
+ - addresses:
+ # 更改为你的 mysql addresses, 例如 3.3.3.3
+ - ip: your-mysql-addresses
+ ports:
+ - protocol: TCP
+ port: 3306
+
+---
+# configmap for apollo-portal-server
+kind: ConfigMap
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: configmap-apollo-portal-server
+data:
+ application-github.properties: |
+ spring.datasource.url = jdbc:mysql://service-mysql-for-portal-server.sre:3306/ApolloPortalDB?characterEncoding=utf8
+ # mysql username
+ spring.datasource.username = FillInCorrectUser
+ # mysql password
+ spring.datasource.password = FillInCorrectPassword
+ apollo-env.properties: |
+ dev.meta=http://service-apollo-config-server-dev.sre:8080
+ fat.meta=http://service-apollo-config-server-test-alpha.sre:8080
+ uat.meta=http://service-apollo-config-server-test-beta.sre:8080
+ pro.meta=http://service-apollo-config-server-prod.sre:8080
+
+---
+kind: Service
+apiVersion: v1
+metadata:
+ namespace: sre
+ name: service-apollo-portal-server
+ labels:
+ app: service-apollo-portal-server
+spec:
+ ports:
+ - protocol: TCP
+ port: 8070
+ targetPort: 8070
+ nodePort: 30001
+ selector:
+ app: pod-apollo-portal-server
+ type: NodePort
+ # portal session 保持
+ sessionAffinity: ClientIP
+
+---
+kind: Deployment
+apiVersion: apps/v1beta2
+metadata:
+ namespace: sre
+ name: deployment-apollo-portal-server
+ labels:
+ app: deployment-apollo-portal-server
+spec:
+ # 3 个实例
+ replicas: 3
+ selector:
+ matchLabels:
+ app: pod-apollo-portal-server
+ strategy:
+ rollingUpdate:
+ maxSurge: 1
+ maxUnavailable: 1
+ type: RollingUpdate
+ template:
+ metadata:
+ labels:
+ app: pod-apollo-portal-server
+ spec:
+ nodeSelector:
+ node: "apollo"
+
+ volumes:
+ - name: volume-configmap-apollo-portal-server
+ configMap:
+ name: configmap-apollo-portal-server
+ items:
+ - key: application-github.properties
+ path: application-github.properties
+ - key: apollo-env.properties
+ path: apollo-env.properties
+
+ initContainers:
+ # 确保 admin-service 正常提供服务
+ - image: alpine-bash:3.8
+ name: check-service-apollo-admin-server-dev
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-admin-server-dev.sre:8090"]
+ - image: alpine-bash:3.8
+ name: check-service-apollo-admin-server-dev
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-admin-server-test-alpha.sre:8090"]
+ - image: alpine-bash:3.8
+ name: check-service-apollo-admin-server-dev
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-admin-server-test-beta.sre:8090"]
+ - image: alpine-bash:3.8
+ name: check-service-apollo-admin-server-dev
+ command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-admin-server-prod.sre:8090"]
+
+ containers:
+ - image: apollo-portal-server:v1.0.0 # 更改为你的 docker registry 下的 image
+ securityContext:
+ privileged: true
+ imagePullPolicy: IfNotPresent
+ name: container-apollo-portal-server
+ ports:
+ - protocol: TCP
+ containerPort: 8070
+
+ volumeMounts:
+ - name: volume-configmap-apollo-portal-server
+ mountPath: /apollo-portal-server/config/application-github.properties
+ subPath: application-github.properties
+ - name: volume-configmap-apollo-portal-server
+ mountPath: /apollo-portal-server/config/apollo-env.properties
+ subPath: apollo-env.properties
+
+ env:
+ - name: APOLLO_PORTAL_SERVICE_NAME
+ value: "service-apollo-portal-server.sre"
+
+ readinessProbe:
+ tcpSocket:
+ port: 8070
+ initialDelaySeconds: 10
+ periodSeconds: 5
+
+ livenessProbe:
+ tcpSocket:
+ port: 8070
+ # 120s 内, server 未启动则重启 container
+ initialDelaySeconds: 120
+ periodSeconds: 15
+
+ dnsPolicy: ClusterFirst
+ restartPolicy: Always