Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-microservice-exam
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
汪想
spring-microservice-exam
Commits
639cde34
Commit
639cde34
authored
Aug 18, 2019
by
tangyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升级spring boot、cloud版本,配置中心认证,elk
parent
58cdf68b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
61 changed files
with
315 additions
and
90 deletions
+315
-90
CHANGELOG.md
CHANGELOG.md
+8
-0
README.md
README.md
+2
-2
pom.xml
common/common-core/pom.xml
+1
-1
pom.xml
common/common-feign/pom.xml
+1
-1
pom.xml
common/common-log/pom.xml
+1
-1
pom.xml
common/common-security/pom.xml
+1
-1
pom.xml
common/pom.xml
+1
-1
pom.xml
config-service/pom.xml
+7
-1
bootstrap.yml
config-service/src/main/resources/bootstrap.yml
+7
-0
auth-service.yml
config-service/src/main/resources/config/auth-service.yml
+5
-2
exam-service.yml
config-service/src/main/resources/config/exam-service.yml
+3
-0
gateway-service.yml
config-service/src/main/resources/config/gateway-service.yml
+3
-0
monitor-service.yml
config-service/src/main/resources/config/monitor-service.yml
+3
-1
msc-service.yml
config-service/src/main/resources/config/msc-service.yml
+11
-8
user-service.yml
config-service/src/main/resources/config/user-service.yml
+3
-0
logback.xml
config-service/src/main/resources/logback.xml
+8
-0
docker-compose-base.yml
docker-compose-base.yml
+2
-2
docker-compose-elk.yml
docker-compose-elk.yml
+14
-0
docker-compose-nginx.yml
docker-compose-nginx.yml
+3
-3
docker-compose-services.yml
docker-compose-services.yml
+7
-7
docker-compose.env
docker-compose.env
+15
-7
02-beats-input.conf
docs/deploy/elk/02-beats-input.conf
+12
-0
microservice-auth.sql
docs/deploy/mysql/init/microservice-auth.sql
+1
-1
microservice-exam.sql
docs/deploy/mysql/init/microservice-exam.sql
+0
-0
microservice-gateway.sql
docs/deploy/mysql/init/microservice-gateway.sql
+5
-4
microservice-user.sql
docs/deploy/mysql/init/microservice-user.sql
+9
-5
start.sh
docs/deploy/start.sh
+1
-1
README.md
gateway-service/README.md
+6
-0
pom.xml
gateway-service/pom.xml
+1
-1
Filters.java
...c/main/java/com/github/tangyi/gateway/module/Filters.java
+33
-0
Predicates.java
...ain/java/com/github/tangyi/gateway/module/Predicates.java
+33
-0
bootstrap.yml
gateway-service/src/main/resources/bootstrap.yml
+2
-0
logback.xml
gateway-service/src/main/resources/logback.xml
+8
-0
pom.xml
modules/auth-service-parent/auth-service-api/pom.xml
+1
-1
pom.xml
modules/auth-service-parent/auth-service/pom.xml
+1
-1
bootstrap.yml
...vice-parent/auth-service/src/main/resources/bootstrap.yml
+3
-7
logback.xml
...ervice-parent/auth-service/src/main/resources/logback.xml
+8
-0
pom.xml
modules/auth-service-parent/pom.xml
+1
-1
pom.xml
modules/exam-service-parent/exam-service-api/pom.xml
+1
-1
pom.xml
modules/exam-service-parent/exam-service/pom.xml
+1
-1
bootstrap.yml
...vice-parent/exam-service/src/main/resources/bootstrap.yml
+3
-0
logback.xml
...ervice-parent/exam-service/src/main/resources/logback.xml
+8
-0
pom.xml
modules/exam-service-parent/pom.xml
+1
-1
pom.xml
modules/msc-service-parent/msc-service-api/pom.xml
+1
-1
pom.xml
modules/msc-service-parent/msc-service/pom.xml
+1
-1
bootstrap.yml
...rvice-parent/msc-service/src/main/resources/bootstrap.yml
+3
-0
logback.xml
...service-parent/msc-service/src/main/resources/logback.xml
+8
-0
pom.xml
modules/msc-service-parent/pom.xml
+1
-1
pom.xml
modules/pom.xml
+1
-1
pom.xml
modules/user-service-parent/pom.xml
+1
-1
pom.xml
modules/user-service-parent/user-service-api/pom.xml
+1
-1
pom.xml
modules/user-service-parent/user-service/pom.xml
+1
-1
LogController.java
...java/com/github/tangyi/user/controller/LogController.java
+2
-0
bootstrap.yml
...vice-parent/user-service/src/main/resources/bootstrap.yml
+2
-0
logback.xml
...ervice-parent/user-service/src/main/resources/logback.xml
+8
-0
pom.xml
monitor-service/pom.xml
+1
-1
bootstrap.yml
monitor-service/src/main/resources/bootstrap.yml
+3
-0
logback.xml
monitor-service/src/main/resources/logback.xml
+8
-0
pom.xml
pom.xml
+26
-17
sonar-project.properties
sonar-project.properties
+1
-1
pom.xml
zipkin-service/pom.xml
+1
-1
No files found.
CHANGELOG.md
View file @
639cde34
Version v3.2.0-SNAPSHOT (2019-8-18)
--------------------------
改进:
*
升级spring boot、spring cloud版本
*
配置中心增加安全控制
*
集成elk
Version v3.1.0 (2019-7-18)
--------------------------
改进:
...
...
README.md
View file @
639cde34
...
...
@@ -64,8 +64,8 @@ QQ群号:996208878
| 名称 | 版本 |
| --------- | -------- |
|
`Spring Boot`
|
`2.1.
3
.RELEASE`
|
|
`Spring Cloud`
|
`Greenwich.SR
1
`
|
|
`Spring Boot`
|
`2.1.
7
.RELEASE`
|
|
`Spring Cloud`
|
`Greenwich.SR
2
`
|
## 系统架构
...
...
common/common-core/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
common-core
</artifactId>
<name>
${project.artifactId}
</name>
...
...
common/common-feign/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
common-feign
</artifactId>
<name>
${project.artifactId}
</name>
...
...
common/common-log/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
common-log
</artifactId>
<name>
${project.artifactId}
</name>
...
...
common/common-security/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
common-security
</artifactId>
<name>
${project.artifactId}
</name>
...
...
common/pom.xml
View file @
639cde34
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
common
</artifactId>
<packaging>
pom
</packaging>
...
...
config-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
config-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
@@ -19,6 +19,12 @@
<artifactId>
spring-cloud-config-server
</artifactId>
</dependency>
<!-- security -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<!-- 管理中心插件 -->
<dependency>
<groupId>
de.codecentric
</groupId>
...
...
config-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -8,6 +8,10 @@ spring:
profiles
:
# 指定为native,开启本地存储配置的方式,spring cloud微服务配置中心默认有3种方式:远程git仓库、远程SVN、本地方式(本地目录)
active
:
${SPRING_PROFILES_ACTIVE:native}
security
:
user
:
name
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
# spring boot admin配置
boot
:
admin
:
...
...
@@ -17,6 +21,9 @@ spring:
password
:
${ADMIN_PASSWORD:11}
instance
:
service-base-url
:
http://${CONFIG_SERVICE_HOST:localhost}:${server.port}
metadata
:
tags
:
environment
:
prd
# 使用consul作为注册中心
cloud
:
consul
:
...
...
config-service/src/main/resources/config/auth-service.yml
View file @
639cde34
...
...
@@ -23,6 +23,9 @@ spring:
password
:
${ADMIN_PASSWORD:11}
instance
:
service-base-url
:
http://${AUTH_SERVICE_HOST:localhost}:${server.port}
metadata
:
tags
:
environment
:
prd
# sleuth 配置
sleuth
:
web
:
...
...
@@ -125,8 +128,8 @@ sys:
# 微信配置
wx
:
appId
:
wx597d9f972f991a8c
appSecret
:
b5d44266271a08c6f75a347712a7334e
appId
:
test
appSecret
:
test
grantType
:
authorization_code
logging
:
...
...
config-service/src/main/resources/config/exam-service.yml
View file @
639cde34
...
...
@@ -23,6 +23,9 @@ spring:
password
:
${ADMIN_PASSWORD:11}
instance
:
service-base-url
:
http://${EXAM_SERVICE_HOST:localhost}:${server.port}
metadata
:
tags
:
environment
:
prd
# sleuth 配置
sleuth
:
web
:
...
...
config-service/src/main/resources/config/gateway-service.yml
View file @
639cde34
...
...
@@ -32,6 +32,9 @@ spring:
password
:
${ADMIN_PASSWORD:11}
instance
:
service-base-url
:
http://${GATEWAY_SERVICE_HOST:localhost}:${server.port}
metadata
:
tags
:
environment
:
prd
# sleuth 配置
sleuth
:
web
:
...
...
config-service/src/main/resources/config/monitor-service.yml
View file @
639cde34
...
...
@@ -25,7 +25,9 @@ spring:
instance
:
service-base-url
:
http://${MONITOR_HOST:localhost}:${server.port}
discovery
:
ignored-services
:
consul
# 或略consul服务
ignored-services
:
consul
# 忽略consul服务
ui
:
title
:
monitor-service
# sleuth 配置
sleuth
:
web
:
...
...
config-service/src/main/resources/config/msc-service.yml
View file @
639cde34
...
...
@@ -17,6 +17,9 @@ spring:
password
:
${ADMIN_PASSWORD:11}
instance
:
service-base-url
:
http://${AUTH_SERVICE_HOST:localhost}:${server.port}
metadata
:
tags
:
environment
:
prd
# sleuth 配置
sleuth
:
web
:
...
...
@@ -83,14 +86,14 @@ management:
# 短信配置
sms
:
appKey
:
appKey
appSecret
:
appSecret
regionId
:
default
domain
:
dysmsapi.aliyuncs.com
signName
:
在线考试系统演示
templateCode
:
SMS_171192294
version
:
2017-05-25
action
:
SendSms
appKey
:
${SMS_APP_KEY:test}
appSecret
:
${SMS_APP_SECRET:test}
regionId
:
${SMS_REGION_ID:default}
domain
:
${SMS_DOMAIN:dysmsapi.aliyuncs.com}
signName
:
${SMS_SIGN_NAME:test}
templateCode
:
${SMS_TEMP_CODE:SMS_171192294}
version
:
${SMS_VERSION:2017-05-25}
action
:
${SMS_ACTION:SendSms}
ignore
:
urls
:
...
...
config-service/src/main/resources/config/user-service.yml
View file @
639cde34
...
...
@@ -29,6 +29,9 @@ spring:
password
:
${ADMIN_PASSWORD:11}
instance
:
service-base-url
:
http://${USER_SERVICE_HOST:localhost}:${server.port}
metadata
:
tags
:
environment
:
prd
# sleuth 配置
sleuth
:
web
:
...
...
config-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
docker-compose-base.yml
View file @
639cde34
version
:
'
2
'
version
:
'
3
'
services
:
# ---------------------------
# consul集群,3个节点
...
...
@@ -70,7 +70,7 @@ services:
# 配置中心
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
docker-compose-elk.yml
0 → 100644
View file @
639cde34
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
docker-compose-nginx.yml
View file @
639cde34
version
:
'
2
'
version
:
'
3
'
services
:
# ---------------------------
# 前台
# ---------------------------
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
:
# 挂载nginx的配置文件
-
./nginx.conf:/etc/nginx/nginx.conf
...
...
@@ -20,7 +20,7 @@ services:
# 后台
# ---------------------------
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
:
# 挂载nginx的配置文件
-
./nginx.conf:/etc/nginx/nginx.conf
...
...
docker-compose-services.yml
View file @
639cde34
version
:
'
2
'
version
:
'
3
'
services
:
# ---------------------------
# api网关
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
@@ -17,7 +17,7 @@ services:
# 授权服务
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
@@ -30,7 +30,7 @@ services:
# 用户服务
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
@@ -43,7 +43,7 @@ services:
# 考试服务
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
@@ -56,7 +56,7 @@ services:
# 消息服务
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
@@ -69,7 +69,7 @@ services:
# 监控服务
# ---------------------------
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
env_file
:
docker-compose.env
# 从文件中获取配置
restart
:
always
...
...
docker-compose.env
View file @
639cde34
# JVM参数
# 可通过docker-compose -f docker-compose-services.yml config命令查看是否生效
JAVA_OPTS=-Xmx
512m -Xms256
m
JAVA_OPTS=-Xmx
128m -Xms128
m
# 租户标识,默认gitee
TENANT_CODE=gitee
# 网关token转换
GATEWAY_TOKEN_TRANSFER=
tru
e
GATEWAY_TOKEN_TRANSFER=
fals
e
# 环境配置
SPRING_PROFILES_ACTIVE=native
...
...
@@ -26,17 +26,21 @@ REDIS_HOST=redis
REDIS_PORT=6379
# 数据库配置
MYSQL_HOST=
localhost
MYSQL_HOST=
mysql
MYSQL_PORT=3306
MYSQL_USERNAME=
platform
MYSQL_USERNAME=
root
MYSQL_PASSWORD=11
# FDFS配置
FDFS_HOST=
localhost
FDFS_HOST=
fdfs
FDFS_PORT=22122
# 配置中心的账号密码
CONFIG_SERVER_USERNAME=admin
CONFIG_SERVER_PASSWORD=11
# 附件服务器配置
ATTACHMENT_HOST=http:
#localhost
ATTACHMENT_HOST=http:
//attachment-service:8080
ATTACHMENT_PORT=80
# 各服务host配置
...
...
@@ -54,7 +58,7 @@ ADMIN_USERNAME=admin
ADMIN_PASSWORD=11
# zipkin配置
ZIPKIN_HOST=
localhost
ZIPKIN_HOST=
zipkin-service
ZIPKIN_PORT=9411
# 演示环境
...
...
@@ -66,3 +70,6 @@ CLUSTER_DATA_CENTER_ID=1
# 时区设置,否则容器里的时间和主机时间差8小时
TZ=Asia/Shanghai
# elk配置
ELK_DESTINATION=localhost:5044
\ No newline at end of file
docs/deploy/elk/02-beats-input.conf
0 → 100644
View file @
639cde34
input
{
tcp
{
port
=>
5044
codec
=>
json_lines
}
}
output
{
elasticsearch
{
hosts
=> [
"localhost:9200"
]
}
}
\ No newline at end of file
docs/deploy/mysql/init/microservice-auth.sql
View file @
639cde34
...
...
@@ -11,7 +11,7 @@
Target Server Version : 50617
File Encoding : 65001
Date:
04/07/2019 14:36:21
Date:
18/08/2019 20:10:54
*/
SET
NAMES
utf8mb4
;
...
...
docs/deploy/mysql/init/microservice-exam.sql
View file @
639cde34
This diff is collapsed.
Click to expand it.
docs/deploy/mysql/init/microservice-gateway.sql
View file @
639cde34
...
...
@@ -11,7 +11,7 @@
Target Server Version : 50617
File Encoding : 65001
Date: 18/0
7/2019 23:06:58
Date: 18/0
8/2019 20:10:40
*/
SET
NAMES
utf8mb4
;
...
...
@@ -42,8 +42,9 @@ CREATE TABLE `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
(
'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
(
'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
(
'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'
,
'3'
,
'0'
,
'admin'
,
'2019-04-02 21:39:30'
,
''
,
'2019-08-03 09:58:54'
,
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
;
docs/deploy/mysql/init/microservice-user.sql
View file @
639cde34
...
...
@@ -11,7 +11,7 @@
Target Server Version : 50617
File Encoding : 65001
Date: 18/0
7/2019 23:06:48
Date: 18/0
8/2019 20:10:33
*/
SET
NAMES
utf8mb4
;
...
...
@@ -627,6 +627,7 @@ CREATE TABLE `sys_user` (
`login_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
,
`family_role`
int
(
11
)
NULL
DEFAULT
NULL
,
`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
'创建时间'
,
`modifier`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'修改人'
,
...
...
@@ -640,10 +641,11 @@ CREATE TABLE `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
(
'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
(
'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
(
'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
(
'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
,
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
,
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
,
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
...
...
@@ -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
(
'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
(
'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
...
...
@@ -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
(
'596820924016234496'
,
'596307222997372928'
,
'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
...
...
docs/deploy/start.sh
View file @
639cde34
...
...
@@ -5,7 +5,7 @@ DOCKERHOME=/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
...
...
gateway-service/README.md
View file @
639cde34
...
...
@@ -31,3 +31,8 @@ server {
}
}
```
# 后续计划
1.
filters和predicates入库
2.
服务多实例部署,支持流量切换、灰度发布、ABTest,思路:基于服务标签(主、备)、权重方式实现
\ No newline at end of file
gateway-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
gateway-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
gateway-service/src/main/java/com/github/tangyi/gateway/module/Filters.java
0 → 100644
View file @
639cde34
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
;
}
gateway-service/src/main/java/com/github/tangyi/gateway/module/Predicates.java
0 → 100644
View file @
639cde34
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
;
}
gateway-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -17,3 +17,5 @@ spring:
enabled
:
true
# 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id
:
config-service
username
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
gateway-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
modules/auth-service-parent/auth-service-api/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
auth-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
auth-service-api
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/auth-service-parent/auth-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
auth-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
auth-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/auth-service-parent/auth-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -18,15 +18,11 @@ spring:
enabled
:
true
# 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id
:
config-service
username
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
# jwt加密配置
encrypt
:
key-store
:
location
:
classpath:/jwt.jks
alias
:
jwt
password
:
abc123
\ No newline at end of file
logging
:
level
:
root
:
info
com.github.tangyi
:
debug
\ No newline at end of file
modules/auth-service-parent/auth-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
modules/auth-service-parent/pom.xml
View file @
639cde34
...
...
@@ -10,7 +10,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
modules
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
auth-service-parent
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/exam-service-parent/exam-service-api/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
exam-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
exam-service-api
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/exam-service-parent/exam-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
exam-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
exam-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/exam-service-parent/exam-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -17,3 +17,5 @@ spring:
enabled
:
true
# 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id
:
config-service
username
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
\ No newline at end of file
modules/exam-service-parent/exam-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
modules/exam-service-parent/pom.xml
View file @
639cde34
...
...
@@ -10,7 +10,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
modules
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
exam-service-parent
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/msc-service-parent/msc-service-api/pom.xml
View file @
639cde34
...
...
@@ -7,7 +7,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
msc-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
msc-service-api
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/msc-service-parent/msc-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
msc-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
msc-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/msc-service-parent/msc-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -17,3 +17,5 @@ spring:
enabled
:
true
# 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id
:
config-service
username
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
\ No newline at end of file
modules/msc-service-parent/msc-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
modules/msc-service-parent/pom.xml
View file @
639cde34
...
...
@@ -10,7 +10,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
modules
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
msc-service-parent
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
modules
</artifactId>
<packaging>
pom
</packaging>
...
...
modules/user-service-parent/pom.xml
View file @
639cde34
...
...
@@ -10,7 +10,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
modules
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
user-service-parent
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/user-service-parent/user-service-api/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
user-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
user-service-api
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/user-service-parent/user-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
user-service-parent
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
user-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
modules/user-service-parent/user-service/src/main/java/com/github/tangyi/user/controller/LogController.java
View file @
639cde34
...
...
@@ -100,6 +100,8 @@ public class LogController extends BaseController {
public
ResponseBean
<
Boolean
>
addLog
(
@RequestBody
@Valid
Log
log
)
{
if
(
StringUtils
.
isBlank
(
log
.
getId
()))
log
.
setCommonValue
(
SysUtil
.
getUser
(),
SysUtil
.
getSysCode
(),
SysUtil
.
getTenantCode
());
if
(
true
)
return
null
;
// 保存日志
return
new
ResponseBean
<>(
logService
.
insert
(
log
)
>
0
);
}
...
...
modules/user-service-parent/user-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -18,3 +18,5 @@ spring:
enabled
:
true
# 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id
:
config-service
username
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
modules/user-service-parent/user-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
monitor-service/pom.xml
View file @
639cde34
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
monitor-service
</artifactId>
<name>
${project.artifactId}
</name>
...
...
monitor-service/src/main/resources/bootstrap.yml
View file @
639cde34
...
...
@@ -18,3 +18,5 @@ spring:
enabled
:
true
# 指向配置中心在consul注册的服务名称(即:spring.application.name)
service-id
:
config-service
username
:
${CONFIG_SERVER_USERNAME:admin}
password
:
${CONFIG_SERVER_PASSWORD:11}
\ No newline at end of file
monitor-service/src/main/resources/logback.xml
View file @
639cde34
...
...
@@ -39,10 +39,18 @@
</filter>
</appender>
<!-- 输出到logstash的appender -->
<!-- <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<!– logstash的IP和端口,从环境变量注入 –>
<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 -->
<root
level=
"info"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug"
/>
<appender-ref
ref=
"error"
/>
<!--<appender-ref ref="logstash"/>-->
</root>
</configuration>
pom.xml
View file @
639cde34
...
...
@@ -3,12 +3,10 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
<packaging>
pom
</packaging>
<name>
spring-microservice-exam
</name>
<description>
微服务在线考试系统
</description>
<url>
https://gitee.com/wells2333/spring-micoservices-exam.git
</url>
...
...
@@ -32,11 +30,13 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.1.
3
.RELEASE
</version>
<version>
2.1.
7
.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<!-- 版本号 -->
<revision>
3.2.0-SNAPSHOT
</revision>
<!-- 编译 -->
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
...
...
@@ -45,18 +45,17 @@
<maven.compiler.source>
${java.version}
</maven.compiler.source>
<maven.compiler.target>
${java.version}
</maven.compiler.target>
<!-- spring boot、spring cloud -->
<spring-boot.version>
2.1.
3
.RELEASE
</spring-boot.version>
<spring-cloud.version>
Greenwich.SR
1
</spring-cloud.version>
<spring-boot.version>
2.1.
7
.RELEASE
</spring-boot.version>
<spring-cloud.version>
Greenwich.SR
2
</spring-cloud.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>
<zipkin.version>
2.11.3
</zipkin.version>
<swagger.version>
2.9.2
</swagger.version>
<fastdfs-client.version>
1.26.5
</fastdfs-client.version>
<mysql.connector.version>
8.0.13
</mysql.connector.version>
<!-- common-->
<!-- common
-->
<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-beanutils.version>
1.9.2
</commons-beanutils.version>
...
...
@@ -79,6 +78,9 @@
<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>
<!-- logstash -->
<logstash.version>
5.2
</logstash.version>
</properties>
<dependencies>
...
...
@@ -141,6 +143,13 @@
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
<!-- logstash -->
<dependency>
<groupId>
net.logstash.logback
</groupId>
<artifactId>
logstash-logback-encoder
</artifactId>
<version>
${logstash.version}
</version>
</dependency>
</dependencies>
<!-- spring cloud base -->
...
...
@@ -165,56 +174,56 @@
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common-core
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- common-security -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common-security
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- common-feign -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common-feign
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- common-log -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
common-log
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- user-service-api -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
user-service-api
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- auth-service-api -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
auth-service-api
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- exam-service-api -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
exam-service-api
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- msc-service-api -->
<dependency>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
msc-service-api
</artifactId>
<version>
${
project.ver
sion}
</version>
<version>
${
revi
sion}
</version>
</dependency>
<!-- 管理中心插件 -->
...
...
sonar-project.properties
View file @
639cde34
sonar.projectKey
=
spring-microservice-exam
sonar.projectName
=
spring-microservice-exam
sonar.projectVersion
=
3.
1.0
sonar.projectVersion
=
3.
2.0-SNAPSHOT
sonar.sources
=
sonar.binaries
=
bin
sonar.language
=
java
...
...
zipkin-service/pom.xml
View file @
639cde34
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.github.tangyi
</groupId>
<artifactId>
spring-microservice-exam
</artifactId>
<version>
3.1.0
</version>
<version>
${revision}
</version>
</parent>
<artifactId>
zipkin-service
</artifactId>
<packaging>
pom
</packaging>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment