Looks like images are broken in v3 in AUS and UK staging servers. We need to investigate.
Product images show up.
No images.
Go anywhere on staging AUS and check product images.
none yet.
bug-s1: a critical feature is broken: checkout, payments, signup, login
We need to look at this immediately if we want to release this week.
I've been investigating this a bit. It looks like there have been some slight changes to the way assets are precompiled, which affect images added in /assets/images/*.
Oh wait, I was just about to start working on it.
It seems to affect some images and not others. Quick example, if you go to a shop page and look at the search bar, it should have this icon in the searchbar:

It's missing in Rails 4.
I'll write up some other notes here that are important background for the issue, as I think we maybe haven't seen the last of it:
ofn-install is that we symlink a shared assets folder into the build before precompiling (this isn't new, we've been doing it since 2014). The reason we do this is to handle shared assets that are instance-specific (custom banners, logos, PDFs, etc) that are kept on the server and not in the codebase. The (unintended) result of this is that some precompiled assets are left in that folder between builds, which is probably not a good idea. We end up with old precompiled (fingerprinted) assets that are out of date and just taking up space, and additionally there seem to be some non-fingerprinted versions of old assets here (like images) that are present in this folder. This is why we're seeing some of these issues with some images and not others, namely: certain old images are present in non-fingerprinted form, but new ones are not./app/assets/images, and not to other more dynamic assets like product images, enterprise images, etc.For reference, paths for images and icons should be written like this:
image_tag, image_path, etc.../app/assets/images folder/ at the beginning, it will _not_ correctly include the fingerprint, and possibly break/app/assets/images/home/banner.jpg should be: image_path("home/banner.jpg"). This will correctly add the fingerprint when generating the image URL.#image-urlawesome, I added this last part to the wiki: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Developer-Guidelines
Nice write up @Matt-Yorkley ! That we had a mess with assets across this repo and ofn-install was kind of known. Know we know what is exactly :muscle: .
As per your investigation is there something we need to do to undo the mess in ofn-install? All that seems incredibly brittle and too unknown. We should get to vanilla Rails asset management to avoid trouble.
Yes, I was thinking that too. The way we move instance-specific assets into the build needs to be rethought, for sure. I think we'll need to proceed a bit cautiously though...
Great summary @Matt-Yorkley!
The keeping of old assets was very useful for zero-downtime deployments in the past. We could precompile the new assets and then do other stuff like migrations while the site was still working and pointing to the old fingerprints. Only after reloading unicorn pages would link to the new fingerprints.
Now we re-link the app directory and reload unicorn very closely together, possibly within the same second (sometimes slowed down by Ansible connections). So replacing the assets directory would introduce only minimal downtime (broken pages due to JS and CSS not found).
I'm still wondering about the approach of re-writing unicorn.rb during deploy so that we don't need to re-link the directory and reload unicorn in two different steps. Reloading unicorn would then automatically load a new config with a new app directory and we would ensure an atomic switch to the new version. But that's close to micro-optimisation at the moment.
Most helpful comment
Yes, I was thinking that too. The way we move instance-specific assets into the build needs to be rethought, for sure. I think we'll need to proceed a bit cautiously though...