Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
441e20bc
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
441e20bc
编写于
7月 13, 2017
作者:
冯
冯靖
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add Docker Support
上级
d010aa59
变更
23
展开全部
隐藏空白更改
内联
并排
Showing
23 changed file
with
1337 addition
and
0 deletion
+1337
-0
apollo-adminservice/pom.xml
apollo-adminservice/pom.xml
+16
-0
apollo-adminservice/src/main/docker/Dockerfile
apollo-adminservice/src/main/docker/Dockerfile
+28
-0
apollo-configservice/pom.xml
apollo-configservice/pom.xml
+16
-0
apollo-configservice/src/main/docker/Dockerfile
apollo-configservice/src/main/docker/Dockerfile
+28
-0
apollo-portal/pom.xml
apollo-portal/pom.xml
+16
-0
apollo-portal/src/main/docker/Dockerfile
apollo-portal/src/main/docker/Dockerfile
+28
-0
apollo-spring-boot-sample/.gitignore
apollo-spring-boot-sample/.gitignore
+26
-0
apollo-spring-boot-sample/README.md
apollo-spring-boot-sample/README.md
+39
-0
apollo-spring-boot-sample/pom.xml
apollo-spring-boot-sample/pom.xml
+84
-0
apollo-spring-boot-sample/src/main/docker/Dockerfile
apollo-spring-boot-sample/src/main/docker/Dockerfile
+16
-0
apollo-spring-boot-sample/src/main/java/net/ameizi/ApolloConfigSample.java
...t-sample/src/main/java/net/ameizi/ApolloConfigSample.java
+24
-0
apollo-spring-boot-sample/src/main/java/net/ameizi/Application.java
...ing-boot-sample/src/main/java/net/ameizi/Application.java
+70
-0
apollo-spring-boot-sample/src/main/java/net/ameizi/ConfigurationPropertiesSample.java
...c/main/java/net/ameizi/ConfigurationPropertiesSample.java
+22
-0
apollo-spring-boot-sample/src/main/java/net/ameizi/JavaConfigSample.java
...oot-sample/src/main/java/net/ameizi/JavaConfigSample.java
+54
-0
apollo-spring-boot-sample/src/main/java/net/ameizi/Sample.java
...o-spring-boot-sample/src/main/java/net/ameizi/Sample.java
+17
-0
apollo-spring-boot-sample/src/main/resources/META-INF/app.properties
...ng-boot-sample/src/main/resources/META-INF/app.properties
+1
-0
apollo-spring-boot-sample/src/main/resources/application.properties
...ing-boot-sample/src/main/resources/application.properties
+2
-0
docker-compose.yml
docker-compose.yml
+64
-0
docker.md
docker.md
+41
-0
pom.xml
pom.xml
+1
-0
run.sh
run.sh
+73
-0
scripts/sql-docker/apolloconfigdb.sql
scripts/sql-docker/apolloconfigdb.sql
+378
-0
scripts/sql-docker/apolloportaldb.sql
scripts/sql-docker/apolloportaldb.sql
+293
-0
未找到文件。
apollo-adminservice/pom.xml
浏览文件 @
441e20bc
...
...
@@ -76,6 +76,22 @@
<executable>
true
</executable>
</configuration>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
0.4.13
</version>
<configuration>
<imageName>
${project.artifactId}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
*.zip
</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
...
...
apollo-adminservice/src/main/docker/Dockerfile
0 → 100755
浏览文件 @
441e20bc
# Dockerfile for apollo-adminservice
# Build with:
# docker build -t apollo-adminservice .
# Run with:
# docker run -p 8090:8090 -d --name apollo-adminservice apollo-adminservice
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.8.0
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
&&
apk update upgrade
\
&&
apk add
--no-cache
unzip curl bash tzdata
\
&&
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
\
&&
echo
"Asia/Shanghai"
>
/etc/timezone
ADD
apollo-adminservice-${VERSION}-github.zip /apollo-adminservice/apollo-adminservice-${VERSION}-github.zip
RUN
unzip /apollo-adminservice/apollo-adminservice-
${
VERSION
}
-github
.zip
-d
/apollo-adminservice
\
&&
rm
-rf
/apollo-adminservice/apollo-adminservice-
${
VERSION
}
-github
.zip
\
&&
sed
-i
'$d'
/apollo-adminservice/scripts/startup.sh
\
&&
echo
"tail -f /dev/null"
>>
/apollo-adminservice/scripts/startup.sh
EXPOSE
8090
CMD
["/apollo-adminservice/scripts/startup.sh"]
\ No newline at end of file
apollo-configservice/pom.xml
浏览文件 @
441e20bc
...
...
@@ -82,6 +82,22 @@
<executable>
true
</executable>
</configuration>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
0.4.13
</version>
<configuration>
<imageName>
${project.artifactId}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
*.zip
</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
...
...
apollo-configservice/src/main/docker/Dockerfile
0 → 100755
浏览文件 @
441e20bc
# Dockerfile for apollo-configservice
# Build with:
# docker build -t apollo-configservice .
# Run with:
# docker run -p 8080:8080 -d --name apollo-configservice apollo-configservice
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.8.0
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
&&
apk update upgrade
\
&&
apk add
--no-cache
unzip curl bash tzdata
\
&&
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
\
&&
echo
"Asia/Shanghai"
>
/etc/timezone
ADD
apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-configservice-${VERSION}-github.zip
RUN
unzip /apollo-configservice/apollo-configservice-
${
VERSION
}
-github
.zip
-d
/apollo-configservice
\
&&
rm
-rf
/apollo-configservice/apollo-configservice-
${
VERSION
}
-github
.zip
\
&&
sed
-i
'$d'
/apollo-configservice/scripts/startup.sh
\
&&
echo
"tail -f /dev/null"
>>
/apollo-configservice/scripts/startup.sh
EXPOSE
8080
CMD
["/apollo-configservice/scripts/startup.sh"]
\ No newline at end of file
apollo-portal/pom.xml
浏览文件 @
441e20bc
...
...
@@ -33,6 +33,22 @@
<executable>
true
</executable>
</configuration>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
0.4.13
</version>
<configuration>
<imageName>
${project.artifactId}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
*.zip
</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
...
...
apollo-portal/src/main/docker/Dockerfile
0 → 100755
浏览文件 @
441e20bc
# Dockerfile for apollo-portal
# Build with:
# docker build -t apollo-portal .
# Run with:
# docker run -p 9090:8080 -d --name apollo-portal apollo-portal
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.8.0
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
&&
apk update upgrade
\
&&
apk add
--no-cache
unzip curl bash tzdata
\
&&
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
\
&&
echo
"Asia/Shanghai"
>
/etc/timezone
ADD
apollo-portal-${VERSION}-github.zip /apollo-portal/apollo-portal-${VERSION}-github.zip
RUN
unzip /apollo-portal/apollo-portal-
${
VERSION
}
-github
.zip
-d
/apollo-portal
\
&&
rm
-rf
/apollo-portal/apollo-portal-
${
VERSION
}
-github
.zip
\
&&
sed
-i
'$d'
/apollo-portal/scripts/startup.sh
\
&&
echo
"tail -f /dev/null"
>>
/apollo-portal/scripts/startup.sh
EXPOSE
8080
CMD
["/apollo-portal/scripts/startup.sh"]
\ No newline at end of file
apollo-spring-boot-sample/.gitignore
0 → 100644
浏览文件 @
441e20bc
target/
.mvn
mvnw
mvnw.cmd
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
\ No newline at end of file
apollo-spring-boot-sample/README.md
0 → 100644
浏览文件 @
441e20bc
# apollo-spring-boot-sample
Demo project for Spring Boot Apollo
Spring Boot整合携程Apollo配置中心
## 客户端maven配置
*
apollo-client(必须)
```
xml
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
0.8.0
</version>
</dependency>
```
*
spring-boot-starter-actuator 和 spring-cloud-context
```
xml
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-context
</artifactId>
<version>
1.2.2.RELEASE
</version>
</dependency>
```
注意:
1、
`apollo-client`
为必须配置
2、
`spring-boot-starter-actuator`
和
`spring-cloud-context`
为可选配置。仅在使用
`Spring Cloud`
的
`@RefreshScope`
时所需
# 参考文档
https://github.com/ctripcorp/apollo/wiki/
\ No newline at end of file
apollo-spring-boot-sample/pom.xml
0 → 100644
浏览文件 @
441e20bc
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
net.ameizi
</groupId>
<artifactId>
apollo-spring-boot-sample
</artifactId>
<version>
1.0
</version>
<packaging>
jar
</packaging>
<name>
Apollo Spring Boot Sample
</name>
<description>
Demo project for Spring Boot Apollo
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.4.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-context
</artifactId>
<version>
1.2.2.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
0.8.0
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
0.4.13
</version>
<configuration>
<imageName>
${project.artifactId}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
${project.build.finalName}.jar
</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</project>
apollo-spring-boot-sample/src/main/docker/Dockerfile
0 → 100644
浏览文件 @
441e20bc
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
VOLUME
/tmp
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
&&
apk update upgrade
\
&&
apk add
--no-cache
tzdata
\
&&
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
\
&&
echo
"Asia/Shanghai"
>
/etc/timezone
ADD
*.jar app.jar
RUN
sh
-c
'touch /app.jar'
\
&&
mkdir
-p
/opt/settings
\
&&
echo
"env=DEV"
>
/opt/settings/server.properties
ENV
JAVA_OPTS=""
EXPOSE
9090
ENTRYPOINT
[ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
\ No newline at end of file
apollo-spring-boot-sample/src/main/java/net/ameizi/ApolloConfigSample.java
0 → 100644
浏览文件 @
441e20bc
package
net.ameizi
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @EnableApolloConfig要和@Configuration一起使用,不然不会生效。
*/
@Configuration
@EnableApolloConfig
public
class
ApolloConfigSample
{
@Bean
public
JavaConfigSample
javaConfigSample
(){
return
new
JavaConfigSample
();
}
@Bean
public
ConfigurationPropertiesSample
configurationPropertiesSample
()
{
return
new
ConfigurationPropertiesSample
();
}
}
apollo-spring-boot-sample/src/main/java/net/ameizi/Application.java
0 → 100644
浏览文件 @
441e20bc
package
net.ameizi
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.ctrip.framework.apollo.model.ConfigChange
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@SpringBootApplication
@RestController
public
class
Application
{
@Autowired
private
JavaConfigSample
javaConfigSample
;
@Autowired
private
ConfigurationPropertiesSample
configurationPropertiesSample
;
private
Config
config
=
ConfigService
.
getAppConfig
();
// 监听属性值变化
{
config
.
addChangeListener
(
changeEvent
->
{
System
.
out
.
println
(
"Changes for namespace "
+
changeEvent
.
getNamespace
());
for
(
String
key
:
changeEvent
.
changedKeys
())
{
ConfigChange
change
=
changeEvent
.
getChange
(
key
);
System
.
out
.
println
(
String
.
format
(
"Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s"
,
change
.
getPropertyName
(),
change
.
getOldValue
(),
change
.
getNewValue
(),
change
.
getChangeType
()));
}
});
}
/**
* 使用apollo client api获取配置文件,apollo管控台修改配置后,实时更新
* @return
*/
@GetMapping
(
"/clientapi"
)
public
Sample
apolloApiClient
(){
int
timeout
=
config
.
getIntProperty
(
"sample.timeout"
,
0
);
int
size
=
config
.
getIntProperty
(
"sample.size"
,
0
);
return
Sample
.
builder
().
timeout
(
timeout
).
size
(
size
).
build
();
}
/**
* Java Config方式,JavaConfigSample内部使用了Config API,属性值的修改会立即生效
* @return
*/
@GetMapping
(
"/javaconfig"
)
public
JavaConfigSample
commonProperties
(){
return
javaConfigSample
;
}
/**
* Spring Boot ConfigurationProperties方式,
* ConfigurationPropertiesSample内部没有使用Config API,但因为使用了@RefreshScope注解,执行/refresh端点时会刷新属性的值
* @return
*/
@RefreshScope
@GetMapping
(
"/configuration"
)
public
ConfigurationPropertiesSample
configurationPropertiesSample
(){
return
configurationPropertiesSample
;
}
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
apollo-spring-boot-sample/src/main/java/net/ameizi/ConfigurationPropertiesSample.java
0 → 100644
浏览文件 @
441e20bc
package
net.ameizi
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
/**
* 使用Spring Boot ConfigurationProperties方式
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties
(
prefix
=
"redis.cache"
)
public
class
ConfigurationPropertiesSample
{
private
int
expireSeconds
;
private
int
commandTimeout
;
}
apollo-spring-boot-sample/src/main/java/net/ameizi/JavaConfigSample.java
0 → 100644
浏览文件 @
441e20bc
package
net.ameizi
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.model.ConfigChange
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener
;
import
org.springframework.beans.factory.annotation.Value
;
/**
* 使用Java Config方式
* 使用@ApolloConfig自动注入Config对象
* 使用@ApolloConfigChangeListener自动注入ConfigChangeListener对象
* 当监听到属性值发生变化后使用Config API修改属性值
*/
public
class
JavaConfigSample
{
/**
* @ApolloConfig用来自动注入Config对象
*/
@ApolloConfig
private
Config
config
;
@Value
(
"${timeout:100}"
)
private
int
timeout
;
private
int
batch
;
@Value
(
"${batch:200}"
)
public
void
setBatch
(
int
batch
)
{
this
.
batch
=
batch
;
}
/**
* @ApolloConfigChangeListener用来自动注册ConfigChangeListener
*/
@ApolloConfigChangeListener
private
void
someOnChange
(
ConfigChangeEvent
changeEvent
)
{
changeEvent
.
changedKeys
().
forEach
(
key
->{
ConfigChange
change
=
changeEvent
.
getChange
(
key
);
System
.
out
.
println
(
String
.
format
(
"Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s"
,
change
.
getPropertyName
(),
change
.
getOldValue
(),
change
.
getNewValue
(),
change
.
getChangeType
()));
});
if
(
changeEvent
.
isChanged
(
"batch"
))
{
batch
=
config
.
getIntProperty
(
"batch"
,
200
);
}
}
public
int
getTimeout
()
{
return
config
.
getIntProperty
(
"timeout"
,
100
);
}
public
int
getBatch
()
{
return
this
.
batch
;
}
}
apollo-spring-boot-sample/src/main/java/net/ameizi/Sample.java
0 → 100644
浏览文件 @
441e20bc
package
net.ameizi
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties
(
prefix
=
"sample"
)
public
class
Sample
{
private
int
timeout
;
private
int
size
;
}
\ No newline at end of file
apollo-spring-boot-sample/src/main/resources/META-INF/app.properties
0 → 100644
浏览文件 @
441e20bc
app.id
=
apollo-spring-boot-sample
\ No newline at end of file
apollo-spring-boot-sample/src/main/resources/application.properties
0 → 100644
浏览文件 @
441e20bc
server.port
=
9090
management.security.enabled
=
false
\ No newline at end of file
docker-compose.yml
0 → 100755
浏览文件 @
441e20bc
version
:
'
2'
services
:
apollo-configservice
:
image
:
apollo-configservice
container_name
:
apollo-configservice
restart
:
always
depends_on
:
-
db
ports
:
-
"
8080:8080"
volumes
:
-
/tmp/logs:/opt/logs
links
:
-
db
apollo-adminservice
:
image
:
apollo-adminservice
container_name
:
apollo-adminservice
restart
:
always
depends_on
:
-
db
ports
:
-
"
8090:8090"
volumes
:
-
/tmp/logs:/opt/logs
links
:
-
db
apollo-portal
:
image
:
apollo-portal
container_name
:
apollo-portal
restart
:
always
depends_on
:
-
db
ports
:
-
"
9090:8080"
volumes
:
-
/tmp/logs:/opt/logs
links
:
-
db
apollo-spring-boot-sample
:
image
:
apollo-spring-boot-sample
container_name
:
apollo-spring-boot-sample
restart
:
always
depends_on
:
-
apollo-configservice
-
apollo-adminservice
-
apollo-portal
ports
:
-
"
9190:9090"
volumes
:
-
/tmp:/tmp
db
:
image
:
mariadb:latest
container_name
:
db
environment
:
MYSQL_ROOT_PASSWORD
:
root
ports
:
-
"
3306:3306"
volumes
:
-
/var/data/mysql:/var/lib/mysql
\ No newline at end of file
docker.md
0 → 100644
浏览文件 @
441e20bc
# Apollo for Docker
# 修改明细
1、在apollo-configservice、apollo-adminservice、apollo-portal模块中分别添加了
`src/main/docker/Dockerfile`
以及在
`pom.xml`
中添加了
`docker-maven-plugin`
插件
2、docker环境上的sql脚本
`scripts/sql-docker`
修改apolloconfigdb.sql数据库脚本中的
`eureka.service.url`
为
`http://apollo-configservice:8080/eureka/`
3、添加了
`Docker`
环境示例代码
`apollo-spring-boot-sample`
4、添加
`docker-compose.yml`
文件
5、添加
`run.sh`
脚本
# 如何使用
```
bash
./run.sh
```
待数据库启动完毕,连接数据库,执行
`scripts/sql-docker`
目录下的数据库脚本。数据库已经映射到宿主机的
`3306`
端口,用户名密码为
`root/root`
http://localhost:9090 Apollo配置中心
http://localhost:8080 Eureka注册中心
访问 apollo-spring-boot-sample 示例应用
在配置中心中创建应用
`apollo-spring-boot-sample`
,其应用id与
`/apollo-spring-boot-sample/src/main/resources/META-INF/app.properties`
中的内容一致
localhost:9190/clientapi 使用Config API方式实时同步属性值
localhost:9190/javaconfig 使用Config API方式实时同步属性值,注入@ApolloConfig和@ApolloConfigChangeListener
localhost:9190/configuration 使用Spring Boot ConfigurationProperties方式,没有使用Config API,但使用了Spring Cloud的@RefreshScope注解,执行/refresh端点时会刷新属性的值。Apollo配置中心的值修改后,需要执行如下请求,才能使值生效
```
curl -X POST http://localhost:9190/refresh
```
\ No newline at end of file
pom.xml
浏览文件 @
441e20bc
...
...
@@ -101,6 +101,7 @@
<module>
apollo-portal
</module>
<module>
apollo-assembly
</module>
<module>
apollo-demo
</module>
<module>
apollo-spring-boot-sample
</module>
</modules>
<dependencyManagement>
...
...
run.sh
0 → 100755
浏览文件 @
441e20bc
#!/bin/sh
# apollo config db info
apollo_config_db_url
=
jdbc:mysql://db:3306/ApolloConfigDB?characterEncoding
=
utf8
apollo_config_db_username
=
root
apollo_config_db_password
=
root
# apollo portal db info
apollo_portal_db_url
=
jdbc:mysql://db:3306/ApolloPortalDB?characterEncoding
=
utf8
apollo_portal_db_username
=
root
apollo_portal_db_password
=
root
# meta server url
dev_meta
=
http://apollo-configservice:8080
fat_meta
=
http://apollo-configservice:8080
uat_meta
=
http://apollo-configservice:8080
pro_meta
=
http://apollo-configservice:8080
META_SERVERS_OPTS
=
"-Ddev_meta=
$dev_meta
-Dfat_meta=
$fat_meta
-Duat_meta=
$uat_meta
-Dpro_meta=
$pro_meta
"
# =============== Please do not modify the following content =============== #
# package config-service and admin-service
echo
"==== starting to build config-service and admin-service ===="
mvn clean package
-DskipTests
-pl
apollo-configservice,apollo-adminservice
-am
-Dapollo_profile
=
github
-Dspring_datasource_url
=
$apollo_config_db_url
-Dspring_datasource_username
=
$apollo_config_db_username
-Dspring_datasource_password
=
$apollo_config_db_password
echo
"==== building config-service and admin-service finished ===="
echo
"==== starting to build portal ===="
mvn clean package
-DskipTests
-pl
apollo-portal
-am
-Dapollo_profile
=
github
-Dspring_datasource_url
=
$apollo_portal_db_url
-Dspring_datasource_username
=
$apollo_portal_db_username
-Dspring_datasource_password
=
$apollo_portal_db_password
$META_SERVERS_OPTS
echo
"==== building portal finished ===="
echo
"==== starting to build client ===="
mvn clean
install
-DskipTests
-pl
apollo-client
-am
$META_SERVERS_OPTS
echo
"==== building client finished ===="
echo
"==== starting to build apollo-spring-boot-sample ===="
mvn clean package
-DskipTests
-pl
apollo-spring-boot-sample
echo
"==== building apollo-spring-boot-sample finished ===="
echo
"==== starting to build docker images ===="
cd
apollo-configservice
mvn docker:build
cd
../apollo-adminservice
mvn docker:build
cd
../apollo-portal
mvn docker:build
cd
../apollo-spring-boot-sample
mvn docker:build
echo
"==== building docker images finished ===="
cd
..
echo
"==== starting to run docker images ===="
docker-compose up
scripts/sql-docker/apolloconfigdb.sql
0 → 100644
浏览文件 @
441e20bc
此差异已折叠。
点击以展开。
scripts/sql-docker/apolloportaldb.sql
0 → 100644
浏览文件 @
441e20bc
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
;
/*!40101 SET NAMES utf8 */
;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */
;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */
;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */
;
#
Create
Database
#
------------------------------------------------------------
CREATE
DATABASE
IF
NOT
EXISTS
ApolloPortalDB
DEFAULT
CHARACTER
SET
=
utf8mb4
;
Use
ApolloPortalDB
;
#
Dump
of
table
app
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`App`
;
CREATE
TABLE
`App`
(
`Id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`AppId`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'AppID'
,
`Name`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'应用名'
,
`OrgId`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'部门Id'
,
`OrgName`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'部门名字'
,
`OwnerName`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerName'
,
`OwnerEmail`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerEmail'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`AppId`
(
`AppId`
(
191
)),
KEY
`DataChange_LastTime`
(
`DataChange_LastTime`
),
KEY
`IX_Name`
(
`Name`
(
191
))
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'应用表'
;
#
Dump
of
table
appnamespace
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`AppNamespace`
;
CREATE
TABLE
`AppNamespace`
(
`Id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增主键'
,
`Name`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'namespace名字,注意,需要全局唯一'
,
`AppId`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'app id'
,
`Format`
varchar
(
32
)
NOT
NULL
DEFAULT
'properties'
COMMENT
'namespace的format类型'
,
`IsPublic`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'namespace是否为公共'
,
`Comment`
varchar
(
64
)
NOT
NULL
DEFAULT
''
COMMENT
'注释'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_AppId`
(
`AppId`
),
KEY
`Name_AppId`
(
`Name`
,
`AppId`
),
KEY
`DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'应用namespace定义'
;
#
Dump
of
table
consumer
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`Consumer`
;
CREATE
TABLE
`Consumer`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`AppId`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'AppID'
,
`Name`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'应用名'
,
`OrgId`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'部门Id'
,
`OrgName`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'部门名字'
,
`OwnerName`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerName'
,
`OwnerEmail`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'ownerEmail'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`AppId`
(
`AppId`
(
191
)),
KEY
`DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'开放API消费者'
;
#
Dump
of
table
consumeraudit
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`ConsumerAudit`
;
CREATE
TABLE
`ConsumerAudit`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`ConsumerId`
int
(
11
)
unsigned
DEFAULT
NULL
COMMENT
'Consumer Id'
,
`Uri`
varchar
(
1024
)
NOT
NULL
DEFAULT
''
COMMENT
'访问的Uri'
,
`Method`
varchar
(
16
)
NOT
NULL
DEFAULT
''
COMMENT
'访问的Method'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_DataChange_LastTime`
(
`DataChange_LastTime`
),
KEY
`IX_ConsumerId`
(
`ConsumerId`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'consumer审计表'
;
#
Dump
of
table
consumerrole
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`ConsumerRole`
;
CREATE
TABLE
`ConsumerRole`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`ConsumerId`
int
(
11
)
unsigned
DEFAULT
NULL
COMMENT
'Consumer Id'
,
`RoleId`
int
(
10
)
unsigned
DEFAULT
NULL
COMMENT
'Role Id'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_DataChange_LastTime`
(
`DataChange_LastTime`
),
KEY
`IX_RoleId`
(
`RoleId`
),
KEY
`IX_ConsumerId_RoleId`
(
`ConsumerId`
,
`RoleId`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'consumer和role的绑定表'
;
#
Dump
of
table
consumertoken
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`ConsumerToken`
;
CREATE
TABLE
`ConsumerToken`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`ConsumerId`
int
(
11
)
unsigned
DEFAULT
NULL
COMMENT
'ConsumerId'
,
`Token`
varchar
(
128
)
NOT
NULL
DEFAULT
''
COMMENT
'token'
,
`Expires`
datetime
NOT
NULL
DEFAULT
'2099-01-01 00:00:00'
COMMENT
'token失效时间'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
UNIQUE
KEY
`IX_Token`
(
`Token`
),
KEY
`DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'consumer token表'
;
#
Dump
of
table
favorite
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`Favorite`
;
CREATE
TABLE
`Favorite`
(
`Id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`UserId`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'收藏的用户'
,
`AppId`
varchar
(
500
)
NOT
NULL
DEFAULT
'default'
COMMENT
'AppID'
,
`Position`
int
(
32
)
NOT
NULL
DEFAULT
'10000'
COMMENT
'收藏顺序'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`AppId`
(
`AppId`
(
191
)),
KEY
`IX_UserId`
(
`UserId`
),
KEY
`DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
23
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'应用收藏表'
;
#
Dump
of
table
permission
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`Permission`
;
CREATE
TABLE
`Permission`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`PermissionType`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'权限类型'
,
`TargetId`
varchar
(
256
)
NOT
NULL
DEFAULT
''
COMMENT
'权限对象类型'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
''
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_TargetId_PermissionType`
(
`TargetId`
(
191
),
`PermissionType`
),
KEY
`IX_DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'permission表'
;
#
Dump
of
table
role
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`Role`
;
CREATE
TABLE
`Role`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`RoleName`
varchar
(
256
)
NOT
NULL
DEFAULT
''
COMMENT
'Role name'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_RoleName`
(
`RoleName`
(
191
)),
KEY
`IX_DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'角色表'
;
#
Dump
of
table
rolepermission
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`RolePermission`
;
CREATE
TABLE
`RolePermission`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`RoleId`
int
(
10
)
unsigned
DEFAULT
NULL
COMMENT
'Role Id'
,
`PermissionId`
int
(
10
)
unsigned
DEFAULT
NULL
COMMENT
'Permission Id'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_DataChange_LastTime`
(
`DataChange_LastTime`
),
KEY
`IX_RoleId`
(
`RoleId`
),
KEY
`IX_PermissionId`
(
`PermissionId`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'角色和权限的绑定表'
;
#
Dump
of
table
serverconfig
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`ServerConfig`
;
CREATE
TABLE
`ServerConfig`
(
`Id`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`Key`
varchar
(
64
)
NOT
NULL
DEFAULT
'default'
COMMENT
'配置项Key'
,
`Value`
varchar
(
2048
)
NOT
NULL
DEFAULT
'default'
COMMENT
'配置项值'
,
`Comment`
varchar
(
1024
)
DEFAULT
''
COMMENT
'注释'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
NOT
NULL
DEFAULT
'default'
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_Key`
(
`Key`
),
KEY
`DataChange_LastTime`
(
`DataChange_LastTime`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'配置服务自身配置'
;
#
Dump
of
table
userrole
#
------------------------------------------------------------
DROP
TABLE
IF
EXISTS
`UserRole`
;
CREATE
TABLE
`UserRole`
(
`Id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增Id'
,
`UserId`
varchar
(
128
)
DEFAULT
''
COMMENT
'用户身份标识'
,
`RoleId`
int
(
10
)
unsigned
DEFAULT
NULL
COMMENT
'Role Id'
,
`IsDeleted`
bit
(
1
)
NOT
NULL
DEFAULT
b
'0'
COMMENT
'1: deleted, 0: normal'
,
`DataChange_CreatedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'创建人邮箱前缀'
,
`DataChange_CreatedTime`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
`DataChange_LastModifiedBy`
varchar
(
32
)
DEFAULT
''
COMMENT
'最后修改人邮箱前缀'
,
`DataChange_LastTime`
timestamp
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'最后修改时间'
,
PRIMARY
KEY
(
`Id`
),
KEY
`IX_DataChange_LastTime`
(
`DataChange_LastTime`
),
KEY
`IX_RoleId`
(
`RoleId`
),
KEY
`IX_UserId_RoleId`
(
`UserId`
,
`RoleId`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'用户和role的绑定表'
;
#
Config
#
------------------------------------------------------------
INSERT
INTO
`ServerConfig`
(
`Key`
,
`Value`
,
`Comment`
)
VALUES
(
'apollo.portal.envs'
,
'dev'
,
'可支持的环境列表'
),
(
'organizations'
,
'[{
\"
orgId
\"
:
\"
全辅导
\"
,
\"
orgName
\"
:
\"
全辅导
\"
},{
\"
orgId
\"
:
\"
全课云
\"
,
\"
orgName
\"
:
\"
全课云
\"
}]'
,
'部门列表'
),
(
'superAdmin'
,
'apollo'
,
'Portal超级管理员'
),
(
'api.readTimeout'
,
'10000'
,
'http接口read timeout'
),
(
'consumer.token.salt'
,
'someSalt'
,
'consumer token salt'
);
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */
;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */
;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录