Why isn't Geroku using a good .yml manifest

I am using Rails 3.2.2 on Heroku with CDN (CloudFront) to host assets.

I'll try the Heroku tutorial (https://devcenter.heroku.com/articles/cdn-asset-host-rails31) with the asset_sync gem.

No asset issues: precompile, all my assets are hosted on my S3 bucket.

-> heroku run bundle exec rake assets: precompile                                                                                                                                                            
    Running bundle exec rake assets: precompile attached to terminal ... up, run.1
    AssetSync: using default configuration from built-in initializer
    AssetSync: Syncing.
    Using: Manifest /app/public/assets/manifest.yml
    Uploading: assets / facebook_64-8cdc90984860efef829203e1e01aab10.png
    Uploading: assets / google_64-11634a6b4a219799449e7a7157f73387.png
    Uploading: assets / twitter_64-657ee379209d0bb998440421b499a6a2.png
    Uploading: assets / application-699d029330a2d095a9b59006a63a7b01.js
    Uploading: assets / application-2060c0efc074ae11265455479abfb6ff.css
    Uploading: assets / back_office-ccfdd79c9b296176087815c95607f540.css
    AssetSync: Done.

The problem is Heroku is trying to access bad CSS files:

<link href="http://s3.amazonaws.com/annoncestest/assets/application-85cc4376a5de3b224db7c0548a44e7cb.css" media="all" rel="stylesheet" type="text/css" />

>


As you can see, MD5 for a CSS application is different from it.

However, there is no problem with JS files or other entities that are not CSS files.

In my bucket, manifest.yml is referencing a good file application-2060c0efc074ae11265455479abfb6ff.css

but Heroku is always trying to accessapplication-85cc4376a5de3b224db7c0548a44e7cb.css

I tried to set the manifest path in my production.rb with:

config.assets.manifest = "http://myapp.cloudfront.net/assets"

or config.assets.manifest = "http://myapp.cloudfront.net/assets/manifest.yml"

The css files are bad every time.

I have no idea what the problem is. Any idea?

+1


source to share


2 answers


I am solving the problem thanks to heroku support.

First, my deployment didn't work well because I had a known issue during rake assets: precompile

could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP / IP connections on port xxxx?

To prevent this, you need to set initialize_on_precompile

to false in config / application.rb (not in your config / environment / production.rb):

config.assets.initialize_on_precompile = false
      



After that, when you deploy the precompilation it seems to work, but the problem with asset_sync not finding your ENV variables (FOG_DIRECTORY and FOG_PROVIDER)

To fix this problem, you need to install heroku labs with these two commands:

heroku plugins:install https://github.com/heroku/heroku-labs.git
heroku labs:enable user_env_compile
      

And you deploy to the hero again and (theoretically) he should work fine! (it works for me!)

Hope this helps someone in the future!

+1


source


I'm not sure if that would help or not, but I don't check the manifest.yml on any of my pipeline projects. This is because the Heroku builder will run the precompiled assets that generate a new manifest that you know is correct.



I would remove it from Git and see how it works (compiling assets locally before deploying is something you don't need to do when pushing to Heroku)

0


source







All Articles