问题标签 [chef-solo]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
chef-infra - Vagrant and Knife Solo(或任何其他非 Vagrant Chef Env)的最佳常见工作流程?
离开 Chef 一段时间后,我目前正在回到它来满足我所有的服务器需求。几年前我已经使用了一段时间并且很喜欢它,但最近让其他人做了操作部分。
但是我仍然在努力寻找一个非常好的开始设置(本地 Vagrant+Chef)来进行开发。单独使用 Vagrant 是一件轻而易举的事,超级容易使用,并且在其上开发服务器设置相当快。但是一旦我不得不离开 Vagrant 进行实际部署,它就会再次变得烦人。我不能总是使用 Vagrant 盒子,但有时在某个地方使用 Rackspace 甚至是实际的硬件盒子。
现在我这样做如下:
针对 Vagrant 进行开发,尽量减少 Vagrantfile 中的实际配置
- 主要使用角色,并为我的常用环境预定义默认属性
- 仅在 Vagrantfile 中指定节点特定属性
- 在步骤之间直接从 VirtualBox 手动快照运行 vagrant 配置,以避免一直从头开始重新构建
暂存并实际部署服务器:
将 Rackspace Cloud(至少暂存)与 Knife Solo 一起使用
- 从 Web 界面创建 Rackspace 服务器以通过(roo@ip 和密码)为所有服务器提供一致的第一个配置步骤
- 将公钥身份验证添加到服务器,因此不再需要密码
- 为新服务器添加本地节点配置,复制 Vagrantfile 中定义的内容
- 使用刀单独准备+引导服务器
这已经不是那么糟糕了,但仍然有一些有时很烦人的小故障:
- 来自 VirtualBox 的 Vagrant 手动快照(我还没有找到任何可用的插件)
- 节点配置和 Vagrantfile 之间的冗余(可能让 Vagrantfile 解析节点配置并以这种方式使用值)
- Vagrant 和 Knife Solo 之间的引导不一致(如果我弄清楚如何将它添加到 Vagrant (*1),可能会为两者使用一个通用脚本)
除此之外,我不得不遗憾地发现,厨师的食谱已经广泛地成长为一个由不相容和固执己见的人工制品组成的丛林。有时甚至很难使用默认配方进行基本设置。我有点惊讶,很多基础知识都几乎没有涵盖:
让 sshd+iptables 的组合工作我花了一天的时间研究,然后仍然修改默认模板以使其工作 - 虽然我希望它成为几乎所有服务器的起点。此外,似乎没有任何默认的厨师用户工作流程。到目前为止,我发现的所有内容要么以 root 身份运行,要么需要进行相当多的修改。最后但并非最不重要的一点是,厨师(在 ubuntu 12.04 上)仍然使用 ruby 1.8.7,它在短短几个月内就即将结束。
可能是我只是没有找到合适的资源来涵盖我目前仍在努力或满意的所有要点,但似乎仍有很多方法可以改进它。
那么 vagrant + chef 如何在真实环境中(不仅仅是本地虚拟盒子)为您工作,还有哪些需要注意的陷阱?
似乎在本地通过 vagrant 进行所有自动引导变得非常棒,但是一旦超出范围,事情就会变得非常混乱。如果人们也使用类似这样的设置可以给我一些关于如何解决上述问题的指示,我会很高兴。我不介意付出一些努力来让它像我期望的那样运行,但也许我已经走错了部分,只是让自己更加困难,实际上需要这样做;)
现在简短的总结是:Vagrand+ChefSolo (KnifeSolo) 非常棒,但要正常工作,整个引导部分需要我们在应用食谱之前切换为自定义部分以获得适当的系统基础 - 这些需要小心从丛林中挑选出来。
进展/更新说明
(*1): 刚刚想通了,纯粹靠运气,很明显可以在一个 Vagrantfile 中添加多个供应机制:
由于首先执行 shell,我可以将它用作 Vagrant 服务器的自定义准备,同时仍然使用 Chef-Solo 进行实际设置。耶。最后仍然必须看看这会有多有用,但现在有一个缺失的步骤可以使流程保持一致。
amazon-web-services - 厨师和redisio错误
也许有人面临同样的情况
我们在 redis 上有一个干净的实例,它试图把一个厨师默认食谱只有
include_recipe "redisio :: 安装"
当我做饭时收到以下错误环境 AWS ec2.micro ubuntu 12.04 当我运行做饭时收到错误
ruby - 使用 vagrant 和 chef-solo,我如何指定要运行的 ruby 版本?
我正在使用 chef-solo 来配置一个新的 vagrant VM。这是 Ubuntu 12.10。Chef 第一次运行良好,但此后任何时候都无法启动。
问题是 chef-solo 需要使用 ruby 1.9.3 运行,但我的一本食谱安装了 ruby 2.0.0。它将新版本的 ruby 链接到 /usr/local/ruby,因此系统版本仍然在 /usr/bin/ruby 中可用。
/usr/bin/chef-solo 中的 shebang 行是#!/usr/bin/env ruby
.
有没有办法在 chef-solo 运行之前在 Vagrantfile 中设置环境变量?还是有另一种方法可以强制 vagrant 使用 /usr/bin/ruby 运行 chef-solo?
更新:我目前在 VM 上使用以下命令作为解决方法:
vagrant provision
当我在主机上打字时,我想强制 Vagrant 运行类似的东西。
ruby-on-rails - 无法使用 Chef-Solo 在 vagrant 虚拟 CentOS 机器上安装 Rails gem
我正在尝试使用 Vagrant 和 Chef-Solo 在 CentOS 6.3 64 位上设置 Rails 环境。
使用 Chef 时无法安装 Rails,并显示错误消息,
我该如何解决这个问题?
环境
- 操作系统:Mac OS X 10.8.2
- 虚拟盒子:4.2.12
- 流浪者:1.1.5
- 厨师:11.4.0
- 刀独奏:0.3.0
我的脚步
1.创建流浪虚拟机
2.创建厨师存储库并将厨师安装到VM
3.从 OpsCode 导入公共食谱
这会将 rbenv 食谱导入到 chefrepo/cookbooks/rbenv
4.创建我的食谱并修改default.rb
5.厨师
然后得到如下错误。
手动安装
Rails 可以通过$ sudo gem install rails
VM 安装。这大约需要 20 分钟或更长时间。
automation - 厨师模板通过参数覆盖变量
我是 chef-solo opscode 的新手,没有找到以下方法
我正在编写一个模板并将 data_bag json 作为变量传递给它
- 食谱
-erb
- 数据包
它一切正常,我想要进一步的是,当我执行它时,如下所示
@development["password"]
应该被覆盖为我传递的新值,而不是来自数据包
任何提示?
或者关于合并两个数据包的任何想法?
编辑:
我想将http://apidock.com/rails/Hash/deep_merge添加到 Chef init 的某个地方,因此 Hash 类将提供 deep_merge 方法,知道该放在哪里吗?我尝试在recipe 和solo.rb 的顶部,但没有运气。
amazon-web-services - How do I run chef recipes after app server is fired up
Using Amazons OpsWorks
I'm able to get a PHP App Server to get initialised, it downloads our project from git and sets it up, I've got a custom recipe being run on Setup
that works and downloads composer
, but this gets run before the git repository is downloaded, so too early to try and change permissions.
I've currently got a recipe in Deploy
that changes permissions on some files that were created as part of downloading our git project, however this recipe doesn't seem to get fired when setting up a new instance, I can only run it by manually deploying an app.
How can I have a recipe run after the git project has been downloaded by chef, when an instance is created (so when the site auto scales and a new instance is fired up, the recipe is run to set file permissions correctly)
chef-infra - 流浪者的厨师食谱不尊重长时间运行的w-get下载的rest_timeout或超时选项
我正在尝试获取一个要在厨师食谱中使用的大文件——它是一个大约 350mb 的数据库备份。我正在使用 wget 来获取文件,这是我的食谱:
无论我尝试了什么,我都会得到以下信息:
我什至尝试给 Vagrant 打猴子补丁,这样我就可以添加 rest_timeout 选项:
这会产生一个 /tmp/vagrant-chef-1/solo.rb 确实有一个 rest_timeout 选项:
但是我仍然遇到 Chef 无法完成的相同错误。关于在没有厨师超时或其他问题停止食谱的情况下让这个大型下载工作的任何建议?当我设置机器然后从内部运行 wget 时它工作正常。非常感谢任何帮助!
chef-infra - 点文件应该放在厨师食谱集合中的什么位置?
我们正在慢慢地将我们的基础设施转移到 chef 上,并在此过程中建立一系列食谱。
我不确定的一件事是节点/角色/用户特定的点文件应该去哪里。
例如,我们可以使用 rbenv 食谱为多个用户安装 rbenv,
用户 A 可能不需要 rdoc 文档,因此需要自定义.gemrc
文件。
这应该去哪里?
我们可以将文件内容放在节点/角色特定的 JSON 文件中,或者放在数据包中,但这感觉不对。
有没有办法以一种不是针对一般食谱而是针对特定节点/用户的方式包含实际文件?
ruby - 如何使用 ruby 从 s3 存储桶下载 zip 文件
我能够压缩所有必需的文件(使用 AWS SDK 的 ruby gems)并将它们上传到 S3 存储桶。当我尝试将 zip 文件从 S3 下载到本地服务器并解压缩它们时,我收到以下错误...
[2013-05-06T07:19:37+00:00] FATAL: TypeError: aws_unzip[db_unzip] (aws::unzip line 14) 有一个错误:TypeError: can't dup NilClass
即使我尝试手动解压缩,我也可以看到“zip 文件已损坏”...但是 S3 位置中存在的 zip 文件没有损坏(我测试通过下载它们手动提取它们,它提取得很好).. .. 任何人都可以帮助我在将 zip 文件从存储桶读取到本地服务器时出错??????下载的时候就坏了。。。
我的代码是
provisioning - Veewee, Vagrant and Berkshelf integration
I'm trying to learn how to set up a virtual development environment using VirtualBox, Veewee, Vagrant and Chef-solo with Berkshelf.
Since I'm very new to this, I've read all I could find online, but I think I'm missing something crucial. Hopefully somebody here can help me understand.
The part I'm having problems with is provisioning the Veewee-generated Vagrant box using Chef-solo and Berkshelf.
From my point of view, the main advantage of using Vagrant and virtual environments is that they're reproducible and portable, so I do not understand why I have to install the Berkshelf gem and download recipes on my local host machine.
Why isn't all this done on the guest?
If I give my customized Vagrantfile to someone else, vagrant up will not work on their machine because the Vagrantfile references local recipes the other person will not have by default. Installing Berkshelf and recipes on their machine as well kinda defeats the purpose and so does referencing recipes available on the web somewhere.
Isn't it a better idea to just install the Berkshelf gem on the guest, download recipes locally there and tell Vagrant to use the recipes on the guest? I couldn't find any reference in the new Vagrant documentation on how to do this, but in the old version specifying cookbook folders within the virtual machine was an available option.
So basically what I'd like to know is:
Is my reasoning a valid option or am I missing either a useful tool or the general picture?
If my reasoning is valid, could you please point me in the right direction of how to do this? I was thinking of finding out how to customize the Veewee templates for building the Vagrant base box, using a post installation script to add Berkshelf and download recipes, but perhaps it's either overkill or the wrong way to go about this?
Thanks in advance!