- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在尝试使用 chef-solo 在我的服务器上安装 postgresql。我通过自己进行引导并在脚本中手动包含 build-esential 包来完成这项工作。现在我想使用 knife-solo 来处理 Bootstrap ,但我在定义执行配方的顺序时遇到了问题。
我想在 postgresql 之前安装 build-essential 包。这是我正在构建的服务器的 json 文件
{
"dbuser": "myuser",
"dbpass": "mypassword",
"postgresql":{"password":{"postgres":"mypassword"}},
"passenger":{"version":"3.0.14", "max_pool_size":"2"},
"default_attributes":{"build_essential":{"compiletime": "true"}},
"run_list": [
"recipe[build-essential]",
"role[web_server]",
"recipe[sqlite]",
"recipe[postgresql::server]",
"recipe[pope::default]"
]
}
当我发出命令时
knife cook <user>@<my server's ip>
我收到这个错误
WARNING: No knife configuration file found
Checking cookbook syntax...
Checking Chef version
Enter the password for test@<my server's ip>:
[2012-10-29T16:14:44+11:00] INFO: *** Chef 10.16.2 ***
[2012-10-29T16:14:45+11:00] INFO: Setting the run_list to ["recipe[build-essential]", "role[web_server]", "recipe[sqlite]", "recipe[postgresql::server]", "recipe[mysettings::default]"] from JSON
[2012-10-29T16:14:45+11:00] INFO: Run List is [recipe[build-essential], role[web_server], recipe[sqlite], recipe[postgresql::server], recipe[pope::default]]
[2012-10-29T16:14:45+11:00] INFO: Run List expands to [build-essential, apache2, passenger_apache2, sqlite, postgresql::server, mysettings::default]
[2012-10-29T16:14:45+11:00] INFO: Starting Chef Run for test-VirtualBox
[2012-10-29T16:14:45+11:00] INFO: Running start handlers
[2012-10-29T16:14:45+11:00] INFO: Start handlers complete.
[2012-10-29T16:14:46+11:00] INFO: Processing package[postgresql-client] action install (postgresql::client line 37)
[2012-10-29T16:14:47+11:00] INFO: Processing package[libpq-dev] action install (postgresql::client line 37)
[2012-10-29T16:14:47+11:00] INFO: Processing package[make] action install (postgresql::client line 37)
[2012-10-29T16:14:47+11:00] INFO: Processing gem_package[pg] action install (postgresql::client line 42)
================================================================================
Error executing action `install` on resource 'gem_package[pg]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" ----
STDOUT: Building native extensions. This could take a while...
STDERR: ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/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 pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/chef/embedded/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out
---- End output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" ----
Ran /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" returned 1
Cookbook Trace:
---------------
/tmp/chef-solo/cookbooks/postgresql/recipes/client.rb:44:in `from_file'
/tmp/chef-solo/cookbooks/postgresql/recipes/server.rb:24:in `from_file'
Resource Declaration:
---------------------
# In /tmp/chef-solo/cookbooks/postgresql/recipes/client.rb
42: gem_package "pg" do
43: action :nothing
44: end.run_action(:install)
Compiled Resource:
------------------
# Declared in /tmp/chef-solo/cookbooks/postgresql/recipes/client.rb:42:in `from_file'
gem_package("pg") do
provider Chef::Provider::Package::Rubygems
action [:nothing]
retries 0
retry_delay 2
package_name "pg"
version "0.14.1"
cookbook_name :postgresql
recipe_name "client"
gem_binary "/opt/chef/embedded/bin/gem"
end
================================================================================
Recipe Compile Error in /tmp/chef-solo/cookbooks/postgresql/recipes/server.rb
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
gem_package[pg] (postgresql::client line 42) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" ----
STDOUT: Building native extensions. This could take a while...
STDERR: ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/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 pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/chef/embedded/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out
---- End output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" ----
Ran /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" returned 1
Cookbook Trace:
---------------
/tmp/chef-solo/cookbooks/postgresql/recipes/client.rb:44:in `from_file'
/tmp/chef-solo/cookbooks/postgresql/recipes/server.rb:24:in `from_file'
Relevant File Content:
----------------------
/tmp/chef-solo/cookbooks/postgresql/recipes/client.rb:
37: package pg_pack do
38: action :nothing
39: end.run_action(:install)
40: end
41:
42: gem_package "pg" do
43: action :nothing
44>> end.run_action(:install)
45:
[2012-10-29T16:15:03+11:00] ERROR: Running exception handlers
[2012-10-29T16:15:03+11:00] ERROR: Exception handlers complete
[2012-10-29T16:15:03+11:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out
[2012-10-29T16:15:03+11:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: gem_package[pg] (postgresql::client line 42) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" ----
STDOUT: Building native extensions. This could take a while...
STDERR: ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/opt/chef/embedded/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 pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/chef/embedded/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_make.out
---- End output of /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" ----
Ran /opt/chef/embedded/bin/gem install pg -q --no-rdoc --no-ri -v "0.14.1" returned 1
最佳答案
最简单的解决方案是更新您本地的 postgresql 说明书。您观察到的问题已在最新版本的 Recipe 中得到修复(所有版本 >= 1.0.0)。
现在他们是怎么解决的?首先,您会注意到客户端配方被拆分为 client.rb
和 ruby.rb
。前者只安装操作系统包,后者安装 Ruby gem,供后续 Chef 运行使用。如您所见,该 gem 的安装需要先安装构建要素。这是由 build-essential 使用的新属性控制的名为 node['build-essential']['compile_time']
的 Recipe 。这确保在编译时安装所需的包,即直接在包含 build-essential 配方时安装。
要理解为什么这很重要,您必须了解一点 Anatomy of a Chef Run ,即执行配方源代码和构建用于稍后转换的资源集合时的编译时间与执行资源以将系统移向预期状态的后续收敛之间的差异。
通常,大多数实际更改是在收敛阶段完成的。然而,有时有必要在编译阶段之前构建一些东西,以便能够使用它来决定要定义哪些资源,就像这里的情况一样。当我们这么早安装到 pg
gem 时,我们可以使用它来尽早与数据库对话,例如决定是否创建数据库。
关于ruby - Chef 独奏 : Installing build-essential recipe before postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13116282/
我刚刚更新了 Web 要点,现在我没有语法突出显示或编译。在更改说明中,我可以读到 2.5 版中的“删除了 LESS/CoffeeScript 编辑器”,但是 less 的选项仍然存在?!。 什么?为
我在 VS 2013(更新 1)中安装了一个全新的 MVC 5.1 Web 应用程序项目,其中安装了 Web Essential 2013(截至今天的最新版本)。构建项目后,Web Essential
我找不到很多/任何关于 web essentials 2013 的此功能的文档。 Web Essentials Markdown 预览是否可以使用相对图像路径?另外,如何从一个 Markdown 文件
题记: 之前由SharpDevelop团队开发且用于SharpDevelop这个开源IDE中的重构插件“NR6Pack”改名为“Refactoring Essentials”,被Hanselman
在 W3C 跨源资源共享建议 (http://www.w3.org/TR/cors/#resource-requests) 的第 3 步中,它指出: If the resource supports
查看 Xamarin 基本要素并想知道 FileSystem 的目的是什么。 我一直在寻找可以立即为我异步加载和保存文件的东西。 它在我看来,可能是我不理解它给您的唯一功能是保存和加载文件的位置,并且
在查看有关保存 JWT token 的选项后,我选择了 Xamarin.Essentials Secure Storage。 问题是我的应用程序在尝试在存储中保存 token 时总是中断并出现以下错误
我在 Ivo Balbaert 所著的 Rust Essentials 一书中找到了获取变量内存位置的代码,在第 2 章中关于“堆栈和堆”的内容: let a = 32; let mut b = "s
当我编译我的 websolution 时,web essentials 从 less 文件中生成 css 文件。我总是遇到源控制冲突,因为 css 文件的输出不同。在队友的计算机上使用 vs2013/
我将在我的 CSS 中使用 .less。 根据我的理解,有不同的方式来使用 .less。 您可以预编译它,然后使用 .less 生成的 css 另一个正在使用下面的脚本: 这个 或 据我了解,
我已下载并安装了.vslx文件,该文件会导致Web要素成为VS 2012的一部分。 这可能是一个愚蠢的问题。 但是,如何从vs.中删除Webessentials?我在VS 2012中找不到这样的选项。
这是我的背景。 我在工作时有一个小屏幕 Typescript 预览屏幕不记得它以前的大小,而且每次打开 TS 文件时都要折叠它很烦人 Web Essentials 新版本没有我们可以控制任何设置的 T
我正在开发一个使用 Web Essentials 来捆绑和缩小脚本文件的项目。 它运行良好,当我保存对脚本文件的更改时,Web Essentials 会运行。我们目前有几个开发人员参与该项目,每次从源
我们使用此Visual Studio扩展,但也希望在未检入生成的捆绑文件的情况下在CI服务器上使用它。是否没有用于此的命令行工具? 想知道其余的Web Essentials社区是如何做到的吗?当然其他
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 8年前关闭。 Improve this q
我试图理解web essential's Go To Definition feature statement : Go To Definition is built in to VS2012 and
我尝试修改Essential JS基于 ejgantt 的项目跟踪器示例组件: $("#gantt").ejGantt({ dataSource: projectData,
有 2 个文件,我想将变量样式表导入第二个文件,但在第一种情况下,我在预览模式下遇到不正确的语法错误,在第二种情况下,我得到未声明的变量 错误。无论如何,两种情况都编译正确。 预览模式错误的第一种情况
有 2 个文件,我想将变量样式表导入第二个文件,但在第一种情况下,我在预览模式下遇到不正确的语法错误,在第二种情况下,我得到未声明的变量 错误。无论如何,两种情况都编译正确。 预览模式错误的第一种情况
我正在借助书 Essential SQLAlchemy 来学习 SQLAlchemy . 其中一个示例对于我想要学习的内容至关重要 - 添加相关对象。我就是无法让它发挥作用。我希望这个社区可以帮助确定
我是一名优秀的程序员,十分优秀!