尝试使用数据库食谱时厨师独奏私钥丢失 [英] chef solo private key missing when trying to use database cookbook

查看:82
本文介绍了尝试使用数据库食谱时厨师独奏私钥丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我我在做什么错。我试图单独使用Chef来部署Rails堆栈。我正在使用数据库食谱。我有两个角色,网络服务器和最后附带的sparkle_database_master。

Can anyone tell me what I'm doing wrong here. I am trying to use chef solo to deploy a rails stack. I am using the database cookbook. I have two roles webserver & sparkle_database_master that are attached at the end.

我的命令行:

knife solo cook --identity-file=/home/sburke/.ssh/sab-sburke-sparkle.pem -r "role[sparkle_database_master], role[webserver]" -E production ubuntu@54.173.103.4

输出:
=========================== ================================================== ===
/home/ubuntu/chef-solo/cookbooks-2/database/recipes/master.rb中的配方编译错误
============== ================================================== =============

Output: ================================================================================ Recipe Compile Error in /home/ubuntu/chef-solo/cookbooks-2/database/recipes/master.rb ================================================================================

Chef::Exceptions::PrivateKeyMissing
-----------------------------------
I cannot read /etc/chef/client.pem, which you told me to use to sign requests!

Cookbook Trace:
---------------
  /home/ubuntu/chef-solo/cookbooks-2/database/recipes/master.rb:30:in `from_file'

Relevant File Content:
----------------------
/home/ubuntu/chef-solo/cookbooks-2/database/recipes/master.rb:

 23:  # will win out, so make sure the databags have the same passwords set for
 24:  # the root, repl, and debian-sys-maint users.
 25:  #
 26:  
 27:  db_info = {}
 28:  root_pw = ''
 29:  
 30>> search(:apps) do |app|
 31:    (app['database_master_role'] & node.run_list.roles).each do |dbm_role|
 32:      %w(root repl debian).each do |user|
 33:        user_pw = app["mysql_#{user}_password"]
 34:        if !user_pw.nil? && user_pw[node.chef_environment]
 35:          Chef::Log.debug("Saving password for #{user} as node attribute node['mysql']['server_#{user}_password'")
 36:          node.set['mysql']["server_#{user}_password"] = user_pw[node.chef_environment]
 37:          node.save
 38:        else
 39:          log "A password for MySQL user #{user} was not found in DataBag 'apps' item '#{app["id"]}' for environment ' for #{node.chef_environment}'." do


Running handlers:
[2014-11-15T08:38:44+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-11-15T08:38:44+00:00] ERROR: Exception handlers complete
[2014-11-15T08:38:44+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 1.24174155 seconds
[2014-11-15T08:38:44+00:00] ERROR: I cannot read /etc/chef/client.pem, which you told me to use to sign requests!
[2014-11-15T08:38:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.
sburke@sewer:~/sandbox/sparkle-kitchen$ knife solo cook --identity-file=/home/sburke/.ssh/sab-sburke-sparkle.pem -r "role[sparkle_database_master], role[webserver]" -E production ubuntu@54.173.103.4

sparkle_database_master角色

sparkle_database_master role

{
    "name": "sparkle_database_master",
    "default_attributes": {
        "postgresql": {
            "password": {
                "postgres": "md586643717dc6cb1111610b853bf48efbb"
            },
            "config": {
                "listen_addresses": "localhost",
                "port": "5432"
            }
        }
    },
    "json_class": "Chef::Role",

    "env_run_lists": {
        "production": ["recipe[postgresql::server]",
                       "recipe[database::master]",
                       "recipe[database::postgresql]"
                      ]
    },
    "chef_type": "role",
    "override_attributes": {
        "postgresql": {
            "password": {
                "postgres": "md586643717dc6cb1111610b853bf48efbb"
            },
            "config": {
                "listen_addresses": "localhost",
                "port": "5432"
            }
        }
    }
}

网络服务器角色

{
  "name": "webserver",
  "default_attributes": {
  },
  "json_class": "Chef::Role",
  "env_run_lists": {
    "production": ["recipe[build-essential::default]",
                   "recipe[apache2]",
                   "recipe[apache2::mod_ssl]",
                   "recipe[apache2::mod_rewrite]",
                   "recipe[apache2::mod_deflate]",
                   "recipe[apache2::mod_headers]",
                   "recipe[nodejs]",
                   "recipe[sparkle]"
                  ],
    "test": [ "role[base]", "recipe[apache2]", "recipe[apache::copy_test_configs]" ],
    "dev": [ "role[base]", "recipe[apache2]", "recipe[apache::copy_dev_configs]" ]
  },
  "run_list": [ "role[base]",
                "recipe[build-essential::default]",
                "recipe[apache2]",
                "recipe[apache2::mod_ssl]" ],
  "description": "The webserver role",
  "chef_type": "role",
  "override_attributes": {
      "passenger": {
          "install_method": "package",
          "package": {
              "name": "libapache2-mod-passenger"
          }
      }
  }
}


推荐答案

虽然 database :: master 配方目前与Chef-solo不兼容它可能是。使用 chef-client --local chef-solo-search 食谱,或修补食谱以使其不使用搜索API。

The database::master recipe is not currently compatible with chef-solo, though it could be. Either use chef-client --local or the chef-solo-search cookbook, or patch the cookbook to not use the search API.

这篇关于尝试使用数据库食谱时厨师独奏私钥丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆