Right now, SERVE_STATIC_ASSETS = "true" for development and test, but not production.
This makes sense when deploying to a server like Nginx.
But for Heroku, SERVE_STATIC_ASSETS must be "true".
I ran across this issue when deploying to Heroku (says something like /public/assets.json not found) and so did @jxxcarlson.
The Assets guide 'overview' covers this but it's not clear everyone will read that before deploying to Heroku.
A few options I see, in order of most helpful fixing this problem to least:
SERVE_STATIC_ASSETS="false", alerting them that they need to set SERVE_STATIC_ASSETS to "true"?I'd like to conduct an informal poll.
Please add a reaction to this post, according to which hosting environment you use for Hanami apps:
:heart: for Heroku
:tada: for non-Heroku
:smile: for both
:confused: for none, yet
It doesn't need to be a 'real app' or have users, just something you have deployed.
Everyone is invited to respond! cc/ @hanami/contributors
I don't like idea to set SERVE_STATIC_ASSETS to true in production for many reasons:
– Heroku is just one from many. And it is a known limitation by Heroku. Anyway, you have to configure Heroku before deployment. So, what is problem to execute heroku config:set SERVE_STATIC_ASSETS="true"?
– It not breaks existed Hanami projects but can create some problems.
– It's a common practice that assets should be served by a server (NGINX or Apache).
P.S.
As for deployment on Heroku. I have a draft of the article how to deploy on Heroku, and your issue is a real motivation to finish and publish to blog.
@aderyabin All good points!
Perhaps 2) could be implemented by tying into the rake assets:precompile command, since that should only be run from Heroku? (See "Ruby Ecosystem Compatibility" section here: http://hanamirb.org/guides/applications/rake/)
I agree with @aderyabin .
@cllns You raised a good point. Because we feature Heroku deployment on the homepage, what if we add this step over there? Can you please do that?
We can eventually expand with a Deployment section in guides to cover Heroku and other vendors. To be clear, It's NOT to up to us to maintain these deployment instructions. The website it's open for the people working at these companies. If they want to get featured over there, they should maintain the guides.
Most helpful comment
I'd like to conduct an informal poll.
Please add a reaction to this post, according to which hosting environment you use for Hanami apps:
:heart: for Heroku
:tada: for non-Heroku
:smile: for both
:confused: for none, yet
It doesn't need to be a 'real app' or have users, just something you have deployed.
Everyone is invited to respond! cc/ @hanami/contributors