Re: pg gem and ruby app deployment issues


John Shahid
 

Hi Evgeniy,

Are you using a customized stack with that cloudfdoundry deployment. I’m
looking at cflinuxfs2 stack/rootfs and libpq-dev has been there for a while
now. This package has provided pg_config since version 9.3.4
<http://packages.ubuntu.com/trusty/arm64/libpq-dev/filelist>.

Another (unlikely) possiblity, have you set --with-pg-config locally? If
you had there would be a .bundle/config inside your app with similar
contents as below:


BUNDLE_BUILD__PG: "--with-pg-config=/usr/pgsql-9.1/bin/pg_config"

On Fri, Apr 22, 2016 at 5:44 AM Evgeniy Litvinenko mirakl577(a)gmail.com
<http://mailto:mirakl577(a)gmail.com> wrote:

Good day,

We have ruby application which requires gem 'pg' for connection to
postgres db, for some reason I can't deploy it, it fails on bundle install
phase, I used different ruby buildpacks and ruby versions but without any
luck, our cf version is 212.

Gemfile:
source "https://rubygems.org"

ruby '2.3.0'
gem "sinatra", "~> 1.4.3"
gem 'json'
gem 'rest-client'
gem 'pg'


ERROR:
Cloning into '/tmp/buildpacks/ruby-buildpack'...
Submodule 'compile-extensions' (
https://github.com/cloudfoundry/compile-extensions) registered for path
'compile-extensions'
Cloning into 'compile-extensions'...
Submodule path 'compile-extensions': checked out
'4a0e48afc46c1d467b7c75a8ae5e6f3a044d3d64'
-------> Buildpack version 1.6.16
Downloaded [
https://pivotal-buildpacks.s3.amazonaws.com/ruby/binaries/shared/bundler-1.11.2.tgz
]
-----> Compiling Ruby/Rack
Downloaded [
https://pivotal-buildpacks.s3.amazonaws.com/concourse-binaries/ruby/ruby-2.3.0-linux-x64.tgz
]
-----> Using Ruby version: ruby-2.3.0
-----> Installing dependencies using bundler 1.11.2
Downloaded [
https://pivotal-buildpacks.s3.amazonaws.com/ruby/binaries/cflinuxfs2/libyaml-0.1.6.tgz
]
Running: bundle install --without development:test --path
vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Using json 1.8.3
Installing netrc 0.11.0
Installing unf_ext 0.0.7.2 with native extensions
Installing mime-types 2.99.1
Installing pg 0.18.4 with native extensions
Installing rack 1.6.4
Installing tilt 2.0.2
Using bundler 1.11.2
Installing rack-protection 1.5.3
Installing sinatra 1.4.7
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/tmp/staged/app/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
/tmp/staged/app/vendor/ruby-2.3.0/bin/ruby -r
./siteconf20160422-297-z2ly6c.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again
with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.