简体   繁体   English

在AWS Opsworks中运行自定义食谱

[英]run custom cookbook in aws opsworks

I am pretty new to the AWS opsworks. 我对AWS opsworks很陌生。 Though I was using chef solo in some other cloud. 尽管我在其他云中使用了厨师独奏。

Currently I want to install my custom cookbook and I want to apply on my servers which is inside stack layer. 目前,我想安装我的自定义菜谱,并且想在堆栈层内部的服务器上应用它。 Currently I am really confused how it is working in AWS. 目前,我真的很困惑它在AWS中的工作方式。

Here are the steps i did so far - I have stored my test cookbook in github and I want to execute via chef-solo or chef-client for a test. 这是我到目前为止所做的步骤-我已将测试食谱存储在github中,并且希望通过Chef-solo或Chef-client执行以进行测试。 How ever I have added the cookbook github url in stack settings. 我如何在堆栈设置中添加Cookbook github url。 I also have added recipe in build life cycle. 我还在构建生命周期中添加了配方。

I do update cookbook via run command. 我通过运行命令来更新食谱。 I can see it is running via runlist after executing all available built-in cookbooks and chef run failing with error- 执行所有可用的内置食谱后,我可以看到它正在通过运行列表运行,并且厨师运行失败并出现错误-

no cookbook found test-cookbook 找不到菜谱测试菜谱

I have not configured any Json either in cookbook or while running via command. 我没有在食谱中或通过命令运行时配置任何Json。 Is there anything missing? 缺少什么吗?

  • Use berkshelf to create a Berksfile 使用berkshelf创建Berksfile
  • Run berks package cookbooks.tar.gz 运行berks package cookbooks.tar.gz
  • Upload cookbooks.tar.gz to AWS S3 将cookbooks.tar.gz上传到AWS S3
  • In stack settings point 'Use Custom Cookbooks' to the S3 bucket 在堆栈设置中,将“使用自定义菜谱”指向S3存储桶
  • Run Update Cookbooks command 运行更新食谱命令
  • Run deploy or custom recipe you're looking to execute 运行您要执行的部署或自定义配方

Thomas V's answer assumes that you want to use an AWS S3 instance. Thomas V的答案假设您要使用AWS S3实例。 Newer Opsworks installs provide the option to reference a custom Github cookbook repo. 较新的Opsworks安装提供了引用自定义Github食谱存储库的选项。 Instead of pointing the stack (via stack settings) to an S3 bucket, you can use the Berks package command to grab all dependencies for your custom cookbook, which can then be uploaded to your Github repo and referenced by the stack. 您可以使用Berks软件包命令获取自定义菜谱的所有依赖关系,而不必将栈(通过栈设置)指向S3存储桶,然后将其上载到Github存储库中并由栈引用。

From there, you should be able to use the OpsWorks options to run your custom cookbook after the required cycle (Setup, Configure, Deploy etc) by going to Layers > Recipes and adding it there. 从那里,您应该能够使用OpsWorks选项在所需的周期(设置,配置,部署等)之后运行您的自定义菜谱,方法是转到“ 图层”>“食谱”并将其添加到其中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM