From 591242c76c16ac5adc993ea5ac087d6b99acc4fd Mon Sep 17 00:00:00 2001 From: jhaol Date: Thu, 3 Aug 2023 11:55:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0docker-compose.yml?= =?UTF-8?q?=E3=80=81=E6=B7=BB=E5=8A=A0system=E3=80=81infra=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 162 ++++++++++++++++++ .../admin/health/HealthController.java | 27 +++ .../admin/health/HealthController.java | 27 +++ 3 files changed, 216 insertions(+) create mode 100644 docker/docker-compose.yml create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..2b1e1fa34 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,162 @@ +version: '3' +services: + yudao-gateway: + image: yudao-gateway + container_name: yudao-gateway + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host # 以主机网络环境运行 + yudao-system: + image: yudao-module-system-biz + container_name: yudao-system + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + healthcheck: + test: [ "CMD","curl","-f","http://localhost:48081" ] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s + restart: always + network_mode: host + yudao-infra: + image: yudao-module-infra-biz + container_name: yudao-infra + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + healthcheck: + test: [ "CMD","curl","-f","http://localhost:48082" ] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s + depends_on: + yudao-system: + condition: service_healthy + yudao-report: + image: yudao-module-report-biz + container_name: yudao-report + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy + yudao-bpm: + image: yudao-module-bpm-biz + container_name: yudao-bpm + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy + yudao-pay: + image: yudao-module-pay-biz + container_name: yudao-pay + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy + yudao-mp: + image: yudao-module-mp-biz + container_name: yudao-mp + environment: + - TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间) + - JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking + - SW_AGENT_NAME=yudao-gateway + - SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/** + - SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址 + - SPRING_PROFILES_ACTIVE=test # 指定程序运行环境 + - SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址 + - SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + - SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址 + - SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间 + volumes: + - /docker/yudao-cloud/logs:/root/logs/ + - /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent + restart: always + network_mode: host + depends_on: + yudao-infra: + condition: service_healthy \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java new file mode 100644 index 000000000..a490ecace --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/health/HealthController.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.infra.controller.admin.health; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.security.PermitAll; + +/** + * @description: 健康检查 + * @author: jhaol + */ +@Tag(name = "infra 模块 - 健康检查") +@RestController +@RequestMapping("/infra/health") +@Validated +public class HealthController { + @GetMapping() + @Operation(summary = "健康检查") + @PermitAll + public Integer health() { + return 0; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java new file mode 100644 index 000000000..d57888327 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/health/HealthController.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.system.controller.admin.health; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.security.PermitAll; + +/** + * @description: 健康检查 + * @author: jhaol + */ +@Tag(name = "system 模块 - 健康检查") +@RestController +@RequestMapping("/system/health") +@Validated +public class HealthController { + @GetMapping() + @Operation(summary = "健康检查") + @PermitAll + public Integer health() { + return 0; + } +}