这就是我的Vagrantfile
看起来的样子:
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.json = {
postgresql: {
password: {
postgres: 'password'
}
},
database: {
create: ['mydb']
},
'build-essential' => {
compiletime: true
}
}
chef.run_list = ['recipe[build-essential]', 'recipe[openssl]', 'recipe[postgresql::server]', 'recipe[database::postgresql]']
end
我还使用了precise32
框。
当我的VM在vagrant up
之后启动时,我得到very long traceback,并显示错误消息:undefined method
ruby'for Config:Module`。
有人遇到过这个吗?
答案 0 :(得分:5)
安装“pg”gem似乎有问题:
================================================================================
Error executing action `install` on resource 'chef_gem[pg]'
================================================================================
Gem::Installer::ExtensionBuildError
-----------------------------------
ERROR: Failed to build gem native extension.
/opt/vagrant_ruby/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
..
..
checking for st.h... yes
creating extconf.h
creating Makefile
make
sh: 1: make: not found
我建议阅读build-essentials食谱的文档。它建议设置“compiletime”属性,以支持确保构建工具可用于编译RubyGems扩展。
以下json设置对我有用:
chef.json = {
"postgresql" => {
"password" => {
"postgres" => "password"
}
},
"database" => {
"create" => ["encased_dev"]
},
"build_essential" => {
"compiletime" => true
}
}
注意:
我发现有一个ruby recipe也解决了这个问题(通过设置构建必需节点属性)。将其添加到您的运行列表或使用database cookbook