Commit 2f3b9c16 by tangyi

增加基于docker部署的相关配置和文档

parent b5dccf06
......@@ -108,12 +108,11 @@
[在线考试系统部署文档](doc/在线考试系统V2.0_部署文档.md)
基于docker-compose部署(待补充)
[基于docker-compose部署](doc/在线考试系统V2.0_部署文档(docker版).md)
## 后续
- [ ] zipkin链路监控完善
- [ ] 容器化部署文档
- [ ] 业务功能完善
- [ ] 补充相关中间件的文档
......@@ -127,6 +126,8 @@
[在线考试系统V2.0部署文档](doc/在线考试系统V2.0_部署文档.md)
[在线考试系统V2.0部署文档(docker版)](doc/在线考试系统V2.0_部署文档(docker版).md)
[在线考试系统V2.0项目结构说明文档](doc/在线考试系统V2.0_项目结构说明.md)
[微服务架构下的安全设计方案](http://ehedgehog.net/2019/03/23/%E5%BE%AE%E6%9C%8D%E5%8A%A1%E6%9E%B6%E6%9E%84%E4%B8%8B%E7%9A%84%E5%AE%89%E5%85%A8%E8%AE%BE%E8%AE%A1%E6%96%B9%E6%A1%88/)
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>common-core</artifactId>
<name>${project.artifactId}</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>common-feign</artifactId>
<name>${project.artifactId}</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>common-log</artifactId>
<name>${project.artifactId}</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>common-security</artifactId>
<name>${project.artifactId}</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>common</artifactId>
<packaging>pom</packaging>
......
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER tangyi(1633736729@qq.com)
ADD ["target/config-service.jar", "app.jar"]
EXPOSE 8769
ENV JAVA_OPTS="-Xdebug -Dspring.profiles.active=native -jar -Xmn128m -Xms128m"
RUN sh -c 'touch /app.jar'
HEALTHCHECK CMD curl -f http://localhost:8769/actuator/health || exit 1
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>config-service</artifactId>
<name>${project.artifactId}</name>
......@@ -30,6 +30,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<!-- 打包时跳过test插件,不运行test测试用例 -->
<plugin>
......@@ -40,6 +43,41 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- docker的maven插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.verion}</version>
<executions>
<!--执行 mvn package 时 自动 执行 mvn docker:build-->
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.registry}/${docker.namespace}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<!-- 指定Dockerfile所在的路径 -->
<dockerDirectory>${project.basedir}</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.name}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -12,9 +12,11 @@ spring:
boot:
admin:
client:
url:
url: http://${ADMIN_HOST:localhost}:${ADMIN_PORT:8085}/admin
username: ${ADMIN_USERNAME:admin}
password: ${ADMIN_PASSWORD:11}
instance:
service-base-url: http://${CONFIG_SERVICE_HOST:localhost}:${server.port}
# 使用consul作为注册中心
cloud:
consul:
......@@ -23,5 +25,5 @@ spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
port: ${RABBIT_PORT:5672}
username: guest
password: guest
\ No newline at end of file
username: ${RABBITMQ_DEFAULT_USER:guest}
password: ${RABBITMQ_DEFAULT_PASS:guest}
\ No newline at end of file
server:
port: 8081
port: 8090
spring:
datasource:
url: jdbc:mysql://${MYSQL_HOST:192.168.0.144}:${MYSQL_PORT:3306}/microservice-auth?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
url: jdbc:mysql://${MYSQL_HOST:192.168.0.144}:${MYSQL_PORT:3306}/microservice-auth?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&characterEncoding=UTF-8
username: ${MYSQL_USERNAME:platform}
password: ${MYSQL_PASSWORD:11}
type: com.zaxxer.hikari.HikariDataSource
......@@ -13,8 +13,8 @@ spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
port: ${RABBIT_PORT:5672}
username: guest
password: guest
username: ${RABBITMQ_DEFAULT_USER:guest}
password: ${RABBITMQ_DEFAULT_PASS:guest}
boot:
admin:
client:
......@@ -22,7 +22,7 @@ spring:
username: ${ADMIN_USERNAME:admin}
password: ${ADMIN_PASSWORD:11}
instance:
service-base-url: http://localhost:${server.port}
service-base-url: http://${AUTH_SERVICE_HOST:localhost}:${server.port}
# sleuth 配置
sleuth:
web:
......@@ -32,7 +32,7 @@ spring:
probability: 1.0 # 采样比例为: 0.1(即10%),设置的值介于0.0到1.0之间,1.0则表示全部采集。
# zipkin 配置
zipkin:
base-url: http://localhost:9411 # 指定了Zipkin服务器的地址
base-url: http://${ZIPKIN_HOST:localhost}:${ZIPKIN_PORT:9411} # 指定了Zipkin服务器的地址
feign:
hystrix:
......
server:
port: 8083
port: 8098
spring:
datasource:
url: jdbc:mysql://${MYSQL_HOST:192.168.0.144}:${MYSQL_PORT:3306}/microservice-exam?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
url: jdbc:mysql://${MYSQL_HOST:192.168.0.144}:${MYSQL_PORT:3306}/microservice-exam?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&characterEncoding=UTF-8
username: ${MYSQL_USERNAME:platform}
password: ${MYSQL_PASSWORD:11}
type: com.zaxxer.hikari.HikariDataSource
......@@ -13,8 +13,8 @@ spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
port: ${RABBIT_PORT:5672}
username: guest
password: guest
username: ${RABBITMQ_DEFAULT_USER:guest}
password: ${RABBITMQ_DEFAULT_PASS:guest}
boot:
admin:
client:
......@@ -22,7 +22,7 @@ spring:
username: ${ADMIN_USERNAME:admin}
password: ${ADMIN_PASSWORD:11}
instance:
service-base-url: http://localhost:${server.port}
service-base-url: http://${EXAM_SERVICE_HOST:localhost}:${server.port}
# sleuth 配置
sleuth:
web:
......@@ -32,7 +32,7 @@ spring:
probability: 1.0 # 采样比例为: 0.1(即10%),设置的值介于0.0到1.0之间,1.0则表示全部采集。
# zipkin 配置
zipkin:
base-url: http://localhost:9411 # 指定了Zipkin服务器的地址
base-url: http://${ZIPKIN_HOST:localhost}:${ZIPKIN_PORT:9411} # 指定了Zipkin服务器的地址
security:
oauth2:
client:
......
......@@ -7,8 +7,8 @@ spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
port: ${RABBIT_PORT:5672}
username: guest
password: guest
username: ${RABBITMQ_DEFAULT_USER:guest}
password: ${RABBITMQ_DEFAULT_PASS:guest}
boot:
admin:
client:
......@@ -16,7 +16,7 @@ spring:
username: ${ADMIN_USERNAME:admin}
password: ${ADMIN_PASSWORD:11}
instance:
service-base-url: http://localhost:${server.port}
service-base-url: http://${GATEWAY_SERVICE_HOST:localhost}:${server.port}
# sleuth 配置
sleuth:
web:
......@@ -26,7 +26,7 @@ spring:
probability: 1.0 # 采样比例为: 0.1(即10%),设置的值介于0.0到1.0之间,1.0则表示全部采集。
# zipkin 配置
zipkin:
base-url: http://localhost:9411 # 指定了Zipkin服务器的地址
base-url: http://${ZIPKIN_HOST:localhost}:${ZIPKIN_PORT:9411} # 指定了Zipkin服务器的地址
security:
encode:
......
......@@ -9,8 +9,13 @@ turbine:
spring:
security:
user:
name: admin
password: 11
name: ${ADMIN_USERNAME:admin}
password: ${ADMIN_PASSWORD:11}
rabbitmq:
host: ${RABBIT_HOST:localhost}
port: ${RABBIT_PORT:5672}
username: ${RABBITMQ_DEFAULT_USER:guest}
password: ${RABBITMQ_DEFAULT_PASS:guest}
boot:
admin:
context-path: /admin
......@@ -18,7 +23,7 @@ spring:
enabled: false
auto-registration: false
instance:
service-base-url: http://localhost:${server.port}
service-base-url: http://${MONITOR_HOST:localhost}:${server.port}
discovery:
ignored-services: consul # 或略consul服务
# sleuth 配置
......@@ -30,4 +35,4 @@ spring:
probability: 1.0 # 采样比例为: 0.1(即10%),设置的值介于0.0到1.0之间,1.0则表示全部采集。
# zipkin 配置
zipkin:
base-url: http://localhost:9411 # 指定了Zipkin服务器的地址
\ No newline at end of file
base-url: http://${ZIPKIN_HOST:localhost}:${ZIPKIN_PORT:9411} # 指定了Zipkin服务器的地址
\ No newline at end of file
server:
port: 8082
port: 8095
spring:
servlet:
multipart:
......@@ -8,7 +8,7 @@ spring:
# 单次请求的文件的总大小
max-request-size: 100MB
datasource:
url: jdbc:mysql://${MYSQL_HOST:192.168.0.144}:${MYSQL_PORT:3306}/microservice-user?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
url: jdbc:mysql://${MYSQL_HOST:192.168.0.144}:${MYSQL_PORT:3306}/microservice-user?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&characterEncoding=UTF-8
username: ${MYSQL_USERNAME:platform}
password: ${MYSQL_PASSWORD:11}
type: com.zaxxer.hikari.HikariDataSource
......@@ -19,8 +19,8 @@ spring:
rabbitmq:
host: ${RABBIT_HOST:localhost}
port: ${RABBIT_PORT:5672}
username: guest
password: guest
username: ${RABBITMQ_DEFAULT_USER:guest}
password: ${RABBITMQ_DEFAULT_PASS:guest}
boot:
admin:
client:
......@@ -28,7 +28,7 @@ spring:
username: ${ADMIN_USERNAME:admin}
password: ${ADMIN_PASSWORD:11}
instance:
service-base-url: http://localhost:${server.port}
service-base-url: http://${USER_SERVICE_HOST:localhost}:${server.port}
# sleuth 配置
sleuth:
web:
......@@ -38,7 +38,7 @@ spring:
probability: 1.0 # 采样比例为: 0.1(即10%),设置的值介于0.0到1.0之间,1.0则表示全部采集。
# zipkin 配置
zipkin:
base-url: http://localhost:9411 # 指定了Zipkin服务器的地址
base-url: http://${ZIPKIN_HOST:localhost}:${ZIPKIN_PORT:9411} # 指定了Zipkin服务器的地址
security:
oauth2:
client:
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="online-exam"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
\ No newline at end of file
......@@ -11,7 +11,7 @@
Target Server Version : 50710
File Encoding : 65001
Date: 11/04/2019 20:50:10
Date: 21/04/2019 13:46:49
*/
SET NAMES utf8mb4;
......
......@@ -11,7 +11,7 @@
Target Server Version : 50710
File Encoding : 65001
Date: 11/04/2019 20:49:59
Date: 21/04/2019 13:47:02
*/
SET NAMES utf8mb4;
......
......@@ -11,7 +11,7 @@
Target Server Version : 50710
File Encoding : 65001
Date: 11/04/2019 20:49:49
Date: 21/04/2019 13:47:12
*/
SET NAMES utf8mb4;
......@@ -392,7 +392,7 @@ CREATE TABLE `sys_user` (
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名',
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名',
`password` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '密码',
`salt` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`salt` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '盐',
`phone` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '手机',
`avatar` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '头像',
`avatar_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像对应的附件id',
......
主要介绍如何基于docker、docker-compose部署后端项目、前端项目,主要的步骤是本地构建镜像,推送的远程仓库,远程服务器从远程仓库拉去镜像运行
主要介绍如何基于docker、docker-compose部署后端项目、前端项目,主要的步骤是本地构建镜像,推送的远程仓库,远程服务器从远程仓库拉去镜像运行
## 安装docker、docker-compose
linux系统安装`docker``docker-compose`
windows系统安装`Docker for Windows`
## 部署后端项目
### 安装MySQL
MySQL需要单独安装,创建数据库和执行初始化脚本:
`/doc/deploy/mysql/microservice-user.sql`
`/doc/deploy/mysql/microservice-exam.sql`
`/doc/deploy/mysql/microservice-auth.sql`
### 安装fastDfs
非必须,如果需要用到附件上传的相关功能才安装
基于`docker`安装`fastDfs`,网上有教程
### 修改配置
修改`docker-compose.env`,其它基本不用修改
包括数据库IP、端口、用户名和密码,fastDfs的IP、端口
![image](images/deploy/config_docker_env.png)
### 构建镜像
`spring-microservice-exam`目录下运行:
```
mvn clean package -DskipTests=true docker:build
```
![image](images/deploy/config_docker_mvn.png)
构建成功:
![image](images/deploy/config_docker_mvn_success.png)
### 运行
1. 运行基础镜像(consul、redis、rabbitMq、config-service)
```
docker-compose -f docker-compose-base.yml up -d
```
`-d`表示后台运行
![image](images/deploy/config_docker_base.png)
2. 运行服务镜像(gateway-service、auth-service、user-service、exam-service)
```
docker-compose -f docker-compose-services.yml up -d
```
3. 检查是否启动成功
```
docker ps
```
也可以访问`localhost:8500`查看服务是否注册成功
4. 停止运行
以基础镜像为例:
```
docker-compose -f docker-compose-base.yml stop
```
## 部署前端项目
`spring-microservice-exam-ui`为例,`spring-microservice-exam-web`同理
### 修改配置
修改`spring-microservice-exam-ui/config/proxyConfig.js`里的后端api网关地址,一般情况下是不需要修改的
![image](images/deploy/config_docker_ui_proxy.png)
### 打包
`spring-microservice-exam-ui`目录下运行:
```
npm run build
```
运行成功后会生成`dist`目录,里面是项目的静态资源
### 构建镜像
`spring-microservice-exam-ui`目录下运行:
```
docker build -t registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:2.0 .
```
![image](images/deploy/config_docker_ui_build.png)
### 运行
运行:
```
docker run -d -p 80:80 --name spring-microservice-exam-ui registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:2.0
```
![image](images/deploy/config_docker_ui_run.png)
## 推送到至远程仓库
以阿里云为例:
在容器镜像服务菜单下,新建镜像仓库`spring-microservice-exam-ui`
![image](images/deploy/config_docker_aliyun.png)
推送镜像
![image](images/deploy/config_docker_aliyun_push.png)
推送成功
![image](images/deploy/config_docker_aliyun_push_success.png)
## 远程服务器拉去镜像运行
```
docker pull registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:2.0
```
![image](images/deploy/config_docker_pull.png)
```
docker run -d -p 80:80 --name spring-microservice-exam-ui registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:2.0
```
基于docker-compose运行后端项目:
```
docker-compose -f docker-compose-base.yml up -d
```
```
docker-compose -f docker-compose-services.yml up -d
```
## 参考资料
待补充
version: '2'
services:
# ---------------------------
# consul集群,3个节点
# ---------------------------
consul:
image: consul:1.2.0
container_name: consul
command: consul agent -server -client 0.0.0.0 -ui -bootstrap-expect=3 -data-dir=/consul/data -retry-join=consul2 -retry-join=consul3 -datacenter=blr
restart: always
ports:
- "8300:8300"
- "8400:8400"
- "8500:8500"
- "8600:8600/udp"
networks:
- net
consul2:
image: consul:1.2.0
container_name: consul-2
expose:
- "8500"
- "8600"
command: consul agent -server -data-dir=/consul/data -retry-join=consul -retry-join=consul3 -datacenter=blr
links:
- consul
networks:
- net
consul3:
image: consul:1.2.0
container_name: consul-3
expose:
- "8500"
- "8600"
command: consul agent -server -data-dir=/consul/data -retry-join=consul -retry-join=consul2 -datacenter=blr
links:
- consul
- consul2
networks:
- net
# ---------------------------
# rabbitMq
# ---------------------------
rabbit:
image: rabbitmq:3.6.6-management-alpine
container_name: rabbit-mq
restart: always
ports:
- "5672:5672"
- "15672:15672"
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
networks:
- net
# ---------------------------
# Redis
# ---------------------------
redis:
image: redis:alpine
ports:
- "6379:6379"
networks:
- net
# ---------------------------
# 配置中心
# ---------------------------
config-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/config-service:2.0
container_name: config-service
env_file: docker-compose.env # 从文件中获取配置
restart: always
depends_on:
- consul
- rabbit
- redis
ports:
- "8769:8769"
networks:
- net
networks:
net:
driver: bridge
\ No newline at end of file
version: '2'
services:
# ---------------------------
# api网关
# ---------------------------
gateway-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/gateway-service:2.0
container_name: gateway-service
env_file: docker-compose.env # 从文件中获取配置
restart: always
ports:
- "8000:8000"
networks:
- net
# ---------------------------
# 授权服务
# ---------------------------
auth-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/auth-service:2.0
container_name: auth-service
env_file: docker-compose.env # 从文件中获取配置
restart: always
ports:
- "8090:8090"
networks:
- net
# ---------------------------
# 用户服务
# ---------------------------
user-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/user-service:2.0
container_name: user-service
env_file: docker-compose.env # 从文件中获取配置
restart: always
ports:
- "8095:8095"
networks:
- net
# ---------------------------
# 考试服务
# ---------------------------
exam-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/exam-service:2.0
container_name: exam-service
env_file: docker-compose.env # 从文件中获取配置
restart: always
ports:
- "8098:8098"
networks:
- net
# ---------------------------
# 监控服务
# ---------------------------
monitor-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/monitor-service:2.0
container_name: monitor-service
env_file: docker-compose.env # 从文件中获取配置
restart: always
ports:
- "8085:8085"
networks:
- net
networks:
net:
driver: bridge
\ No newline at end of file
// 环境配置
SPRING_PROFILES_ACTIVE=native
// consul配置
CONSUL_HOST=consul
CONSUL_PORT=8500
// rabbitMq配置
RABBIT_HOST=rabbit
RABBIT_PORT=5672
RABBITMQ_DEFAULT_USER=guest
RABBITMQ_DEFAULT_PASS=guest
// Redis配置
REDIS_HOST=redis
REDIS_PORT=6379
// 数据库配置
MYSQL_HOST=192.168.0.144
MYSQL_PORT=3306
MYSQL_USERNAME=platform
MYSQL_PASSWORD=11
// FDFS配置
FDFS_HOST=192.168.0.95
FDFS_PORT=22122
// 附件服务器配置
ATTACHMENT_HOST=http://192.168.0.95
ATTACHMENT_PORT=80
// 各服务host配置
CONFIG_SERVICE_HOST=config-service
AUTH_SERVICE_HOST=auth-service
EXAM_SERVICE_HOST=exam-service
GATEWAY_SERVICE_HOST=gateway-service
MONITOR_SERVICE_HOST=monitor-service
USER_SERVICE_HOST=user-service
// 服务监控配置
ADMIN_HOST=monitor-service
ADMIN_PORT=8085
ADMIN_USERNAME=admin
ADMIN_PASSWORD=11
// zipkin配置
ZIPKIN_HOST=localhost
ZIPKIN_PORT=9411
\ No newline at end of file
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER tangyi(1633736729@qq.com)
ADD ["target/gateway-service.jar", "app.jar"]
EXPOSE 8000
ENV JAVA_OPTS="-Xdebug -Dspring.profiles.active=native -jar -Xmn128m -Xms128m"
RUN sh -c 'touch /app.jar'
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>gateway-service</artifactId>
<name>${project.artifactId}</name>
......@@ -53,6 +53,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<!-- 打包时跳过test插件,不运行test测试用例 -->
<plugin>
......@@ -63,6 +66,41 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- docker的maven插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.verion}</version>
<executions>
<!--执行 mvn package 时 自动 执行 mvn docker:build-->
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.registry}/${docker.namespace}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<!-- 指定Dockerfile所在的路径 -->
<dockerDirectory>${project.basedir}</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.name}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="online-exam"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
\ No newline at end of file
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER tangyi(1633736729@qq.com)
ADD ["target/monitor-service.jar", "app.jar"]
EXPOSE 8085
ENV JAVA_OPTS="-Xdebug -Dspring.profiles.active=native -jar -Xmn128m -Xms128m"
RUN sh -c 'touch /app.jar'
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>monitor-service</artifactId>
<name>${project.artifactId}</name>
......@@ -53,6 +53,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<!-- 打包时跳过test插件,不运行test测试用例 -->
<plugin>
......@@ -63,6 +66,41 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- docker的maven插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.verion}</version>
<executions>
<!--执行 mvn package 时 自动 执行 mvn docker:build-->
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.registry}/${docker.namespace}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<!-- 指定Dockerfile所在的路径 -->
<dockerDirectory>${project.basedir}</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.name}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="online-exam"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
\ No newline at end of file
......@@ -6,7 +6,7 @@
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
<packaging>pom</packaging>
<name>spring-microservice-exam</name>
......@@ -42,6 +42,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<javadoc.version>3.0.0</javadoc.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- spring boot、spring cloud -->
......@@ -71,6 +72,12 @@
<hutool.version>4.5.0</hutool.version>
<jasypt.version>1.18</jasypt.version>
<kaptcha.version>0.0.9</kaptcha.version>
<!-- docker -->
<docker.maven.verion>1.0.0</docker.maven.verion>
<docker.registry>registry.cn-hangzhou.aliyuncs.com</docker.registry>
<docker.namespace>spring-microservice-exam</docker.namespace>
<scanner.maven.version>3.3.0.603</scanner.maven.version>
</properties>
<dependencies>
......@@ -248,6 +255,43 @@
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.version}</version>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${scanner.maven.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
......
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER tangyi(1633736729@qq.com)
ADD ["target/auth-service.jar", "app.jar"]
EXPOSE 8090
ENV JAVA_OPTS="-Xdebug -Dspring.profiles.active=native -jar -Xmn128m -Xms128m"
RUN sh -c 'touch /app.jar'
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>service-api-impl</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>auth-service</artifactId>
<name>${project.artifactId}</name>
......@@ -100,6 +100,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<!-- 打包时跳过test插件,不运行test测试用例 -->
<plugin>
......@@ -110,6 +113,41 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- docker的maven插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.verion}</version>
<executions>
<!--执行 mvn package 时 自动 执行 mvn docker:build-->
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.registry}/${docker.namespace}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<!-- 指定Dockerfile所在的路径 -->
<dockerDirectory>${project.basedir}</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.name}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="online-exam"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
\ No newline at end of file
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER tangyi(1633736729@qq.com)
ADD ["target/exam-service.jar", "app.jar"]
EXPOSE 8098
ENV JAVA_OPTS="-Xdebug -Dspring.profiles.active=native -jar -Xmn128m -Xms128m"
RUN sh -c 'touch /app.jar'
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>service-api-impl</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>exam-service</artifactId>
<name>${project.artifactId}</name>
......@@ -95,6 +95,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<!-- 打包时跳过test插件,不运行test测试用例 -->
<plugin>
......@@ -105,6 +108,41 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- docker的maven插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.verion}</version>
<executions>
<!--执行 mvn package 时 自动 执行 mvn docker:build-->
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.registry}/${docker.namespace}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<!-- 指定Dockerfile所在的路径 -->
<dockerDirectory>${project.basedir}</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.name}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -109,6 +109,7 @@ public class AnswerService extends CrudService<AnswerMapper, Answer> {
/**
* 提交答卷
* TODO 通过mq异步处理
*
* @param answer answer
* @return boolean
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="online-exam"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>service-api-impl</artifactId>
<packaging>pom</packaging>
......
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER tangyi(1633736729@qq.com)
ADD ["target/user-service.jar", "app.jar"]
EXPOSE 8095
ENV JAVA_OPTS="-Xdebug -Dspring.profiles.active=native -jar -Xmn128m -Xms128m"
RUN sh -c 'touch /app.jar'
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>service-api-impl</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>user-service</artifactId>
<name>${project.artifactId}</name>
......@@ -95,6 +95,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
<!-- 打包时跳过test插件,不运行test测试用例 -->
<plugin>
......@@ -105,6 +108,41 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- docker的maven插件 -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.verion}</version>
<executions>
<!--执行 mvn package 时 自动 执行 mvn docker:build-->
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>${docker.registry}/${docker.namespace}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<!-- 指定Dockerfile所在的路径 -->
<dockerDirectory>${project.basedir}</dockerDirectory>
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.name}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="online-exam"/>
<property name="log.path" value="logs/${spring.application.name}" />
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{MM-dd HH:mm:ss.SSS} %-5level [%logger{50}] - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="debug" />
<appender-ref ref="error" />
</root>
</configuration>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>service-api</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>auth-api</artifactId>
<name>${project.artifactId}</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>service-api</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>exam-api</artifactId>
<name>${project.artifactId}</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>service-api</artifactId>
<packaging>pom</packaging>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>service-api</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>user-api</artifactId>
<name>${project.artifactId}</name>
......
sonar.projectKey=spring-microservice-exam
sonar.projectName=spring-microservice-exam
sonar.projectVersion=2.0
sonar.sources=
sonar.binaries=bin
sonar.language=java
sonar.sourceEncoding=UTF-8
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.0</version>
</parent>
<artifactId>zipkin-service</artifactId>
<packaging>pom</packaging>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment