I'm just getting started with Chef and have gone through the tutorials on their site, however everything seems to assume you'd be configuring a chef server etc. for the deploy
I'm currently in the process of setting up a site on AWS opsworks so I wanted to use Chef for the configuration and installing dependencies. As such I believe I just supply a path to my cookbook. Now before I launch into Opsworks I was trying to create my cookbook on an ubuntu VM and test that it installs everything correctly.
I know that for a single script I can use the chef-client file.rb
command to run it, but how can I run a cookbook on a local machine in a similar fashion? I've tried
chef-client chef-repo
But this errors, even when using the basic 'motd' example
I've tried searching for examples, but as I say I'm new to Chef so I'm not sure if the terminology I'm searching for is correct.
Is this even the correct approach for developing for Opsworks with Chef?
Thanks
OpsWorks is a hosted product of Amazon Web Services, there is no local development environment for it. You would have to create an EC2 instance and use it for testing et al. Unfortunately Amazon has rejected most of the Chef ecosystem tools, so while OpsWorks is powered by Chef it is also a very different beast.
For normal Chef outside of OpsWorks you would use Test Kitchen for this kind of thing, it handles creating a test VM using Vagrant or another system (docker, ec2, etc), installing Chef, running your cookbook(s), and then running some tests.
Check : How are people testing opsworks cookbooks?
Amazon doc said :
Packaging Cookbook Dependencies Locally
You can use Berkshelf to package your cookbook dependencies locally,
upload the package to Amazon S3, and modify your stack to use the
package on Amazon S3 as a cookbook source. Content delivered to Amazon
S3 buckets might contain customer content. For more information about
removing sensitive data, see How Do I Empty an S3 Bucket? or How Do I
Delete an S3 Bucket?.
The following walkthroughs describe how to pre-package your cookbooks
and their dependencies into a .zip file, and then use the .zip file as
your cookbook source for Linux instances in AWS OpsWorks Stacks. The
first walkthrough describes how to package one cookbook. The second
walkthrough describes how to package multiple cookbooks.
Before you begin, install the Chef Development Kit (also known as Chef
DK), which is an assortment of tools built by the Chef community. You
will need this to use the chef command-line tool.
https://docs.aws.amazon.com/opsworks/latest/userguide/best-practices-packaging-cookbooks-locally.html