Giter Club home page Giter Club logo

Comments (6)

ZhouYixun avatar ZhouYixun commented on July 28, 2024

请问是怎么升级的呢?pom中的releaseMode是什么?后面更改的文件有同步吗?yml文件也请展示下

from sonic-agent.

ZhouYixun avatar ZhouYixun commented on July 28, 2024

https://github.com/SonicCloudOrg/sonic-agent/blob/main/src/main/java/org/cloud/sonic/agent/transport/TransportConnectionThread.java 你这个文件是不是自己改动过?可以附上这个文件截图和yml截图,另外请问server是本地部署吗?

from sonic-agent.

mocobk avatar mocobk commented on July 28, 2024

文件没有改动,我是这样操作的

  1. 容器部署最新的 2.3.0 server 端
  2. pull agent 代码并check 到 tag 2.3.0
  3. 配置 yml 文件
  4. 启动agent
    然后就一直报上面的连接问题,如果把 agent 代码切换到 2.0.5 则能正常连接,从release 包下载的 2.3.0 agent 也可以

TransportConnectionThread.java

package org.cloud.sonic.agent.transport;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.cloud.sonic.agent.tools.SpringTool;

import java.net.URI;
import java.util.concurrent.TimeUnit;

/**
 * @author Eason
 * @date 2022/6/12 02:45
 */
@Slf4j
public class TransportConnectionThread implements Runnable {
    /**
     * second
     */
    public static final long DELAY = 10;

    public static final String THREAD_NAME = "transport-connection-thread";

    public static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;

    String serverHost = String.valueOf(SpringTool.getPropertiesValue("sonic.server.host"));
    Integer serverPort = Integer.valueOf(SpringTool.getPropertiesValue("sonic.server.port"));
    String key = String.valueOf(SpringTool.getPropertiesValue("sonic.agent.key"));

    boolean isRelease = Boolean.valueOf(SpringTool.getPropertiesValue("sonic.release-mode"));

    @Override
    public void run() {
        Thread.currentThread().setName(THREAD_NAME);
        if (TransportWorker.client == null) {
            if (!TransportWorker.isKeyAuth) {
                return;
            }
            String url = String.format("ws://%s:%d%s/websockets/agent/%s",
                    serverHost, serverPort, isRelease ? "/server" : "", key).replace(":80/", "/");
            URI uri = URI.create(url);
            TransportClient transportClient = new TransportClient(uri);
            transportClient.connect();
        } else {
            JSONObject ping = new JSONObject();
            ping.put("msg", "ping");
            TransportWorker.send(ping);
        }
    }
}

application-sonic-agent.yml

sonic:
  agent:
    # Replace with ipv4 of the agent machine | 替换为部署Agent机器的ipv4
    host: 10.91.xx.xx
    # Replace with the port of the agent service, which can be changed by yourself | 替换为Agent服务的端口,可以自行更改
    port: 7777
    # Replace with the key of agent generated by the new front-end | 替换为前端新增Agent生成的key
    key: 02aa2ca9-xxxx-abc808f178b5
  server:
    # Change to SONIC_SERVER_HOST of server | 改成server的SONIC_SERVER_HOST
    host: 9.134.xx.xx
    # Change to SONIC_SERVER_PORT of server | 改成server的SONIC_SERVER_PORT
    port: 3000

modules:
  android:
    # Whether to enable Android module | 是否开启安卓模块
    enable: true
    # Whether to enable sonic-android-supply module | 是否开启sonic-android-supply功能
    use-sas: true
  ios:
    # Whether to turn on the iOS module. Please ensure that iTunes is installed on this computer for Windows users | 是否开启iOS模块。开启的windows用户请确保本机已安装iTunes
    enable: true
    # Replace with the bundleId of wda. If there is no. xcrunner suffix, it will be automatically completed. | 替换为wda的bundleId,如果没有.xctrunner后缀会自动补全
    wda-bundle-id: com.sonic.WebDriverAgentRunner
  sgm:
    # Whether to enable the sonic-go-mitmproxy module | 是否开启sonic-go-mitmproxy功能
    enable: true

from sonic-agent.

mocobk avatar mocobk commented on July 28, 2024

找到问题的解决方法了,pom.xml 文件中修改releaseMode 为 true, 虽然不是很明白,但解决了 @ZhouYixun

    <properties>
        <platform>macosx-x86_64</platform>
        <releaseMode>false</releaseMode>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>

releaseMode 改为 true

    <properties>
        <platform>macosx-x86_64</platform>
        <releaseMode>true</releaseMode>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>

from sonic-agent.

mocobk avatar mocobk commented on July 28, 2024

应该是这里ws链接的问题
image

from sonic-agent.

ZhouYixun avatar ZhouYixun commented on July 28, 2024

并不是问题,如果你开发环境的Agent连接开发环境的server是不会有问题的,但是如果你开发环境的Agent连生产环境的server,需要pom.xml 文件中修改releaseMode 为 true

而官方部署文档,是生产环境的Agent连生产环境的Server,所以没问题

不过恭喜你解决问题,我这边先关闭issue,祝您使用愉快

from sonic-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.