From 6d08c0383a177f0f6068fded65df1aa7c075c4ea Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Mon, 26 Aug 2024 13:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ludu-job-admin/ludu-job-admin-biz/run.sh | 2 +- .../ludu-module-datacenter-biz/run.sh | 6 ++--- .../framework/nacos/config/BeanInit.java | 27 +++++++++++++++++++ .../ludu-module-parking-biz/run.sh | 2 +- .../ludu-module-ticketing-biz/run.sh | 2 +- yudao-gateway/run.sh | 2 +- .../yudao-module-infra-biz/run.sh | 2 +- .../src/main/resources/application-local.yaml | 2 +- .../yudao-module-system-biz/run.sh | 2 +- 9 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/nacos/config/BeanInit.java diff --git a/ludu-job-admin/ludu-job-admin-biz/run.sh b/ludu-job-admin/ludu-job-admin-biz/run.sh index 0fb5eef26..be7481089 100644 --- a/ludu-job-admin/ludu-job-admin-biz/run.sh +++ b/ludu-job-admin/ludu-job-admin-biz/run.sh @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48084:9090 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 48084:9090 --name ${app_name} --memory 512m ${app_name}:${app_version} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/run.sh b/ludu-module-datacenter/ludu-module-datacenter-biz/run.sh index 82c06a65e..510b89f27 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/run.sh +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/run.sh @@ -1,6 +1,6 @@ -app_name='ludu-module-datacenter' +app_name='ludu-module-datacenter2' # 定义应用版本 -app_version='1.0.0' +app_version='2.0.0' # 定义应用环境 #profile_active='prod' echo '----stop container----' @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48092:48092 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 9091:48092 --name ${app_name} --memory 800m ${app_name}:${app_version} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/nacos/config/BeanInit.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/nacos/config/BeanInit.java new file mode 100644 index 000000000..dd9f3569f --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/nacos/config/BeanInit.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.datacenter.framework.nacos.config; + +import com.alibaba.cloud.nacos.NacosDiscoveryProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Configuration +public class BeanInit { + /** + * 用于改变程序自动获取的本机ip + */ + @Bean + @Primary + public NacosDiscoveryProperties nacosProperties() throws UnknownHostException { + NacosDiscoveryProperties nacosDiscoveryProperties = new NacosDiscoveryProperties(); + // 直接指定域名 + String customIp = "120.46.37.243"; // 替换为你的域名 + int customPort = 9091; // 替换为你的端口 + nacosDiscoveryProperties.setIp(customIp ); + nacosDiscoveryProperties.setPort(customPort); + return nacosDiscoveryProperties; + } +} diff --git a/ludu-module-parking/ludu-module-parking-biz/run.sh b/ludu-module-parking/ludu-module-parking-biz/run.sh index db3ed92c6..64fa58e03 100644 --- a/ludu-module-parking/ludu-module-parking-biz/run.sh +++ b/ludu-module-parking/ludu-module-parking-biz/run.sh @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48090:48090 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 48090:48090 --name ${app_name} --memory 600m ${app_name}:${app_version} \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/run.sh b/ludu-module-ticketing/ludu-module-ticketing-biz/run.sh index ab99420a0..30582006d 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/run.sh +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/run.sh @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48088:48088 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 48088:48088 --name ${app_name} --memory 600m ${app_name}:${app_version} \ No newline at end of file diff --git a/yudao-gateway/run.sh b/yudao-gateway/run.sh index 3ba20ba36..ded2b142b 100644 --- a/yudao-gateway/run.sh +++ b/yudao-gateway/run.sh @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48083:48080 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 48083:48080 --name ${app_name} --memory 512m ${app_name}:${app_version} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/run.sh b/yudao-module-infra/yudao-module-infra-biz/run.sh index 98c574ec0..849f01a20 100644 --- a/yudao-module-infra/yudao-module-infra-biz/run.sh +++ b/yudao-module-infra/yudao-module-infra-biz/run.sh @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48082:48082 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 48082:48082 --name ${app_name} --memory 700m ${app_name}:${app_version} \ No newline at end of file diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml index 166d766fa..158ebba27 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml @@ -66,7 +66,7 @@ spring: username: root password: 123456 ticketing: - url: jdbc:mysql://120.46.37.243:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://101.43.112.107:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 username: root password: xpower1234 diff --git a/yudao-module-system/yudao-module-system-biz/run.sh b/yudao-module-system/yudao-module-system-biz/run.sh index 11248bbb0..7423a438c 100644 --- a/yudao-module-system/yudao-module-system-biz/run.sh +++ b/yudao-module-system/yudao-module-system-biz/run.sh @@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version} echo '----build image----' docker buildx build -f Dockerfile -t ${app_name}:${app_version} . echo '----start container----' -docker run -d -p 48081:48081 --name ${app_name} ${app_name}:${app_version} \ No newline at end of file +docker run -d -p 48081:48081 --name ${app_name} --memory 700m ${app_name}:${app_version} \ No newline at end of file