Commit 639cde34 by tangyi

升级spring boot、cloud版本,配置中心认证,elk

parent 58cdf68b
Version v3.2.0-SNAPSHOT (2019-8-18)
--------------------------
改进:
* 升级spring boot、spring cloud版本
* 配置中心增加安全控制
* 集成elk
Version v3.1.0 (2019-7-18) Version v3.1.0 (2019-7-18)
-------------------------- --------------------------
改进: 改进:
* 调整项目结构 * 调整项目结构
* 调整版本号 * 调整版本号
* 去掉热部署部分内容,修复读取缓存报ClassCastException问题 * 去掉热部署部分内容,修复读取缓存报ClassCastException问题
* 完善登录日志,增加登录IP、耗时等信息 * 完善登录日志,增加登录IP、耗时等信息
......
...@@ -64,8 +64,8 @@ QQ群号:996208878 ...@@ -64,8 +64,8 @@ QQ群号:996208878
| 名称 | 版本 | | 名称 | 版本 |
| --------- | -------- | | --------- | -------- |
| `Spring Boot` | `2.1.3.RELEASE` | | `Spring Boot` | `2.1.7.RELEASE` |
| `Spring Cloud` | `Greenwich.SR1` | | `Spring Cloud` | `Greenwich.SR2` |
## 系统架构 ## 系统架构
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>common-core</artifactId> <artifactId>common-core</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>common-feign</artifactId> <artifactId>common-feign</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>common-log</artifactId> <artifactId>common-log</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>common-security</artifactId> <artifactId>common-security</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>common</artifactId> <artifactId>common</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>config-service</artifactId> <artifactId>config-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
<artifactId>spring-cloud-config-server</artifactId> <artifactId>spring-cloud-config-server</artifactId>
</dependency> </dependency>
<!-- security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- 管理中心插件 --> <!-- 管理中心插件 -->
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
......
...@@ -8,6 +8,10 @@ spring: ...@@ -8,6 +8,10 @@ spring:
profiles: profiles:
# 指定为native,开启本地存储配置的方式,spring cloud微服务配置中心默认有3种方式:远程git仓库、远程SVN、本地方式(本地目录) # 指定为native,开启本地存储配置的方式,spring cloud微服务配置中心默认有3种方式:远程git仓库、远程SVN、本地方式(本地目录)
active: ${SPRING_PROFILES_ACTIVE:native} active: ${SPRING_PROFILES_ACTIVE:native}
security:
user:
name: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
# spring boot admin配置 # spring boot admin配置
boot: boot:
admin: admin:
...@@ -17,6 +21,9 @@ spring: ...@@ -17,6 +21,9 @@ spring:
password: ${ADMIN_PASSWORD:11} password: ${ADMIN_PASSWORD:11}
instance: instance:
service-base-url: http://${CONFIG_SERVICE_HOST:localhost}:${server.port} service-base-url: http://${CONFIG_SERVICE_HOST:localhost}:${server.port}
metadata:
tags:
environment: prd
# 使用consul作为注册中心 # 使用consul作为注册中心
cloud: cloud:
consul: consul:
......
...@@ -23,6 +23,9 @@ spring: ...@@ -23,6 +23,9 @@ spring:
password: ${ADMIN_PASSWORD:11} password: ${ADMIN_PASSWORD:11}
instance: instance:
service-base-url: http://${AUTH_SERVICE_HOST:localhost}:${server.port} service-base-url: http://${AUTH_SERVICE_HOST:localhost}:${server.port}
metadata:
tags:
environment: prd
# sleuth 配置 # sleuth 配置
sleuth: sleuth:
web: web:
...@@ -125,8 +128,8 @@ sys: ...@@ -125,8 +128,8 @@ sys:
# 微信配置 # 微信配置
wx: wx:
appId: wx597d9f972f991a8c appId: test
appSecret: b5d44266271a08c6f75a347712a7334e appSecret: test
grantType: authorization_code grantType: authorization_code
logging: logging:
......
...@@ -23,6 +23,9 @@ spring: ...@@ -23,6 +23,9 @@ spring:
password: ${ADMIN_PASSWORD:11} password: ${ADMIN_PASSWORD:11}
instance: instance:
service-base-url: http://${EXAM_SERVICE_HOST:localhost}:${server.port} service-base-url: http://${EXAM_SERVICE_HOST:localhost}:${server.port}
metadata:
tags:
environment: prd
# sleuth 配置 # sleuth 配置
sleuth: sleuth:
web: web:
......
...@@ -32,6 +32,9 @@ spring: ...@@ -32,6 +32,9 @@ spring:
password: ${ADMIN_PASSWORD:11} password: ${ADMIN_PASSWORD:11}
instance: instance:
service-base-url: http://${GATEWAY_SERVICE_HOST:localhost}:${server.port} service-base-url: http://${GATEWAY_SERVICE_HOST:localhost}:${server.port}
metadata:
tags:
environment: prd
# sleuth 配置 # sleuth 配置
sleuth: sleuth:
web: web:
......
...@@ -25,7 +25,9 @@ spring: ...@@ -25,7 +25,9 @@ spring:
instance: instance:
service-base-url: http://${MONITOR_HOST:localhost}:${server.port} service-base-url: http://${MONITOR_HOST:localhost}:${server.port}
discovery: discovery:
ignored-services: consul # 或略consul服务 ignored-services: consul # 忽略consul服务
ui:
title: monitor-service
# sleuth 配置 # sleuth 配置
sleuth: sleuth:
web: web:
......
...@@ -17,6 +17,9 @@ spring: ...@@ -17,6 +17,9 @@ spring:
password: ${ADMIN_PASSWORD:11} password: ${ADMIN_PASSWORD:11}
instance: instance:
service-base-url: http://${AUTH_SERVICE_HOST:localhost}:${server.port} service-base-url: http://${AUTH_SERVICE_HOST:localhost}:${server.port}
metadata:
tags:
environment: prd
# sleuth 配置 # sleuth 配置
sleuth: sleuth:
web: web:
...@@ -83,14 +86,14 @@ management: ...@@ -83,14 +86,14 @@ management:
# 短信配置 # 短信配置
sms: sms:
appKey: appKey appKey: ${SMS_APP_KEY:test}
appSecret: appSecret appSecret: ${SMS_APP_SECRET:test}
regionId: default regionId: ${SMS_REGION_ID:default}
domain: dysmsapi.aliyuncs.com domain: ${SMS_DOMAIN:dysmsapi.aliyuncs.com}
signName: 在线考试系统演示 signName: ${SMS_SIGN_NAME:test}
templateCode: SMS_171192294 templateCode: ${SMS_TEMP_CODE:SMS_171192294}
version: 2017-05-25 version: ${SMS_VERSION:2017-05-25}
action: SendSms action: ${SMS_ACTION:SendSms}
ignore: ignore:
urls: urls:
......
...@@ -29,6 +29,9 @@ spring: ...@@ -29,6 +29,9 @@ spring:
password: ${ADMIN_PASSWORD:11} password: ${ADMIN_PASSWORD:11}
instance: instance:
service-base-url: http://${USER_SERVICE_HOST:localhost}:${server.port} service-base-url: http://${USER_SERVICE_HOST:localhost}:${server.port}
metadata:
tags:
environment: prd
# sleuth 配置 # sleuth 配置
sleuth: sleuth:
web: web:
......
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
version: '2' version: '3'
services: services:
# --------------------------- # ---------------------------
# consul集群,3个节点 # consul集群,3个节点
...@@ -70,7 +70,7 @@ services: ...@@ -70,7 +70,7 @@ services:
# 配置中心 # 配置中心
# --------------------------- # ---------------------------
config-service: config-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/config-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/config-service:3.2.0-SNAPSHOT
container_name: config-service container_name: config-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
......
version: '3.2'
services:
elk:
image: sebp/elk
container_name: elk
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
environment:
- ES_JAVA_OPTS=-Xms256m -Xmx256m
- TZ=Asia/Shanghai
restart: "unless-stopped"
\ No newline at end of file
version: '2' version: '3'
services: services:
# --------------------------- # ---------------------------
# 前台 # 前台
# --------------------------- # ---------------------------
spring-microservice-exam-web: spring-microservice-exam-web:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-web:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-web:3.2.0-SNAPSHOT
volumes: volumes:
# 挂载nginx的配置文件 # 挂载nginx的配置文件
- ./nginx.conf:/etc/nginx/nginx.conf - ./nginx.conf:/etc/nginx/nginx.conf
...@@ -20,7 +20,7 @@ services: ...@@ -20,7 +20,7 @@ services:
# 后台 # 后台
# --------------------------- # ---------------------------
spring-microservice-exam-ui: spring-microservice-exam-ui:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:3.2.0-SNAPSHOT
volumes: volumes:
# 挂载nginx的配置文件 # 挂载nginx的配置文件
- ./nginx.conf:/etc/nginx/nginx.conf - ./nginx.conf:/etc/nginx/nginx.conf
......
version: '2' version: '3'
services: services:
# --------------------------- # ---------------------------
# api网关 # api网关
# --------------------------- # ---------------------------
gateway-service: gateway-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/gateway-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/gateway-service:3.2.0-SNAPSHOT
container_name: gateway-service container_name: gateway-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
...@@ -17,7 +17,7 @@ services: ...@@ -17,7 +17,7 @@ services:
# 授权服务 # 授权服务
# --------------------------- # ---------------------------
auth-service: auth-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/auth-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/auth-service:3.2.0-SNAPSHOT
container_name: auth-service container_name: auth-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
...@@ -30,7 +30,7 @@ services: ...@@ -30,7 +30,7 @@ services:
# 用户服务 # 用户服务
# --------------------------- # ---------------------------
user-service: user-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/user-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/user-service:3.2.0-SNAPSHOT
container_name: user-service container_name: user-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
...@@ -43,7 +43,7 @@ services: ...@@ -43,7 +43,7 @@ services:
# 考试服务 # 考试服务
# --------------------------- # ---------------------------
exam-service: exam-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/exam-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/exam-service:3.2.0-SNAPSHOT
container_name: exam-service container_name: exam-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
...@@ -56,7 +56,7 @@ services: ...@@ -56,7 +56,7 @@ services:
# 消息服务 # 消息服务
# --------------------------- # ---------------------------
msc-service: msc-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/msc-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/msc-service:3.2.0-SNAPSHOT
container_name: msc-service container_name: msc-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
...@@ -69,7 +69,7 @@ services: ...@@ -69,7 +69,7 @@ services:
# 监控服务 # 监控服务
# --------------------------- # ---------------------------
monitor-service: monitor-service:
image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/monitor-service:3.1.0 image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/monitor-service:3.2.0-SNAPSHOT
container_name: monitor-service container_name: monitor-service
env_file: docker-compose.env # 从文件中获取配置 env_file: docker-compose.env # 从文件中获取配置
restart: always restart: always
......
# JVM参数 # JVM参数
# 可通过docker-compose -f docker-compose-services.yml config命令查看是否生效 # 可通过docker-compose -f docker-compose-services.yml config命令查看是否生效
JAVA_OPTS=-Xmx512m -Xms256m JAVA_OPTS=-Xmx128m -Xms128m
# 租户标识,默认gitee # 租户标识,默认gitee
TENANT_CODE=gitee TENANT_CODE=gitee
# 网关token转换 # 网关token转换
GATEWAY_TOKEN_TRANSFER=true GATEWAY_TOKEN_TRANSFER=false
# 环境配置 # 环境配置
SPRING_PROFILES_ACTIVE=native SPRING_PROFILES_ACTIVE=native
...@@ -26,17 +26,21 @@ REDIS_HOST=redis ...@@ -26,17 +26,21 @@ REDIS_HOST=redis
REDIS_PORT=6379 REDIS_PORT=6379
# 数据库配置 # 数据库配置
MYSQL_HOST=localhost MYSQL_HOST=mysql
MYSQL_PORT=3306 MYSQL_PORT=3306
MYSQL_USERNAME=platform MYSQL_USERNAME=root
MYSQL_PASSWORD=11 MYSQL_PASSWORD=11
# FDFS配置 # FDFS配置
FDFS_HOST=localhost FDFS_HOST=fdfs
FDFS_PORT=22122 FDFS_PORT=22122
# 配置中心的账号密码
CONFIG_SERVER_USERNAME=admin
CONFIG_SERVER_PASSWORD=11
# 附件服务器配置 # 附件服务器配置
ATTACHMENT_HOST=http:#localhost ATTACHMENT_HOST=http://attachment-service:8080
ATTACHMENT_PORT=80 ATTACHMENT_PORT=80
# 各服务host配置 # 各服务host配置
...@@ -54,7 +58,7 @@ ADMIN_USERNAME=admin ...@@ -54,7 +58,7 @@ ADMIN_USERNAME=admin
ADMIN_PASSWORD=11 ADMIN_PASSWORD=11
# zipkin配置 # zipkin配置
ZIPKIN_HOST=localhost ZIPKIN_HOST=zipkin-service
ZIPKIN_PORT=9411 ZIPKIN_PORT=9411
# 演示环境 # 演示环境
...@@ -65,4 +69,7 @@ CLUSTER_WORK_ID=1 ...@@ -65,4 +69,7 @@ CLUSTER_WORK_ID=1
CLUSTER_DATA_CENTER_ID=1 CLUSTER_DATA_CENTER_ID=1
# 时区设置,否则容器里的时间和主机时间差8小时 # 时区设置,否则容器里的时间和主机时间差8小时
TZ=Asia/Shanghai TZ=Asia/Shanghai
\ No newline at end of file
# elk配置
ELK_DESTINATION=localhost:5044
\ No newline at end of file
input {
tcp {
port => 5044
codec => json_lines
}
}
output{
elasticsearch {
hosts => ["localhost:9200"]
}
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50617 Target Server Version : 50617
File Encoding : 65001 File Encoding : 65001
Date: 04/07/2019 14:36:21 Date: 18/08/2019 20:10:54
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50617 Target Server Version : 50617
File Encoding : 65001 File Encoding : 65001
Date: 18/07/2019 23:06:58 Date: 18/08/2019 20:10:40
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -42,8 +42,9 @@ CREATE TABLE `sys_route` ( ...@@ -42,8 +42,9 @@ CREATE TABLE `sys_route` (
-- ---------------------------- -- ----------------------------
-- Records of sys_route -- Records of sys_route
-- ---------------------------- -- ----------------------------
INSERT INTO `sys_route` VALUES ('0f1aec35a545433c8cc0c8e78995f039', 'auth-service', '认证授权服务', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/auth/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://auth-service', '0', '0', 'admin', '2019-04-07 11:20:55', 'admin', '2019-04-26 22:45:28', 0, 'EXAM'); INSERT INTO `sys_route` VALUES ('0f1aec35a545433c8cc0c8e78995f039', 'auth-service', '认证授权服务', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/auth/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://auth-service', '1', '0', 'admin', '2019-04-07 11:20:55', '', '2019-08-03 09:58:48', 0, 'EXAM');
INSERT INTO `sys_route` VALUES ('5d9dd5f2cb1147aaad6f8b82a58586e8', 'exam-service', '考试服务', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/exam/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://exam-service', '0', '0', 'admin', '2019-04-02 21:39:30', 'admin', '2019-04-26 22:45:30', 0, 'EXAM'); INSERT INTO `sys_route` VALUES ('5d9dd5f2cb1147aaad6f8b82a58586e8', 'exam-service', '考试服务', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/exam/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://exam-service', '3', '0', 'admin', '2019-04-02 21:39:30', '', '2019-08-03 09:58:54', 0, 'EXAM');
INSERT INTO `sys_route` VALUES ('e9199257e8dc4f2d8fbb2a113c407eca', 'user-service', '用户服务', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/user/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://user-service', '0', '0', 'admin', '2019-04-07 11:22:05', 'admin', '2019-06-07 21:48:45', 0, 'EXAM'); INSERT INTO `sys_route` VALUES ('607150228717572096', 'msc-service', '消息中心', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/msc/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://msc-service', '4', '0', '', '2019-08-03 09:58:15', '', '2019-08-03 09:58:27', 0, 'EXAM');
INSERT INTO `sys_route` VALUES ('e9199257e8dc4f2d8fbb2a113c407eca', 'user-service', '用户服务', '[\n {\n \"name\": \"Path\",\n \"args\": {\n \"_genkey_0\": \"/api/user/**\"\n }\n }\n]', '[\n {\n \"name\": \"StripPrefix\",\n \"args\": {\n \"_genkey_0\": \"2\"\n }\n },\n {\n \"name\": \"RemoveRequestHeader\",\n \"args\": {\n \"_genkey_0\": \"Cookie\",\n \"_genkey_1\": \"Set-Cookie\"\n }\n }\n]', 'lb://user-service', '2', '0', 'admin', '2019-04-07 11:22:05', '', '2019-08-03 09:58:35', 0, 'EXAM');
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50617 Target Server Version : 50617
File Encoding : 65001 File Encoding : 65001
Date: 18/07/2019 23:06:48 Date: 18/08/2019 20:10:33
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -627,6 +627,7 @@ CREATE TABLE `sys_user` ( ...@@ -627,6 +627,7 @@ CREATE TABLE `sys_user` (
`login_time` timestamp(0) NULL DEFAULT NULL, `login_time` timestamp(0) NULL DEFAULT NULL,
`lock_time` timestamp(0) NULL DEFAULT NULL, `lock_time` timestamp(0) NULL DEFAULT NULL,
`wechat` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `wechat` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`family_role` int(11) NULL DEFAULT NULL,
`creator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人', `creator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人',
`create_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间', `create_date` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modifier` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '修改人', `modifier` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '修改人',
...@@ -640,10 +641,11 @@ CREATE TABLE `sys_user` ( ...@@ -640,10 +641,11 @@ CREATE TABLE `sys_user` (
-- ---------------------------- -- ----------------------------
-- Records of sys_user -- Records of sys_user
-- ---------------------------- -- ----------------------------
INSERT INTO `sys_user` VALUES ('596078038307966976', '管理员', '15521089185', '596094244884713472', '1633736729@qq.com', '2019-07-01', 0, 0, '571347099191480320', '管理员', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2019-07-04 13:51:34', 'admin', '2019-07-04 13:51:35', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user` VALUES ('596078038307966976', '管理员', '15521089185', '596094244884713472', '1633736729@qq.com', '2019-07-01', 0, 0, '571347099191480320', '管理员', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2019-07-04 13:51:34', 'admin', '2019-07-04 13:51:35', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user` VALUES ('596307222997372928', '梁同学', '15521089185', NULL, '1633736729@qq.com', '2019-07-01', 0, 1, NULL, '梁同学', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2019-07-05 21:53:16', 'admin', '2019-07-05 21:53:17', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user` VALUES ('596307222997372928', '梁同学', '15521089185', NULL, '1633736729@qq.com', '2019-07-01', 0, 1, NULL, '梁同学', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2019-07-05 21:53:16', 'admin', '2019-07-05 21:53:17', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user` VALUES ('596332387600830464', '林老师', '15521089185', NULL, '1633736729@qq.com', '2019-07-03', 0, 1, NULL, '林老师', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2019-07-04 13:34:28', 'admin', '2019-07-04 13:38:06', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user` VALUES ('596332387600830464', '林老师', '15521089185', NULL, '1633736729@qq.com', '2019-07-03', 0, 1, NULL, '林老师', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'admin', '2019-07-04 13:34:28', 'admin', '2019-07-04 13:38:06', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user` VALUES ('597110984758398976', '测试', '15521089182', '597110984758398977', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-07-06 17:05:52', NULL, NULL, 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '2019-07-18 23:06:24', 'admin', '2019-07-18 23:06:25', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user` VALUES ('597110984758398976', '测试', '15521089182', '597110984758398977', NULL, NULL, 0, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-07-06 17:05:52', NULL, NULL, NULL, 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '2019-07-18 23:06:24', 'admin', '2019-07-18 23:06:25', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user` VALUES ('607570770629103616', NULL, '15521089185', NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2019-08-04 13:49:20', NULL, NULL, NULL, '15521089185', '2019-08-04 13:49:20', '15521089185', '2019-08-04 13:49:20', 0, 'EXAM', 'gitee');
-- ---------------------------- -- ----------------------------
-- Table structure for sys_user_auths -- Table structure for sys_user_auths
...@@ -673,6 +675,7 @@ INSERT INTO `sys_user_auths` VALUES ('596329627606192128', '596078038307966976', ...@@ -673,6 +675,7 @@ INSERT INTO `sys_user_auths` VALUES ('596329627606192128', '596078038307966976',
INSERT INTO `sys_user_auths` VALUES ('596329627648135168', '596307222997372928', 1, 'student', '$2a$10$czmVw4WF7Qt7RpwDJ4V4W.jkDKheEev63HlIsP31QnWHVOpSJz3au', 'admin', '2019-07-04 13:21:03', 'admin', '2019-07-04 13:21:03', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user_auths` VALUES ('596329627648135168', '596307222997372928', 1, 'student', '$2a$10$czmVw4WF7Qt7RpwDJ4V4W.jkDKheEev63HlIsP31QnWHVOpSJz3au', 'admin', '2019-07-04 13:21:03', 'admin', '2019-07-04 13:21:03', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user_auths` VALUES ('596332387693105152', '596332387600830464', 1, 'teacher', '$2a$10$c9xRyRp3DXACdLgb/.yFR.5qSGIkGdP8o6WIcg4J9Hc6DY4FoUh0y', 'admin', '2019-07-04 13:32:01', 'admin', '2019-07-04 13:32:01', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user_auths` VALUES ('596332387693105152', '596332387600830464', 1, 'teacher', '$2a$10$c9xRyRp3DXACdLgb/.yFR.5qSGIkGdP8o6WIcg4J9Hc6DY4FoUh0y', 'admin', '2019-07-04 13:32:01', 'admin', '2019-07-04 13:32:01', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user_auths` VALUES ('597110984905199616', '597110984758398976', 4, 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '$2a$10$H8/Cm4fYNdcWjtfZkD58OOlUZHx81OTcLDnPDaLheJ.fGr.Xtj7OK', 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '2019-07-06 17:05:53', 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '2019-07-06 17:05:53', 0, 'EXAM', 'gitee'); INSERT INTO `sys_user_auths` VALUES ('597110984905199616', '597110984758398976', 4, 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '$2a$10$H8/Cm4fYNdcWjtfZkD58OOlUZHx81OTcLDnPDaLheJ.fGr.Xtj7OK', 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '2019-07-06 17:05:53', 'ovLl45InRn4Hz_jrpEk-gF-kEFf8', '2019-07-06 17:05:53', 0, 'EXAM', 'gitee');
INSERT INTO `sys_user_auths` VALUES ('607570770817847296', '607570770629103616', 2, '15521089185', '$2a$10$Xbldn/SREVl8xN6s98n9/.usvTed6e7gpJfbRuFZniOnyo6uNF45C', '15521089185', '2019-08-04 13:49:20', '15521089185', '2019-08-04 13:49:20', 0, 'EXAM', 'gitee');
-- ---------------------------- -- ----------------------------
-- Table structure for sys_user_role -- Table structure for sys_user_role
...@@ -692,6 +695,7 @@ INSERT INTO `sys_user_role` VALUES ('596307898116739072', '596078038307966976', ...@@ -692,6 +695,7 @@ INSERT INTO `sys_user_role` VALUES ('596307898116739072', '596078038307966976',
INSERT INTO `sys_user_role` VALUES ('596333922548322304', '596332387600830464', '596330074307956736'); INSERT INTO `sys_user_role` VALUES ('596333922548322304', '596332387600830464', '596330074307956736');
INSERT INTO `sys_user_role` VALUES ('596820924016234496', '596307222997372928', '596116511031169024'); INSERT INTO `sys_user_role` VALUES ('596820924016234496', '596307222997372928', '596116511031169024');
INSERT INTO `sys_user_role` VALUES ('601550371109867520', '597110984758398976', '596116511031169024'); INSERT INTO `sys_user_role` VALUES ('601550371109867520', '597110984758398976', '596116511031169024');
INSERT INTO `sys_user_role` VALUES ('607570771480547328', '607570770629103616', '596116511031169024');
-- ---------------------------- -- ----------------------------
-- Table structure for sys_user_student -- Table structure for sys_user_student
......
...@@ -5,7 +5,7 @@ DOCKERHOME=/spring-microservice-exam ...@@ -5,7 +5,7 @@ DOCKERHOME=/spring-microservice-exam
# 镜像名称前缀、标签 # 镜像名称前缀、标签
BASE_IMAGE_NAME=registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam BASE_IMAGE_NAME=registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam
BSEE_IMAGE_TAG=3.1.0 BSEE_IMAGE_TAG=3.2.0-SNAPSHOT
# 各服务的镜像名称 # 各服务的镜像名称
CONFIG_SERVICE=$BASE_IMAGE_NAME/config-service:$BSEE_IMAGE_TAG CONFIG_SERVICE=$BASE_IMAGE_NAME/config-service:$BSEE_IMAGE_TAG
......
...@@ -30,4 +30,9 @@ server { ...@@ -30,4 +30,9 @@ server {
index index.html index.htm; index index.html index.htm;
} }
} }
``` ```
\ No newline at end of file
# 后续计划
1. filters和predicates入库
2. 服务多实例部署,支持流量切换、灰度发布、ABTest,思路:基于服务标签(主、备)、权重方式实现
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>gateway-service</artifactId> <artifactId>gateway-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
package com.github.tangyi.gateway.module;
import com.github.tangyi.common.core.persistence.BaseEntity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 网关过滤器
*
* @author tangyi
* @date 2019-08-16 17:48
*/
@Data
public class Filters extends BaseEntity<Filters> {
/**
* 路由ID
*/
@NotBlank(message = "路由ID不能为空")
private String routeId;
/**
* 过滤器名称
*/
@NotBlank(message = "filter name不能为空")
private String name;
/**
* 路由参数
*/
private String args;
}
package com.github.tangyi.gateway.module;
import com.github.tangyi.common.core.persistence.BaseEntity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 断言
*
* @author tangyi
* @date 2019-08-16 17:51
*/
@Data
public class Predicates extends BaseEntity<Predicates> {
/**
* 路由ID
*/
@NotBlank(message = "路由ID不能为空")
private String routeId;
/**
* 断言名称
*/
@NotBlank(message = "predicates name不能为空")
private String name;
/**
* 断言参数
*/
private String args;
}
...@@ -17,3 +17,5 @@ spring: ...@@ -17,3 +17,5 @@ spring:
enabled: true enabled: true
# 指向配置中心在consul注册的服务名称(即:spring.application.name) # 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id: config-service service-id: config-service
username: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>auth-service-parent</artifactId> <artifactId>auth-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>auth-service-api</artifactId> <artifactId>auth-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>auth-service-parent</artifactId> <artifactId>auth-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>auth-service</artifactId> <artifactId>auth-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -18,15 +18,11 @@ spring: ...@@ -18,15 +18,11 @@ spring:
enabled: true enabled: true
# 指向配置中心在consul注册的服务名称(即:spring.application.name) # 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id: config-service service-id: config-service
username: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
# jwt加密配置 # jwt加密配置
encrypt: encrypt:
key-store: key-store:
location: classpath:/jwt.jks location: classpath:/jwt.jks
alias: jwt alias: jwt
password: abc123 password: abc123
\ No newline at end of file
logging:
level:
root: info
com.github.tangyi: debug
\ No newline at end of file
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>modules</artifactId> <artifactId>modules</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>auth-service-parent</artifactId> <artifactId>auth-service-parent</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>exam-service-parent</artifactId> <artifactId>exam-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>exam-service-api</artifactId> <artifactId>exam-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>exam-service-parent</artifactId> <artifactId>exam-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>exam-service</artifactId> <artifactId>exam-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -16,4 +16,6 @@ spring: ...@@ -16,4 +16,6 @@ spring:
# 默认false,设为true表示使用注册中心中的配置服务(服务发现)而不自己指定配置服务的地址(即uri) # 默认false,设为true表示使用注册中心中的配置服务(服务发现)而不自己指定配置服务的地址(即uri)
enabled: true enabled: true
# 指向配置中心在consul注册的服务名称(即:spring.application.name) # 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id: config-service service-id: config-service
\ No newline at end of file username: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
\ No newline at end of file
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>modules</artifactId> <artifactId>modules</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>exam-service-parent</artifactId> <artifactId>exam-service-parent</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>msc-service-parent</artifactId> <artifactId>msc-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>msc-service-api</artifactId> <artifactId>msc-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>msc-service-parent</artifactId> <artifactId>msc-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>msc-service</artifactId> <artifactId>msc-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -16,4 +16,6 @@ spring: ...@@ -16,4 +16,6 @@ spring:
# 默认false,设为true表示使用注册中心中的配置服务(服务发现)而不自己指定配置服务的地址(即uri) # 默认false,设为true表示使用注册中心中的配置服务(服务发现)而不自己指定配置服务的地址(即uri)
enabled: true enabled: true
# 指向配置中心在consul注册的服务名称(即:spring.application.name) # 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id: config-service service-id: config-service
\ No newline at end of file username: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
\ No newline at end of file
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>modules</artifactId> <artifactId>modules</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>msc-service-parent</artifactId> <artifactId>msc-service-parent</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>modules</artifactId> <artifactId>modules</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>modules</artifactId> <artifactId>modules</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>user-service-parent</artifactId> <artifactId>user-service-parent</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>user-service-parent</artifactId> <artifactId>user-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>user-service-api</artifactId> <artifactId>user-service-api</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>user-service-parent</artifactId> <artifactId>user-service-parent</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>user-service</artifactId> <artifactId>user-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -100,6 +100,8 @@ public class LogController extends BaseController { ...@@ -100,6 +100,8 @@ public class LogController extends BaseController {
public ResponseBean<Boolean> addLog(@RequestBody @Valid Log log) { public ResponseBean<Boolean> addLog(@RequestBody @Valid Log log) {
if (StringUtils.isBlank(log.getId())) if (StringUtils.isBlank(log.getId()))
log.setCommonValue(SysUtil.getUser(), SysUtil.getSysCode(), SysUtil.getTenantCode()); log.setCommonValue(SysUtil.getUser(), SysUtil.getSysCode(), SysUtil.getTenantCode());
if (true)
return null;
// 保存日志 // 保存日志
return new ResponseBean<>(logService.insert(log) > 0); return new ResponseBean<>(logService.insert(log) > 0);
} }
......
...@@ -18,3 +18,5 @@ spring: ...@@ -18,3 +18,5 @@ spring:
enabled: true enabled: true
# 指向配置中心在consul注册的服务名称(即:spring.application.name) # 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id: config-service service-id: config-service
username: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>monitor-service</artifactId> <artifactId>monitor-service</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
......
...@@ -17,4 +17,6 @@ spring: ...@@ -17,4 +17,6 @@ spring:
# 默认false,设为true表示使用注册中心中的配置服务(服务发现)而不自己指定配置服务的地址(即uri) # 默认false,设为true表示使用注册中心中的配置服务(服务发现)而不自己指定配置服务的地址(即uri)
enabled: true enabled: true
# 指向配置中心在consul注册的服务名称(即:spring.application.name) # 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id: config-service service-id: config-service
\ No newline at end of file username: ${CONFIG_SERVER_USERNAME:admin}
password: ${CONFIG_SERVER_PASSWORD:11}
\ No newline at end of file
...@@ -39,10 +39,18 @@ ...@@ -39,10 +39,18 @@
</filter> </filter>
</appender> </appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
&lt;!&ndash; logstash的IP和端口,从环境变量注入 &ndash;&gt;
<destination>${ELK_DESTINATION}</destination>
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>-->
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 --> <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="info"> <root level="info">
<appender-ref ref="console"/> <appender-ref ref="console"/>
<appender-ref ref="debug"/> <appender-ref ref="debug"/>
<appender-ref ref="error"/> <appender-ref ref="error"/>
<!--<appender-ref ref="logstash"/>-->
</root> </root>
</configuration> </configuration>
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>spring-microservice-exam</name> <name>spring-microservice-exam</name>
<description>微服务在线考试系统</description> <description>微服务在线考试系统</description>
<url>https://gitee.com/wells2333/spring-micoservices-exam.git</url> <url>https://gitee.com/wells2333/spring-micoservices-exam.git</url>
...@@ -32,11 +30,13 @@ ...@@ -32,11 +30,13 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version> <version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<properties> <properties>
<!-- 版本号 -->
<revision>3.2.0-SNAPSHOT</revision>
<!-- 编译 --> <!-- 编译 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
...@@ -45,18 +45,17 @@ ...@@ -45,18 +45,17 @@
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<!-- spring boot、spring cloud --> <!-- spring boot、spring cloud -->
<spring-boot.version>2.1.3.RELEASE</spring-boot.version> <spring-boot.version>2.1.7.RELEASE</spring-boot.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version> <spring-cloud.version>Greenwich.SR2</spring-cloud.version>
<security.auth.version>2.3.5.RELEASE</security.auth.version> <security.auth.version>2.3.5.RELEASE</security.auth.version>
<spring-boot-admin.version>2.1.3</spring-boot-admin.version> <spring-boot-admin.version>2.1.6</spring-boot-admin.version>
<spring-cloud-sleuth.version>2.1.0.RELEASE</spring-cloud-sleuth.version> <spring-cloud-sleuth.version>2.1.0.RELEASE</spring-cloud-sleuth.version>
<zipkin.version>2.11.3</zipkin.version> <zipkin.version>2.11.3</zipkin.version>
<swagger.version>2.9.2</swagger.version> <swagger.version>2.9.2</swagger.version>
<fastdfs-client.version>1.26.5</fastdfs-client.version> <fastdfs-client.version>1.26.5</fastdfs-client.version>
<mysql.connector.version>8.0.13</mysql.connector.version> <mysql.connector.version>8.0.13</mysql.connector.version>
<!-- common--> <!-- common -->
<commons-io.version>2.6</commons-io.version> <commons-io.version>2.6</commons-io.version>
<commons-lang3.version>3.7</commons-lang3.version>
<commons-collections4.version>4.0</commons-collections4.version> <commons-collections4.version>4.0</commons-collections4.version>
<commons-beanutils.version>1.9.2</commons-beanutils.version> <commons-beanutils.version>1.9.2</commons-beanutils.version>
...@@ -79,6 +78,9 @@ ...@@ -79,6 +78,9 @@
<docker.registry>registry.cn-hangzhou.aliyuncs.com</docker.registry> <docker.registry>registry.cn-hangzhou.aliyuncs.com</docker.registry>
<docker.namespace>spring-microservice-exam</docker.namespace> <docker.namespace>spring-microservice-exam</docker.namespace>
<scanner.maven.version>3.3.0.603</scanner.maven.version> <scanner.maven.version>3.3.0.603</scanner.maven.version>
<!-- logstash -->
<logstash.version>5.2</logstash.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -141,6 +143,13 @@ ...@@ -141,6 +143,13 @@
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
</dependency> </dependency>
<!-- logstash -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logstash.version}</version>
</dependency>
</dependencies> </dependencies>
<!-- spring cloud base --> <!-- spring cloud base -->
...@@ -165,56 +174,56 @@ ...@@ -165,56 +174,56 @@
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common-core</artifactId> <artifactId>common-core</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- common-security --> <!-- common-security -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common-security</artifactId> <artifactId>common-security</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- common-feign --> <!-- common-feign -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common-feign</artifactId> <artifactId>common-feign</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- common-log --> <!-- common-log -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>common-log</artifactId> <artifactId>common-log</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- user-service-api --> <!-- user-service-api -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>user-service-api</artifactId> <artifactId>user-service-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- auth-service-api --> <!-- auth-service-api -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>auth-service-api</artifactId> <artifactId>auth-service-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- exam-service-api --> <!-- exam-service-api -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>exam-service-api</artifactId> <artifactId>exam-service-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- msc-service-api --> <!-- msc-service-api -->
<dependency> <dependency>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>msc-service-api</artifactId> <artifactId>msc-service-api</artifactId>
<version>${project.version}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- 管理中心插件 --> <!-- 管理中心插件 -->
......
sonar.projectKey=spring-microservice-exam sonar.projectKey=spring-microservice-exam
sonar.projectName=spring-microservice-exam sonar.projectName=spring-microservice-exam
sonar.projectVersion=3.1.0 sonar.projectVersion=3.2.0-SNAPSHOT
sonar.sources= sonar.sources=
sonar.binaries=bin sonar.binaries=bin
sonar.language=java sonar.language=java
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.github.tangyi</groupId> <groupId>com.github.tangyi</groupId>
<artifactId>spring-microservice-exam</artifactId> <artifactId>spring-microservice-exam</artifactId>
<version>3.1.0</version> <version>${revision}</version>
</parent> </parent>
<artifactId>zipkin-service</artifactId> <artifactId>zipkin-service</artifactId>
<packaging>pom</packaging> <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