TommyBs
TommyBs

Reputation: 9646

Chef custom cookbook not installing on AWS opsworks

Off the back of this question Chef - How to run a cookbook locally I'm trying to get a custom cookbook working on AWS opsworks. As I stated in the previous question I am new to Chef, but I am using a cookbook built by someone else https://github.com/k-kinzal/chef-php-phalcon

However when I add this to my instance as a custom cookbook, nothing gets installed. From the logs it appears the cookbook is retrieved and moved to the correct location but then the bottom of the log looks like

[2016-02-16T18:48:54+00:00] INFO: Forking chef instance to converge...
[2016-02-16T18:48:54+00:00] INFO: *** Chef 12.6.0 ***
[2016-02-16T18:48:54+00:00] INFO: Chef-client pid: 2237
[2016-02-16T18:48:59+00:00] INFO: Setting the run_list to ["recipe[php-phalcon::default]"] from CLI options
[2016-02-16T18:48:59+00:00] INFO: Run List is [recipe[php-phalcon::default]]
[2016-02-16T18:48:59+00:00] INFO: Run List expands to [php-phalcon::default]
[2016-02-16T18:48:59+00:00] INFO: Starting Chef Run for app2
[2016-02-16T18:48:59+00:00] INFO: Running start handlers
[2016-02-16T18:48:59+00:00] INFO: Start handlers complete.
[2016-02-16T18:48:59+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: 
[2016-02-16T18:48:59+00:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: git

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: git

Expanded Run List:
------------------
* php-phalcon::default

[2016-02-16T18:48:59+00:00] ERROR: Running exception handlers
[2016-02-16T18:48:59+00:00] ERROR: Exception handlers complete
[2016-02-16T18:48:59+00:00] FATAL: Stacktrace dumped to /var/chef/runs/a9eb7a78-2544-413b-aeae-075c959c98ca/local-mode-cache/cache/chef-stacktrace.out
[2016-02-16T18:48:59+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-02-16T18:48:59+00:00] ERROR: 412 "Precondition Failed"
[2016-02-16T18:49:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

I'm not entirely sure what I should be doing here, git is on the machine so I'm not sure why that precondition fails. I've seen 'Berks' crop up a lot. Based on my previous questions should I be able to run this recipe locally on machine, then run Berks to package everything up and use that as my cookbook for opsworks?

I'm using Chef 12 for this

thanks

Upvotes: 1

Views: 933

Answers (2)

Goke Obasa
Goke Obasa

Reputation: 4898

Just like @coderanger said, you can include your dependencies in a Berkshelf file in the repo.

I already added a Berkshelf file - https://github.com/k-kinzal/chef-php-phalcon/blob/master/Berksfile to the repo and the pull request has been merged - https://github.com/k-kinzal/chef-php-phalcon/pull/5#discussion_r53566061.

You will need to set Manage Berkshelf on your Opsworks stack to Yes to allow you use the Berkshelf file to resolve dependencies.

Upvotes: 2

coderanger
coderanger

Reputation: 54191

You need to include all the dependencies of the php-phalcon cookbook in your OpsWorks config. You can find these in the metadata.rb file. Berkshelf is a cookbook downloader that understands dependencies internally, and is probably the right choice to compile things but I don't know the new OpsWorks stacks well enough to say for sure.

Upvotes: 1

Related Questions