引入nacos支持
All checks were successful
test/timeline-server/pipeline/head This commit looks good

This commit is contained in:
2026-01-05 17:33:10 +08:00
parent 44dfd655db
commit 7f086da244

118
Jenkinsfile vendored
View File

@@ -181,7 +181,6 @@ def getDockerfileContent(serviceDir) {
// 生成docker-compose文件内容的函数
def getComposeFileContent(buildNumber) {
if (params.DEPLOY_ENV == 'prod') {
return """version: '3.8'
services:
@@ -192,8 +191,8 @@ services:
- "30001:30001"
environment:
- server.port=30001
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.cloud.nacos.discovery.server-addr=host.docker.internal:8848
- spring.cloud.nacos.config.server-addr=host.docker.internal:8848
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
@@ -212,8 +211,8 @@ services:
- "30002:30002"
environment:
- server.port=30002
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.cloud.nacos.discovery.server-addr=host.docker.internal:8848
- spring.cloud.nacos.config.server-addr=host.docker.internal:8848
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
@@ -231,8 +230,8 @@ services:
- "30003:30003"
environment:
- server.port=30003
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.cloud.nacos.discovery.server-addr=host.docker.internal:8848
- spring.cloud.nacos.config.server-addr=host.docker.internal:8848
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
@@ -253,108 +252,8 @@ services:
- "33333:30000"
environment:
- server.port=30000
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.cloud.gateway.routes[0].id=story-service
- spring.cloud.gateway.routes[0].uri=lb://timeline-story
- spring.cloud.gateway.routes[0].predicates[0]=Path=/story/**
- spring.cloud.gateway.routes[0].filters[0]=StripPrefix=0
- spring.cloud.gateway.routes[1].id=file-service
- spring.cloud.gateway.routes[1].uri=lb://timeline-file
- spring.cloud.gateway.routes[1].predicates[0]=Path=/file/**
- spring.cloud.gateway.routes[1].filters[0]=StripPrefix=0
- spring.cloud.gateway.routes[2].id=user-service
- spring.cloud.gateway.routes[2].uri=lb://timeline-user
- spring.cloud.gateway.routes[2].predicates[0]=Path=/user/**
- spring.cloud.gateway.routes[2].filters[0]=StripPrefix=0
- spring.cloud.gateway.routes[3].id=user-service-ws
- spring.cloud.gateway.routes[3].uri=lb://timeline-user
- spring.cloud.gateway.routes[3].predicates[0]=Path=/user/ws/**
- spring.cloud.gateway.routes[3].filters[0]=StripPrefix=0
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
- spring.data.redis.host=host.docker.internal
- spring.data.redis.port=36379
- spring.data.redis.password=123456
extra_hosts:
- "host.docker.internal:host-gateway"
"""
} else {
// 开发和预发布环境
return """version: '3.8'
services:
timeline-story-service:
image: timeline-registry:5000/timeline-story-service:${buildNumber}
container_name: timeline-story-service
ports:
- "30001:30001"
environment:
- server.port=30001
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
- spring.data.redis.host=host.docker.internal
- spring.data.redis.port=36379
- spring.data.redis.password=123456
- file.service.url=http://timeline-file-service:30002/file/
- user.service.url=http://timeline-user-service:30003/user/
extra_hosts:
- "host.docker.internal:host-gateway"
timeline-file-service:
image: timeline-registry:5000/timeline-file-service:${buildNumber}
container_name: timeline-file-service
ports:
- "30002:30002"
environment:
- server.port=30002
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
- minio.endpoint=http://host.docker.internal:9000
- minio.accessKey=9ttSGjvQxek2uKKlhpqI
- minio.secretKey=12CaKew53tu94tgyDLoqAwAq32iDuz3SWW0O1hex
- minio.bucketName=timeline-test
extra_hosts:
- "host.docker.internal:host-gateway"
timeline-user-service:
image: timeline-registry:5000/timeline-user-service:${buildNumber}
container_name: timeline-user-service
ports:
- "30003:30003"
environment:
- server.port=30003
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.datasource.url=jdbc:mysql://host.docker.internal:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- spring.datasource.password=WoCloud@9ol7uj
- spring.data.redis.host=host.docker.internal
- spring.data.redis.port=36379
- spring.data.redis.password=123456
extra_hosts:
- "host.docker.internal:host-gateway"
timeline-gateway-service:
image: timeline-registry:5000/timeline-gateway-service:${buildNumber}
container_name: timeline-gateway-service
depends_on:
- timeline-story-service
- timeline-file-service
- timeline-user-service
ports:
- "33333:30000"
environment:
- server.port=30000
- spring.cloud.nacos.discovery.server-addr=nacos:8848
- spring.cloud.nacos.config.server-addr=nacos:8848
- spring.cloud.nacos.discovery.server-addr=host.docker.internal:8848
- spring.cloud.nacos.config.server-addr=host.docker.internal:8848
- spring.cloud.gateway.routes[0].id=story-service
- spring.cloud.gateway.routes[0].uri=lb://timeline-story
- spring.cloud.gateway.routes[0].predicates[0]=Path=/story/**
@@ -381,4 +280,3 @@ services:
- "host.docker.internal:host-gateway"
"""
}
}