Saurichthys
V2EX  ›  Java

各位大佬,请问类似 dubbo 或者 springcloud 是怎么部署的呀

  •  1
     
  •   Saurichthys · Jun 23, 2020 · 3246 views
    This topic created in 2150 days ago, the information mentioned may be changed or developed.

    都是相同的项目,只是部分端口号和参数配置不一致,要部署多个,请问怎么部署比较方便唉

    9 replies    2020-06-24 14:30:20 +08:00
    qinxi
        1
    qinxi  
       Jun 23, 2020
    docker / 启动参数改端口
    ixx
        2
    ixx  
       Jun 23, 2020
    有容器就使用容器替你管理实例个数,不用容器就手动部署就完了,或者写个脚本自动启动
    Saurichthys
        3
    Saurichthys  
    OP
       Jun 23, 2020
    @ixx 没有容器唉 那就是一个 jar 启动的时候传入不同的参数就完事了吗
    yinzhili
        4
    yinzhili  
       Jun 23, 2020
    启动参数就可以指定 profile: -Dspring.profiles.active=XXXX
    ixx
        5
    ixx  
       Jun 23, 2020
    @Saurichthys #3 可以像 4 楼说哪样把多个配置写在项目里 启动的时候指定 使用哪个配置就行了 也可以在外部写配置文件 启动的时候分别指定使用哪个启动
    koalr
        6
    koalr  
       Jun 23, 2020 via Android
    说个题外话 dubbo 刚出了一个反序列化漏洞💩
    Saurichthys
        7
    Saurichthys  
    OP
       Jun 23, 2020
    @ixx 花了一下午搞定了 写了个脚本 从外部输入配置信息
    @koalr 是吗 研究一下一下!!! 不过我们是内网的东西 应该影响不大
    jorneyr
        8
    jorneyr  
       Jun 23, 2020
    我使用 gradle ssh 插件进行部署:

    ```
    task deploy(dependsOn: bootJar) {
    def jar = bootJar.archiveFileName.get()
    def dir = config.getProperty('deploy.dir')
    def path = "${dir}/${jar}"
    def port = config.getProperty('deploy.port')

    doLast {
    ssh.run {
    session(remotes.server) {
    put from: "${buildDir}/libs/${jar}", into: "${path}.bak"
    execute """
    source /root/.bash_profile;
    kill `ps aux | grep -i ${jar} | grep -v grep | awk '{print \$2}'`;
    mv -f ${path}.bak ${path};
    nohup java -jar -Dfile.encoding=UTF-8 ${path} --server.port=${port} > /dev/null 2>&1 &
    """
    }
    }
    }
    }
    ```
    xxxyy2y
        9
    xxxyy2y  
       Jun 24, 2020
    集成下 jenkins 就好了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3017 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 15:19 · PVG 23:19 · LAX 08:19 · JFK 11:19
    ♥ Do have faith in what you're doing.