谁能告诉我这里我做错了什么。我正在尝试使用Chef solo来部署rails堆栈。我正在使用数据库cookbook。我有两个角色webserver&最后附加的sparkle_database_master。
我的命令行:
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中的配方编译错误 ================================================== ==============================
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角色
{
"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"
}
}
}
}
答案 0 :(得分:2)
database::master
食谱目前与chef-solo不兼容,尽管可能如此。使用chef-client --local
或chef-solo-search
食谱,或修补食谱不使用搜索API。