使用Chef在Vagrant VM上安装Postgres的问题:Config:Module的未定义方法“ ruby” [英] Issue with installing Postgres on Vagrant VM using Chef: undefined method `ruby' for Config:Module
问题描述
这就是我的 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在无所事事 c之后启动时,我得到非常长回溯,并显示错误消息:
undefined method
ruby'for Config:Module`。
Also I used precise32
box.
And while my VM starts after vagrant up
, I get very long traceback with error message: undefined method
ruby' for Config:Module`.
有人吗?
推荐答案
安装 pg gem似乎存在问题:
There appears to be a problem installing the "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扩展。
I suggest reading the documentation of the build-essentials cookbook. It suggests setting the "compiletime" attribute in order to support to ensure that the build tools are available to compile RubyGems extensions.
以下json设置对我有用:
The following json settings worked for me:
chef.json = {
"postgresql" => {
"password" => {
"postgres" => "password"
}
},
"database" => {
"create" => ["encased_dev"]
},
"build_essential" => {
"compiletime" => true
}
}
注意:
- 属性是 build_essential而不是 build-essential
此后我发现有一个红宝石配方也解决了此问题(通过设置构建基本节点属性来解决)。可以将其添加到您的运行列表中,或使用数据库食谱
I have since discovered that there is a ruby recipe that fixes this issue as well (by setting the build essential node attributes about). Either add it to your run-list or use the database cookbook
- https://github.com/opscode-cookbooks/database/blob/master/recipes/postgresql.rb
这篇关于使用Chef在Vagrant VM上安装Postgres的问题:Config:Module的未定义方法“ ruby”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!