Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 厨师长独奏:在postgresql之前安装构建基本配方_Ruby_Postgresql_Chef Infra - Fatal编程技术网

Ruby 厨师长独奏:在postgresql之前安装构建基本配方

Ruby 厨师长独奏:在postgresql之前安装构建基本配方,ruby,postgresql,chef-infra,Ruby,Postgresql,Chef Infra,我正在尝试使用chef solo在我的服务器上安装postgresql。我自己做了引导,并在脚本中手动包含buildeseential包,从而实现了这一点。现在我想用刀子独奏处理引导,我有一个问题,在定义的顺序,食谱执行 我想在postgresql之前安装build essential包。这是我正在构建的服务器的json文件 { "dbuser": "myuser", "dbpass": "mypassword", "postgresql":{"password":{"

我正在尝试使用chef solo在我的服务器上安装postgresql。我自己做了引导,并在脚本中手动包含buildeseential包,从而实现了这一点。现在我想用刀子独奏处理引导,我有一个问题,在定义的顺序,食谱执行

我想在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>
刀厨师@:
[2012-10-29T16:14:44+11:00]信息:**Chef 10.16.2***
[2012-10-29T16:14:45+11:00]信息:从JSON将运行列表设置为[“配方[build essential],“角色[web\u server],“配方[sqlite],“配方[postgresql::server],“配方[mysettings::default]”]
[2012-10-29T16:14:45+11:00]信息:运行列表是[recipe[build essential]、role[web_server]、recipe[sqlite]、recipe[postgresql::server]、recipe[pope::default]]
[2012-10-29T16:14:45+11:00]信息:运行列表扩展为[build essential、apache2、passenger_apache2、sqlite、postgresql::server、mysettings::default]
[2012-10-29T16:14:45+11:00]信息:开始为测试VirtualBox运行Chef
[2012-10-29T16:14:45+11:00]信息:正在运行启动处理程序
[2012-10-29T16:14:45+11:00]信息:启动处理程序已完成。
[2012-10-29T16:14:46+11:00]信息:处理包[postgresql客户端]操作安装(postgresql::客户端第37行)
[2012-10-29T16:14:47+11:00]信息:处理包[libpq-dev]操作安装(postgresql::client line 37)
[2012-10-29T16:14:47+11:00]信息:处理包[make]操作安装(postgresql::客户端第37行)
[2012-10-29T16:14:47+11:00]信息:正在处理gem_包[pg]操作安装(postgresql::client line 42)
================================================================================
在资源gem_包[pg]上执行操作“install”时出错
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
预期进程将与[0]一起退出,但收到“1”
----开始输出/opt/chef/embedded/bin/gem install pg-q--no rdoc--no ri-v“0.14.1”----
标准输出:构建本机扩展。这可能需要一段时间。。。
标准:错误:安装pg时出错:
错误:无法生成gem本机扩展。
/opt/chef/embedded/bin/ruby extconf.rb
正在检查pg_配置。。。对
使用/usr/bin/pg_config中的配置值
正在检查libpq fe.h。。。对
正在检查libpq/libpq fs.h。。。对
正在检查pg_config_manual.h。。。对
正在-lpq中检查PQconnectdb()。。。不
正在-llibpq中检查PQconnectdb()。。。不
正在-lms/libpq中检查PQconnectdb()。。。不
找不到PostgreSQL客户端库(libpq)
***extconf.rb失败***
由于某些原因无法创建Makefile,可能是缺少
必要的库和/或标题。查看mkmf.log文件了解更多信息
细节。您可能需要配置选项。
提供的配置选项:
--使用opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/opt/chef/embedded/bin/ruby
--与pg
--无pg
--与pg dir
--没有pg dir
--与pg包括
--不带pg include=${pg dir}/include
--用pg-lib
--不带pg lib=${pg dir}/lib
--使用pg配置
--没有pg配置
--带-pg_配置
--不带-pg_配置
--使用pqlib
--没有pqlib
--使用libpqlib
--没有libpqlib
--使用ms/libpqlib
--没有ms/libpqlib
Gem文件仍将安装在/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1中以供检查。
结果记录到/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.14.1/ext/gem_-make.out
----/opt/chef/embedded/bin/gem安装pg-q的最终输出——没有rdoc——没有ri-v“0.14.1”----
Ran/opt/chef/embedded/bin/gem安装pg-q——无rdoc——无ri-v“0.14.1”返回1
食谱跟踪:
---------------
/tmp/chef solo/cookbooks/postgresql/recipes/client.rb:44:in'from_file'
/tmp/chef solo/cookbooks/postgresql/recipes/server.rb:24:in'from_file'
资源声明:
---------------------
#在/tmp/chef solo/cookbooks/postgresql/recipes/client.rb中
42:gem_包装“pg”do
43:行动:什么都没有
44:结束。运行\u操作(:安装)
汇编资源:
------------------
#在/tmp/chef solo/cookbooks/postgresql/recipes/client.rb:42:in‘from_file’中声明
gem_包装(“pg”)do
提供者厨师::提供者::包::Rubygems
动作[无]
重试0次
重试\u延迟2
包装名称“pg”
版本“0.14.1”
食谱名称:postgresql
配方名称“客户”
gem_binary“/opt/chef/embedded/bin/gem”
结束
================================================================================
/tmp/chef solo/cookbooks/postgresql/recipes/server.rb中的配方编译错误
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
gem_程序包[pg](postgresql::client第42行)出现错误:Mixlib::ShellOut::ShellCommandFailed:预期进程将与[0]一起退出,但收到“1”
----开始输出/opt/chef/embedded/bin/gem install pg-q--no rdoc--no ri-v“0.14.1”----
标准输出:构建本机扩展。这可能需要一段时间。。。
标准:错误:安装pg时出错:
错误:无法生成gem本机扩展。
/opt/chef/embedded/bin/ruby extconf.rb
正在检查pg_配置。。。对
使用/usr/bin/pg_config中的配置值
正在检查libpq fe.h。。。对
正在检查libpq/libpq fs.h。。。对
正在检查pg_config_manual.h。。。对
正在-lpq中检查PQconnectdb()。。。不
正在-llibpq中检查PQconnectdb()。。。不
正在-lms/libpq中检查PQconnectdb()。。。不
找不到PostgreSQL客户端库(libpq)
***extconf.rb失败***
由于某些原因无法创建Makefile,可能是缺少
必要的库和/或标题。检查mkm
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