Browse Source

agent 中使用 127.0.0.1 替换 localhost

reghao 3 weeks ago
parent
commit
96699b8c12

+ 2 - 2
agent/src/main/java/cn/reghao/devops/agent/service/DeployJob.java

@@ -54,7 +54,7 @@ public class DeployJob  {
                 for (int i = 0; i < maxRetries; i++) {
                     try (Socket socket = new Socket()) {
                         // 仅检测 TCP 端口是否开放,无需 curl
-                        String host = "localhost";
+                        String host = "127.0.0.1";
                         socket.connect(new InetSocketAddress(host, appPort), 2000);
                         //healthCheck = true;
                     } catch (IOException e) {
@@ -67,7 +67,7 @@ public class DeployJob  {
                 runStep(ctx, DeployStepName.HEALTH_CHECK.name(), () -> {
                     try (Socket socket = new Socket()) {
                         // 仅检测 TCP 端口是否开放,无需 curl
-                        String host = "localhost";
+                        String host = "127.0.0.1";
                         socket.connect(new InetSocketAddress(host, appPort), 2000);
                         //healthCheck = true;
                     } catch (IOException e) {

+ 1 - 1
bin/agent/agent.json

@@ -1,3 +1,3 @@
 {
-  "wsUrl": "ws://localhost:4030"
+  "wsUrl": "ws://127.0.0.1:4030"
 }