Heroku Deployment: Assets precompile


(Thomas_Harper) #1

Hi I’m actually trying to deploy discourse on Heroku.
I’m following the step by step guide here [Basic Heroku deployment][1]
I’m facing a problem when I try to rake assets:precompile (I’m precompiling locally).
The rake command is aborted, saying to me that

No such file or directory: mydirectories/discourse/config/database.yml

When I rake assets:precompile I’m in production environment (RAILS_ENV=production).
So I checked if the database.yml was missing in the repo, and yes it was.

I currently have two database.yml but a bit different. There’s database.yml.development-sample and
database.yml.production-sample.

I tried renaming database.yml.production-sample to a simple database.yml but it still doesn’t work giving me this error:

could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?

What am I doing wrong ?
Cordially,
Thomas
PS : The config/redis.yml and public/assets are commented in the .gitignore
[1]: https://github.com/discourse/discourse/blob/master/docs/HEROKU.md


(ComputerDruid) #2

You shouldn’t need the database.yml to precompile locally. It seems that the reason it looks for it here is because it’s actually trying to hit the postgres database during precompile, which of course won’t work if you’re precompiling locally.

Unfortunately I don’t know enough about the precompile process to know exactly what’s happening here, but I bet the letting it precompile the assets remotely would work, as the database would then be available.

So I am left with 2 questions:

  • Why is the asset precompile process trying to talk to postgres?
  • Should this process work without access to postgres?

If it needs access to the db to work, then I would expect that the local precompiling of assets is no longer an option.


(Thomas_Harper) #3

Thank you for your answer @computerdruid,

I really don’t know why the precompile process is trying to talk to postgres, I simply cloned discourse repo as it was said in the Readme :confused:
The precompile process should normally work without access to postgres.

However I succeed pushing discourse to heroku.
I did it by creating a “discourse_development” postgres database locally in order to compile. But it stills weird to me :smile:
I’m really surprised by discourse and its amazing features now. The panel admin via the UI is absolutely HUGE.


(Vanja Radovanović) #4

maybe this might help:
http://meta.discourse.org/t/anyone-got-this-running-on-heroku-yet/625/115


(Jeff Atwood) #5

Is this still an issue with the latest codebase?


(Jeff Atwood) #6

This topic was automatically closed after 24 hours. New replies are no longer allowed.