Home  >  Q&A  >  body text

ruby - 有没有一种方式让我同时部署多个不同项目到不同的服务器上面去呢?

情况是这个样子:
"A"是开发机,
"B"是用来专门放开发项目的服务器,
"C,D,E...等 "是其它人要访问的服务器对外

现在有多个项目我需要部署到多台服务器上面去,现在我的方法是使用"capistrano"

1: 在A新建一个部署项目"deploy"让其来发送指令,使C,D,E..服务器到"B"服务器上下载项目

2: 以前我部署的时候是进到deploy中然后进到对应的项目进行 cap production deploy 来部署

3: 现在我要想用一个项目来专门负责部署类似"deploy"但是我想同时部署多个项目到多台服务器上去.

4: 所以我想问请教一下,是否有那么一个机制"同时部署多项目到多台服务器上"

5:我听说过caphub 但是还没有怎么领会其用法,还有其它的方法吗?

大家讲道理大家讲道理2713 days ago630

reply all(2)I'll reply

  • 阿神

    阿神2017-04-21 10:59:49

    As long as you can ssh to operate the remote machine, you can change it to the command you want to execute

    for i in 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4 ; do
        ssh root@$i 'cd /path/to; git pull; supervisor reload'
    done;

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-21 10:59:49

    @yanyaoer The method used is the simplest shell implementation. The disadvantage is that the whole process is queued and not concurrent. You can use some concurrency gadgets such as pssh onall, which can be very complete and have other great uses and result feedback. It is also very easy to operate more server command operations at the same time.

    reply
    0
  • Cancelreply