【问题标题】:capify-ec2 cap deploy:migrate db no servers matchingcapify-ec2 cap deploy:migrate db 没有匹配的服务器
【发布时间】:2014-12-09 04:34:03
【问题描述】:

我无法执行cap deploy:migrate。错误信息是:

2014-10-14 10:01:15 executing `deploy:migrate'
executing "ls -x /home/pj-production/projectname/releases"
`deploy:migrate' is only run for servers matching {:roles=>:db, :only=>{:primary=>true}}, but no servers matched

设置:

导轨 (3.2.13)

capistrano (2.14.2)

capify-ec2 (1.1.6)

cap ec2:status

Project: PROJECTNAME.
Num Name     ID   Type     DNS                                    Zone       Roles
00: worker01 i-1 t1.micro  ec2-x1.eu-west-1.compute.amazonaws.com eu-west-1b worker
01: db01     i-d m1.medium ec2-x2.eu-west-1.compute.amazonaws.com eu-west-1b
02: web01    i-f m1.medium ec2-x3.eu-west-1.compute.amazonaws.com eu-west-1b web,app,db

在 deploy.rb 中:

ec2_roles name: :web, options: { default: true }
ec2_roles name: :app, options: { default: true }
ec2_roles name: :db, options: { default: true }
ec2_roles name: :worker, options: { default: true }

deploy.rb 中有部分带有

task :start, roles: :app do
  run "cd #{current_path} && bundle exec unicorn -c config/unicorn/production.conf.rb -E production -D"
end

工作,例如当我执行一个:cap deploy,它运行并完成。

可能是什么问题? 我用谷歌和堆栈中的其他问题进行了搜索。但无法让它运行。 我没有使用多级 btw 和 deploy.rb 的 gist 文件:https://gist.github.com/ADogan/2121d312c5938746acd6

【问题讨论】:

    标签: ruby-on-rails amazon-web-services deployment amazon-ec2 capistrano


    【解决方案1】:

    对于具有以下角色的 ec2 实例:“web,app,db”,您需要在 AWS 中添加一个具有单个值“primary”的“选项”标签。这相当于有一个 config/deploy/env.rb 行:

    role :db, "10.1.2.3", :primary => true
    

    Deploy 有效,因为如果没有与角色“db”匹配的框,其中 primary 为 true,它将跳过 db:migrate。您特别要求它到 db:migrate,如果没有可以运行它的框,它将失败。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-27
      • 2018-12-17
      • 1970-01-01
      • 2015-02-19
      • 1970-01-01
      • 2016-04-24
      • 2011-06-05
      相关资源
      最近更新 更多