【问题标题】:OpsWorks: Cookbook httpd not found on recipe runOpsWorks:食谱运行时未找到食谱 httpd
【发布时间】:2016-04-26 15:24:28
【问题描述】:

我刚刚开始在 AWS 上与 Chef 和 OpsWorks 合作,努力改进我们的基础设施。

我在尝试运行我设置的配方时遇到了一些问题(我认为)一些非常基本的事情(设置 httpd 等)。

在配置内容实际运行之前,我一直遇到包含配方的问题。

这是我得到的错误:

================================================================================
Recipe Compile Error in /var/lib/aws/opsworks/cache.stage2/cookbooks/Tokeniser/recipes/default.rb
================================================================================


Chef::Exceptions::CookbookNotFound
----------------------------------
Cookbook httpd not found. If you're loading httpd from another cookbook, make sure you configure the dependency in your metadata


Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/Tokeniser/recipes/default.rb:12:in `from_file'


Relevant File Content:
----------------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/Tokeniser/recipes/default.rb:

5:  # Copyright (C) 2016 YOUR_NAME
6:  #
7:  # All rights reserved - Do Not Redistribute
8:  #
9:  
10:  include_recipe("deploy")
11:  include_recipe("php")
12>> include_recipe("httpd")
13:  
14:  package 'apache2' do
15:    case node[:platform]
16:    when 'centos','redhat','fedora','amazon'
17:      package_name 'httpd'
18:    when 'debian','ubuntu'
19:      package_name 'apache2'
20:    end
21:    action :install

这是在我的根目录中已经有一个 berksfile 之后,它包括:

source "https://supermarket.chef.io"

metadata

cookbook 'httpd', '~> 0.3.3'
cookbook 'php', '~> 1.7.2'
cookbook 'magic_shell', '~> 1.0.0'
cookbook 'composer', '~> 2.2.1'

失败日志甚至记录了正在获取的httpd 配方:

[2016-01-20T16:18:17+00:00] INFO: 
Resolving cookbook dependencies...
Fetching 'Tokeniser' from source at .
Fetching cookbook index from https://supermarket.chef.io...
Using Tokeniser (0.1.0) from source at .
Installing build-essential (2.2.4) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing chef-sugar (3.3.0) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing chef_handler (1.2.0) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing compat_resource (12.5.26) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing composer (2.2.1) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing httpd (0.3.3) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing iis (4.1.5) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing magic_shell (1.0.0) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing mysql (6.1.2) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing php (1.7.2) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing rbac (1.0.3) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing smf (2.2.7) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing windows (1.39.1) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing xml (2.0.0) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing yum (3.9.0) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing yum-epel (0.6.5) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Installing yum-mysql-community (0.1.21) from https://supermarket.chef.io ([opscode] https://supermarket.chef.io:443/api/v1)
Vendoring Tokeniser (0.1.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/Tokeniser
Vendoring build-essential (2.2.4) to /opt/aws/opsworks/current/berkshelf-cookbooks/build-essential
Vendoring chef-sugar (3.3.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/chef-sugar
Vendoring chef_handler (1.2.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/chef_handler
Vendoring compat_resource (12.5.26) to /opt/aws/opsworks/current/berkshelf-cookbooks/compat_resource
Vendoring composer (2.2.1) to /opt/aws/opsworks/current/berkshelf-cookbooks/composer
Vendoring httpd (0.3.3) to /opt/aws/opsworks/current/berkshelf-cookbooks/httpd
Vendoring iis (4.1.5) to /opt/aws/opsworks/current/berkshelf-cookbooks/iis
Vendoring magic_shell (1.0.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/magic_shell
Vendoring mysql (6.1.2) to /opt/aws/opsworks/current/berkshelf-cookbooks/mysql
Vendoring php (1.7.2) to /opt/aws/opsworks/current/berkshelf-cookbooks/php
Vendoring rbac (1.0.3) to /opt/aws/opsworks/current/berkshelf-cookbooks/rbac
Vendoring smf (2.2.7) to /opt/aws/opsworks/current/berkshelf-cookbooks/smf
Vendoring windows (1.39.1) to /opt/aws/opsworks/current/berkshelf-cookbooks/windows
Vendoring xml (2.0.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/xml
Vendoring yum (3.9.0) to /opt/aws/opsworks/current/berkshelf-cookbooks/yum
Vendoring yum-epel (0.6.5) to /opt/aws/opsworks/current/berkshelf-cookbooks/yum-epel
Vendoring yum-mysql-community (0.1.21) to /opt/aws/opsworks/current/berkshelf-cookbooks/yum-mysql-community

如您所见,php 也是必需的,但不会出现错误。

我看不出我做错了什么。我大概是个白痴吧。任何帮助或想法表示赞赏。

【问题讨论】:

标签: chef-infra chef-recipe berkshelf aws-opsworks


【解决方案1】:

IIUYC 您需要将 http cookbook 依赖项添加到 Tokeniser cookbook metadata.rb 文件,而不是 Berksfile:

# Tokeniser/metadata.rb

 depends 'httpd', '~> 0.3.3'

这同样适用于 phpdeploy 食谱,记得将它们放在元数据文件中。

【讨论】:

  • 如果从外部(超市)获取,也需要 Berksfile
【解决方案2】:

所以我终于找到了答案,因为我在 OpsWorks 的 Chef 12 版本上运行,它不使用服务器上的 Berkshelf,并且要求您使用 berks package 打包您的食谱,而不是从 git 加载repo,除非你只有一本说明书或者不使用 berkshelf 来管理依赖关系。

亚马逊文档很难找到,但在这里:http://docs.aws.amazon.com/opsworks/latest/userguide/best-practices-packaging-cookbooks-locally.html

【讨论】:

    猜你喜欢
    • 2015-01-14
    • 1970-01-01
    • 1970-01-01
    • 2018-03-20
    • 2015-12-19
    • 2021-11-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-01
    相关资源
    最近更新 更多