gjlondon / definitive_guide_to_django_deployment

A guide to best practices in production Django deployment, plus a set of Chef scripts to create a solid configuration.
Other
313 stars 42 forks source link

Error on pg rubygem #15

Open ghost opened 9 years ago

ghost commented 9 years ago

During a fresh DB setup I get an error on the pg rubygem. This doesn't prevent the sample project from bootstrapping and the final message is a success so I think this is low priority. I was using a micro instance at the time, and from experience my first suspicion is that the host ran out of RAM and the gem install got killed by the Linux OOM.

Recipe: postgresql::ruby
  * chef_gem[pg] action install
================================================================================
Error executing action `install` on resource 'chef_gem[pg]'
================================================================================

Gem::Installer::ExtensionBuildError
-----------------------------------
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
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --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-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.18.1 for inspection.
Results logged to /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/pg-0.18.1/ext/gem_make.out

Cookbook Trace:
---------------
/home/ubuntu/chef-solo/cookbooks-1/postgresql/recipes/ruby.rb:57:in `rescue in from_file'
/home/ubuntu/chef-solo/cookbooks-1/postgresql/recipes/ruby.rb:24:in `from_file'
/home/ubuntu/chef-solo/cookbooks-2/django_application_server/recipes/database.rb:25:in `from_file'

Resource Declaration:
---------------------
# In /home/ubuntu/chef-solo/cookbooks-1/postgresql/recipes/ruby.rb

 57:     chef_gem "pg"
 58:   rescue Gem::Installer::ExtensionBuildError => e

Compiled Resource:
------------------
# Declared in /home/ubuntu/chef-solo/cookbooks-1/postgresql/recipes/ruby.rb:57:in `rescue in from_file'

chef_gem("pg") do
  provider Chef::Provider::Package::Rubygems
  action :install
  retries 0
  retry_delay 2
  package_name "pg"
  version "0.18.1"
  cookbook_name :postgresql
  recipe_name "ruby"
end

[2015-04-28T16:32:41+00:00] WARN: Failed to properly build pg gem. Forcing properly linking and retrying (omnibus fix)
  * execute[generate pg gem Makefile] action run
    - execute /opt/chef/embedded/bin/ruby extconf.rb

  * execute[make pg gem lib] action run
    - execute make

  * execute[install pg gem lib] action run
    - execute make install

  * execute[install pg spec] action run
    - execute /opt/chef/embedded/bin/gem spec ./cache/pg-0.18.1.gem --ruby > ./specifications/pg-0.18.1.gemspec

[2015-04-28T16:33:23+00:00] WARN: Installation of pg gem successful!
Defoncesko commented 9 years ago

Same issue here, did you succeed in solving it ?

gjlondon commented 9 years ago

My understanding was that this is pretty much just a warning and that the native extension isn't essential as long the pg gem eventually installs (as it did for Adam.) So I haven't looked into it. Is this actually blocking you from proceeding?

Defoncesko commented 9 years ago

It was, I just changed my Gemfile from gem 'pg', '0.18.1' to gem 'pg', '0.18.2' then I ran bundle install and pg gem was installed correctly. But regarding 0.18.1, bundle install was unable to run correctly. So in my opinion, there is no correlation between this issue and "definitive_guide_to_django_deployment"