diff --git a/.gitignore b/.gitignore index 25e5e64..28c791c 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,9 @@ build/ ### mybatis plus generator -/generator/ \ No newline at end of file +/generator/ + +### Uploads ### +/uploads/ +### Logs ### +/logs/ \ No newline at end of file diff --git a/aioj-backend-auth/src/main/java/cn/meowrain/aioj/backend/auth/clients/UserClient.java b/aioj-backend-auth/src/main/java/cn/meowrain/aioj/backend/auth/clients/UserClient.java index b0e7c23..5fe0811 100644 --- a/aioj-backend-auth/src/main/java/cn/meowrain/aioj/backend/auth/clients/UserClient.java +++ b/aioj-backend-auth/src/main/java/cn/meowrain/aioj/backend/auth/clients/UserClient.java @@ -6,7 +6,7 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; -@FeignClient(name = "user-service", path = "/api/v1/user") +@FeignClient(name = "aioj-user-service", path = "/api/v1/user") public interface UserClient { @GetMapping("/inner/get-by-username") diff --git a/aioj-backend-auth/src/main/resources/application-dev.yml b/aioj-backend-auth/src/main/resources/application-dev.yml index 4880e1b..5854faf 100644 --- a/aioj-backend-auth/src/main/resources/application-dev.yml +++ b/aioj-backend-auth/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ spring: application: - name: auth-service + name: aioj-auth-service data: redis: host: 10.0.0.10 diff --git a/aioj-backend-auth/src/main/resources/application.yml b/aioj-backend-auth/src/main/resources/application.yml index 914ff8a..3ef233c 100644 --- a/aioj-backend-auth/src/main/resources/application.yml +++ b/aioj-backend-auth/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: application: - name: auth-service + name: aioj-auth-service profiles: active: @env@ devtools: @@ -36,4 +36,7 @@ jwt: enabled: true secret: "12345678901234567890123456789012" # 至少32字节!! access-expire: 900000 # 24小时 - refresh-expire: 604800000 # 7天 \ No newline at end of file + refresh-expire: 604800000 # 7天 +logging: + file: + path: ./logs/${spring.application.name} diff --git a/aioj-backend-auth/src/main/resources/logback-spring.xml b/aioj-backend-auth/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..8c32daa --- /dev/null +++ b/aioj-backend-auth/src/main/resources/logback-spring.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + INFO + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + ERROR + ACCEPT + DENY + + + + + + 0 + 512 + + + + 0 + 512 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/aioj-backend-file-service/src/main/resources/application.yml b/aioj-backend-file-service/src/main/resources/application.yml index 9860021..17be844 100644 --- a/aioj-backend-file-service/src/main/resources/application.yml +++ b/aioj-backend-file-service/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: application: - name: file-service + name: aioj-file-service profiles: active: @env@ servlet: diff --git a/aioj-backend-file-service/src/main/resources/logback-spring.xml b/aioj-backend-file-service/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..9c5ece5 --- /dev/null +++ b/aioj-backend-file-service/src/main/resources/logback-spring.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + INFO + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + ERROR + ACCEPT + DENY + + + + + + 0 + 512 + + + + 0 + 512 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/aioj-backend-gateway/src/main/resources/application.yml b/aioj-backend-gateway/src/main/resources/application.yml index 78bdf50..f2bc956 100644 --- a/aioj-backend-gateway/src/main/resources/application.yml +++ b/aioj-backend-gateway/src/main/resources/application.yml @@ -2,8 +2,9 @@ server: port: 18085 error: include-stacktrace: never - spring: + application: + name: aioj-backend-gateway profiles: active: @env@ cloud: @@ -13,28 +14,28 @@ spring: routes: # auth服务 Swagger 文档路由 - id: auth-service-doc - uri: lb://auth-service + uri: lb://aioj-auth-service predicates: - Path=/auth-service/** filters: - StripPrefix=1 # user服务 Swagger 文档路由 - id: user-service-doc - uri: lb://user-service + uri: lb://aioj-user-service predicates: - Path=/user-service/** filters: - StripPrefix=1 # auth服务 Swagger 文档路由 - id: file-service-doc - uri: lb://file-service + uri: lb://aioj-file-service predicates: - Path=/file-service/** filters: - StripPrefix=1 - # auth业务接口 + # auth业务接口路由 - id: auth-service - uri: lb://auth-service + uri: lb://aioj-auth-service predicates: - Path=/api/v1/auth/** filters: @@ -46,7 +47,7 @@ spring: firstBackoff: 50ms maxBackoff: 500ms - id: user-service - uri: lb://user-service + uri: lb://aioj-user-service predicates: - Path=/api/v1/user/** filters: @@ -58,7 +59,7 @@ spring: firstBackoff: 50ms maxBackoff: 500ms - id: file-service - uri: lb://file-service + uri: lb://aioj-file-service predicates: - Path=/api/v1/file/** filters: @@ -71,13 +72,14 @@ spring: maxBackoff: 500ms # 文件访问路由(公开,直接转发不去前缀) - id: file-access - uri: lb://file-service + uri: lb://aioj-file-service predicates: - Path=/api/file/** # 设置应用启动后的就绪探针 lifecycle: timeout-per-shutdown-phase: 30s + aioj-backend-gateway: # 白名单配置 white-list: @@ -93,3 +95,6 @@ aioj: log: enabled: true max-length: 20000 +logging: + file: + path: ./logs/${spring.application.name} diff --git a/aioj-backend-gateway/src/main/resources/logback-spring.xml b/aioj-backend-gateway/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..d2eb726 --- /dev/null +++ b/aioj-backend-gateway/src/main/resources/logback-spring.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + INFO + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + ERROR + ACCEPT + DENY + + + + + + 0 + 512 + + + + 0 + 512 + + + + + + + + + + + + + + + + + + + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/auth.log + + ${FILE_LOG_PATTERN} + UTF-8 + + + + + + \ No newline at end of file diff --git a/aioj-backend-user-service/src/main/resources/application.yml b/aioj-backend-user-service/src/main/resources/application.yml index acad1cb..bb01c8f 100644 --- a/aioj-backend-user-service/src/main/resources/application.yml +++ b/aioj-backend-user-service/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: application: - name: user-service + name: aioj-user-service profiles: active: @env@ server: @@ -42,4 +42,7 @@ jwt: aioj: log: enabled: true - max-length: 20000 \ No newline at end of file + max-length: 20000 +logging: + file: + path: ./logs/${spring.application.name} diff --git a/aioj-backend-user-service/src/main/resources/logback-spring.xml b/aioj-backend-user-service/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..8c32daa --- /dev/null +++ b/aioj-backend-user-service/src/main/resources/logback-spring.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + UTF-8 + + + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/info.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + INFO + + + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.log + + ${LOG_FILE_PATH}/${time-month}/${time-month-day}/error.%d{yyyy-MM-dd}.%i.log.gz + 100MB + 31 + 100GB + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + ERROR + ACCEPT + DENY + + + + + + 0 + 512 + + + + 0 + 512 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file