R_G R_G - 3 months ago 26
Ruby Question

Heroku push of Rails4 Postgres App failed to compile Ruby app

This app was generated using Rails Composer and no mods have been made as of yet. It's the first app where I used Postgres as I used MySQL before. When I tried to run it locally, it initially failed because PG was listening to port 5433 and the app was trying to connect to port 5432. I changed PG to listen to 5432 not 5433. At that point, it began to work. Locally, I can sign up, login and list users. That's about all it does right now as I have not modified the original code.

When I:

git push heroku master


it works until I get these messages:

Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
... trace dump ...
!
! Precompiling assets failed.
!

! Push rejected, failed to compile Ruby app

To git@heroku.com:afternoon-spire-5707.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:afternoon-spire-5707.git'


rake assets:precompile works locally:

D:\BitNami\rubystack-2.0.0-11\projects\keyandcar>rake assets:precompile
I, [2014-03-01T01:06:01.849873 #28852] INFO -- : Writing D:/BitNami/rubystack-2.0.0-11/projects/keyandcar/public/assets
/application-2523f7871b800324a0dde9f6d33ef208.js
I, [2014-03-01T01:06:01.919922 #28852] INFO -- : Writing D:/BitNami/rubystack-2.0.0-11/projects/keyandcar/public/assets
/application-5d552226c05f29080fc1703e860817a5.css
I, [2014-03-01T01:06:01.936932 #28852] INFO -- : Writing D:/BitNami/rubystack-2.0.0-11/projects/keyandcar/public/assets
/bootstrap/glyphicons-halflings-regular-171c97066e4db52896df4e14c2905e8e.eot
I, [2014-03-01T01:06:01.949941 #28852] INFO -- : Writing D:/BitNami/rubystack-2.0.0-11/projects/keyandcar/public/assets
/bootstrap/glyphicons-halflings-regular-e327cd5918c69ba34cb1c92b9c7c424a.svg
I, [2014-03-01T01:06:01.981961 #28852] INFO -- : Writing D:/BitNami/rubystack-2.0.0-11/projects/keyandcar/public/assets
/bootstrap/glyphicons-halflings-regular-7206a6a5553d1b106dc988b6af7e29df.ttf
I, [2014-03-01T01:06:01.994971 #28852] INFO -- : Writing D:/BitNami/rubystack-2.0.0-11/projects/keyandcar/public/assets
/bootstrap/glyphicons-halflings-regular-a6d95d67a6db3f50ff64b2103e8c9348.woff


I added this to config/application.rb with no effect:

config.assets.initialize_on_precompile = false # for Heroku


I'm not sure where the failure is, as to whether it is a precompile problem or PG listening to 5433 instead of 5432 or what.

Thanks for the help...R_G

Answer

Did you add the rails_12factor gem in your gemfile as stated here?

gem 'rails_12factor', group: :production
Comments