tutorial rails how elastic ec2 deploy aws app ruby-on-rails amazon-web-services elastic-beanstalk pg

ruby-on-rails - how - elastic beanstalk rails



¿Por qué no se puede instalar la gema pg en AWS Elastic Beanstalk? (3)

Estoy implementando una aplicación simple para AWS Elastic Beanstalk. Sin embargo, en el momento en que puse la gem ''pg'' en el Gemfile y las empujé a Elastic Beanstalk. Obtengo los siguientes errores en mis registros:

------------------------------------- /var/log/eb-tools.log ------------------------------------- Installing actionpack (4.0.1) Installing mime-types (1.25) Installing polyglot (0.3.3) Installing treetop (1.4.15) Installing mail (2.5.4) Installing actionmailer (4.0.1) Installing activemodel (4.0.1) Installing activerecord-deprecated_finders (1.0.3) Installing arel (4.0.1) Installing activerecord (4.0.1) Installing coffee-script-source (1.6.3) Installing execjs (2.0.2) Installing coffee-script (2.2.0) Installing thor (0.18.1) Installing railties (4.0.1) Installing coffee-rails (4.0.1) Installing hike (1.2.3) Installing jbuilder (1.5.2) Installing jquery-rails (3.0.4) Using json (1.8.1) Installing pg (0.17.0) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9 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 *** 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 --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/ --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby1.9 --with-pg --without-pg --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}/ Gem files will remain installed in /usr/share/ruby/1.9/gems/1.9.1/gems/pg-0.17.0 for inspection. Results logged to /usr/share/ruby/1.9/gems/1.9.1/gems/pg-0.17.0/ext/gem_make.out An error occurred while installing pg (0.17.0), and Bundler cannot continue. Make sure that `gem install pg -v ''0.17.0''` succeeds before bundling. ERROR: bundle install failed! 2013-11-17 14:10:03,371 [ERROR] (8302 MainThread) [directoryHooksExecutor.py-34] [root directoryHooksExecutor error] Script failed with returncode 1 2013-11-17 14:10:03,499 [INFO] (8269 MainThread) [command.py-130] [root command execute] Command returned: (code: 1, stdout: Error occurred during build: Command hooks failed , stderr: None) ....

No consigo errores a nivel local.

Hace bastante tiempo, recuerdo haber encontrado este problema en mis otras cajas de Ubuntu. Aparentemente, uno necesita instalar bibliotecas adicionales a través de sudo apt-get install ruby-dev build-essential o sudo apt-get install postgresql-client libpq5 libpq-dev . Le daría una oportunidad, pero en AWS Elastic Beanstalk, no estoy tan seguro de cómo hacerlo.


En .ebextensions/packages.config :

packages: yum: postgresql-devel: []

Esto asegurará que cualquier nueva instancia tendrá instalada esta biblioteca.


En .ebextensions/packages.config

packages: yum: postgresql-devel: []

Lo importante a tener en cuenta es que necesita configurar postgresql-devel para que coincida con la lib para su versión de postgresql. por ejemplo, si tiene postgresql 9.4.5 necesita instalar un postgresql-develXX.

Usando la yum list podrás identificar la lib correcta.


añadir

packages: yum: postgresql93-devel: []