Openfoodnetwork: Rails 4 fingerprinted assets

Created on 19 Jun 2020  路  11Comments  路  Source: openfoodfoundation/openfoodnetwork

We still have some issues with non-fingerpritned assets being called from the codebase. Rails 4 basically does not do non-fingerprinted assets, at all.

More background here: https://github.com/openfoodfoundation/openfoodnetwork/issues/5622#issuecomment-645891351

So basically it looks like we still have a bunch of places in the codebase where we are calling assets in a way that will not include the fingerprint, and we need to fix that.

bug-s3 v3-regression

Most helpful comment

ok, makes sense. I think it's well labelled then: S3, regression, we should fix it now but will not block the release :+1:

All 11 comments

It looks like this applies to fonts as well as images, and we'll need to check basically anything that's in the /app/assets/* directories.

:+1:
This is bug right? There will be images and icons missing from the app?
Is this a release blocker? (we should upgrade to S2 if it is). Anything major missing in the app?

Hi - Just a brief feedback from my side: During testing of the release I haven't found anything major missing from the app, all pics seem to be there, so far.

@luisramos0 I think that all assets work so far due to the combination of ofn-install's (dangerous) symlink plus assets being placed in public/ that @Matt-Yorkley described in the other issue. But it's a bit messy and makes all feel uneasy and lower our confidence so we better get as close to Rails default as we can.

This is bug right? There will be images and icons missing from the app?

It's a worrying issue, but it shouldn't actually affect current OFN production servers at the moment, unless we start adding new assets or changing old ones. So it's not a critical bug, but we should fix it as a priority.

Basically the work that needs to be done will look a bit like this PR, but for some of the other assets (like fonts and maybe some other images) where their URLs are still being generated without fingerprints. "Non-digest assets" are now completely ignored by Rails in the precompile step.

As a side note; on any _new_ servers that are deployed, lots of assets will be broken for sure (until we fix this).

I think it'll be fairly straightforward to find out which assets are processed with the assets:precompile:nondigest rake task in Rails 3.2. https://github.com/rails/rails/blob/e17e25cd23e8abd45b1706463dd57c90fa6dcb7c/actionpack/lib/sprockets/assets.rake#L33-L57 is the code responsible for doing so, which calls the Sprockets::StaticCompiler.

unless we start adding new assets or changing old ones

With still ongoing efforts on mobile touching scss and assets, that's going to happen soon :see_no_evil: .

ok, makes sense. I think it's well labelled then: S3, regression, we should fix it now but will not block the release :+1:

Remaining bits:

  • [x] user-uploaded images (products, enterprise logos, etc) are not affected, they're handled by either Paperclip or S3 and will not require changes
  • [x] there are still a few images that need fixing, for things like the "no-image" image, eg the default image shown for a product when no product image has been uploaded yet
Was this page helpful?
0 / 5 - 0 ratings