【问题标题】:Capistrano: multiserver deploy output is messed upCapistrano:多服务器部署输出混乱
【发布时间】:2017-04-28 13:33:59
【问题描述】:

这是 3 个服务器部署的示例输出:

00:06 git:clone
  The repository mirror is at /home/production/site/repo
  The repository mirror is at /home/production/site/repo
  The repository mirror is at /home/production/site/repo

输出中的所有行都搞砸了,我们不知道它们在哪些服务器上执行。

如何将其格式化为:

00:06 git:clone
  production@server1: The repository mirror is at /home/production/site/repo
  production@server2: The repository mirror is at /home/production/site/repo
  production@server3: The repository mirror is at /home/production/site/repo

【问题讨论】:

    标签: ruby deployment capistrano


    【解决方案1】:

    Capistrano 的默认输出是根据Airbrussh gem 格式化的,目的是使输出简洁。

    如果您喜欢更详细的输出,请尝试使用pretty 格式化程序,将以下行添加到您的deploy.rb

    set :format, :pretty
    

    该格式化程序将为每行输出添加一个对每个服务器都是唯一的 ID。

    【讨论】:

      【解决方案2】:

      在您的 capistrano gem 文件夹中搜索 lib/capistrano/tasks/git.rake 文件。它有这样的方法

        desc 'Clone the repo to the cache'
        task clone: :'git:wrapper' do
          on release_roles :all do
            if strategy.test
              info t(:mirror_exists, at: repo_path)
            else
              within deploy_path do
                with fetch(:git_environmental_variables) do
                  strategy.clone
                end
              end
            end
          end
        end
      

      修改

      info t(:mirror_exists, at: repo_path)
      

      如你所愿。 我不知道服务器名称变量在哪里。但你现在的方式是对的。

      【讨论】:

      • 如果我想将服务器添加到所有 capistrano 任务中该怎么办?
      猜你喜欢
      • 2014-05-26
      • 2011-08-26
      • 2012-07-20
      • 2012-07-09
      • 1970-01-01
      • 2017-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多