fix: iot-gateway去除健康检查、nacos配置
This commit is contained in:
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
@@ -878,6 +878,25 @@ def deployService(String service) {
|
|||||||
|
|
||||||
// 等待服务健康
|
// 等待服务健康
|
||||||
def waitForServiceHealthy(String containerName, String serviceName, String sshOpts) {
|
def waitForServiceHealthy(String containerName, String serviceName, String sshOpts) {
|
||||||
|
// iot-gateway 是轻量化网关,不需要健康检查,只检查容器是否运行
|
||||||
|
if (serviceName == 'viewsh-module-iot-gateway') {
|
||||||
|
echo "⏳ Waiting for ${serviceName} to start (lightweight gateway, no health check)..."
|
||||||
|
sh """
|
||||||
|
ssh ${sshOpts} root@${env.DEPLOY_HOST} '
|
||||||
|
set -e
|
||||||
|
sleep 5
|
||||||
|
if docker ps | grep -q ${containerName}; then
|
||||||
|
echo "✅ ${serviceName} is running"
|
||||||
|
else
|
||||||
|
echo "❌ ${serviceName} is not running"
|
||||||
|
docker logs --tail 50 ${containerName} 2>/dev/null || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
def maxAttempts = env.HEALTH_CHECK_TIMEOUT.toInteger() / env.HEALTH_CHECK_INTERVAL.toInteger()
|
def maxAttempts = env.HEALTH_CHECK_TIMEOUT.toInteger() / env.HEALTH_CHECK_INTERVAL.toInteger()
|
||||||
|
|
||||||
echo "⏳ Waiting for ${serviceName} to be healthy (max ${env.HEALTH_CHECK_TIMEOUT}s)..."
|
echo "⏳ Waiting for ${serviceName} to be healthy (max ${env.HEALTH_CHECK_TIMEOUT}s)..."
|
||||||
@@ -934,6 +953,22 @@ def checkServiceHealthWithRetry(String service) {
|
|||||||
|
|
||||||
// 检查服务健康状态
|
// 检查服务健康状态
|
||||||
def checkServiceHealth(String containerName, String serviceName, String sshOpts) {
|
def checkServiceHealth(String containerName, String serviceName, String sshOpts) {
|
||||||
|
// iot-gateway 是轻量化网关,不需要健康检查,只检查容器是否运行
|
||||||
|
if (serviceName == 'viewsh-module-iot-gateway') {
|
||||||
|
sh """
|
||||||
|
ssh ${sshOpts} root@${env.DEPLOY_HOST} '
|
||||||
|
if docker ps | grep -q ${containerName}; then
|
||||||
|
echo "✅ ${serviceName} is running (lightweight gateway)"
|
||||||
|
else
|
||||||
|
echo "❌ ${serviceName} is not running"
|
||||||
|
docker logs --tail 50 ${containerName} 2>/dev/null || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
sh """
|
sh """
|
||||||
ssh ${sshOpts} root@${env.DEPLOY_HOST} '
|
ssh ${sshOpts} root@${env.DEPLOY_HOST} '
|
||||||
STATUS=\$(docker inspect --format="{{.State.Health.Status}}" ${containerName} 2>/dev/null || echo "not_found")
|
STATUS=\$(docker inspect --format="{{.State.Health.Status}}" ${containerName} 2>/dev/null || echo "not_found")
|
||||||
|
|||||||
@@ -188,18 +188,10 @@ services:
|
|||||||
image: ${REGISTRY_HOST:-localhost:5000}/viewsh-module-iot-gateway:${IMAGE_TAG:-latest}
|
image: ${REGISTRY_HOST:-localhost:5000}/viewsh-module-iot-gateway:${IMAGE_TAG:-latest}
|
||||||
container_name: aiot-iot-gateway
|
container_name: aiot-iot-gateway
|
||||||
restart: on-failure:5
|
restart: on-failure:5
|
||||||
ports:
|
|
||||||
- "48095:48095"
|
|
||||||
environment:
|
environment:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
SPRING_PROFILES_ACTIVE: prod
|
SPRING_PROFILES_ACTIVE: prod
|
||||||
JAVA_OPTS: "-Xms1024m -Xmx2048m -XX:+UseContainerSupport -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/logs"
|
JAVA_OPTS: "-Xms1024m -Xmx2048m -XX:+UseContainerSupport -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/logs"
|
||||||
|
|
||||||
NACOS_USERNAME: nacos
|
|
||||||
NACOS_PASSWORD: 9oDxX~}e7DeP
|
|
||||||
NACOS_ADDR: 172.17.16.14:8848
|
|
||||||
NACOS_DISCOVERY_NAMESPACE: "8efd6d96-de7f-4664-b28e-c2788ffa1395"
|
|
||||||
NACOS_CONFIG_NAMESPACE: "8efd6d96-de7f-4664-b28e-c2788ffa1395"
|
|
||||||
|
|
||||||
SPRING_DATA_REDIS_HOST: 172.17.16.14
|
SPRING_DATA_REDIS_HOST: 172.17.16.14
|
||||||
SPRING_DATA_REDIS_PASSWORD: "9kHXcZ1ojFsD"
|
SPRING_DATA_REDIS_PASSWORD: "9kHXcZ1ojFsD"
|
||||||
@@ -213,13 +205,6 @@ services:
|
|||||||
limits:
|
limits:
|
||||||
memory: 2560m
|
memory: 2560m
|
||||||
cpus: '1.5'
|
cpus: '1.5'
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:48095/actuator/health"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 12
|
|
||||||
start_period: 120s
|
|
||||||
depends_on:
|
depends_on:
|
||||||
viewsh-module-iot-server:
|
- viewsh-module-iot-server
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,7 @@
|
|||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 监控相关 -->
|
<!-- Web 相关(轻量化,仅提供基础 Web 抽象) -->
|
||||||
<dependency>
|
|
||||||
<groupId>com.viewsh</groupId>
|
|
||||||
<artifactId>viewsh-spring-boot-starter-monitor</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
|
|||||||
@@ -1,22 +1,3 @@
|
|||||||
--- #################### 注册中心 + 配置中心相关配置 ####################
|
|
||||||
|
|
||||||
spring:
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
server-addr: ${NACOS_ADDR:127.0.0.1:8848}
|
|
||||||
username: ${NACOS_USERNAME:nacos}
|
|
||||||
password: ${NACOS_PASSWORD:nacos}
|
|
||||||
discovery:
|
|
||||||
namespace: ${NACOS_DISCOVERY_NAMESPACE:prod}
|
|
||||||
group: DEFAULT_GROUP
|
|
||||||
metadata:
|
|
||||||
version: 1.0.0
|
|
||||||
config:
|
|
||||||
namespace: ${NACOS_CONFIG_NAMESPACE:prod}
|
|
||||||
group: DEFAULT_GROUP
|
|
||||||
file-extension: yaml
|
|
||||||
refresh-enabled: true
|
|
||||||
|
|
||||||
--- #################### 应用配置 ####################
|
--- #################### 应用配置 ####################
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
@@ -43,17 +24,6 @@ rocketmq:
|
|||||||
producer:
|
producer:
|
||||||
group: ${spring.application.name}_PRODUCER
|
group: ${spring.application.name}_PRODUCER
|
||||||
|
|
||||||
--- #################### 监控相关配置 ####################
|
|
||||||
|
|
||||||
management:
|
|
||||||
endpoints:
|
|
||||||
web:
|
|
||||||
exposure:
|
|
||||||
include: "*"
|
|
||||||
endpoint:
|
|
||||||
health:
|
|
||||||
show-details: always
|
|
||||||
|
|
||||||
--- #################### IoT 网关相关配置 ####################
|
--- #################### IoT 网关相关配置 ####################
|
||||||
|
|
||||||
viewsh:
|
viewsh:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ spring:
|
|||||||
config:
|
config:
|
||||||
import:
|
import:
|
||||||
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
||||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
# - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
||||||
|
|
||||||
# Redis 配置
|
# Redis 配置
|
||||||
data:
|
data:
|
||||||
|
|||||||
Reference in New Issue
Block a user