Openfoodnetwork: T&Cs .PDF files are missing after deployments

Created on 14 Dec 2020  路  8Comments  路  Source: openfoodfoundation/openfoodnetwork

Description


While testing #6526 it was noticed that the T&Cs .PDF files added on the Dashboard in the Business Details section are missing, after deployments. The link to the file remains there, and clicking it triggers a 404.

So far, was observed and is reproduced only in staging-UK and -AU. We should make sure this is not happening in production as well. I think this 404 error would not be detectable by our current monitoring.

If confirmed in production: could this be occurring with other settings?

Expected Behavior

.pdf file should be kept and remain accessible, both through the backoffice:

/admin/enterprises/<enterprise_name_here>/edit#/business_details

as well as in the checkout page

/checkout

Actual Behaviour

The .pdf file is missing after deployments, and attempting to access access it generates a 404 error.

Steps to Reproduce




Admin

  1. Add a T&Cs.PDF file under /admin/enterprises/<enterprise_name_here>/edit#/business_details
  2. Make sure this is readable in the BO - click on the link to view the file.

Customer

  1. Visit the shop from the Admin above, and add some items to the cart. Proceed to /checkout
  2. Make sure you can view the T&Cs file above

Replicating in Staging

  1. Deploy master in your staging server
  2. Can you access the .PDF file:
    i) in the BO?
    ii) as a customer?

Testing/Replicating in Production

  1. Before the weekly Release, check if you can you access the .PDF file:
    i) in the BO?
    ii) as a customer?
  2. Check i) and ii) after the new release was deployed.

Animated Gif/Screenshot


image.png

Workaround

Setting the .pdf file each time, after a deployment occurs.

Severity

Maybe an S3?
bug-s3: a feature is broken but there is a workaround

Your Environment

  • Version used: v3.4.4
  • Browser name and version: Firefox 83
  • Operating System and version (desktop or mobile): Ubuntu 20.04

Possible Fix

bug-s2

All 8 comments

I've set this up in a test shop in Katuma. This link should be accessible after the deployment of the upcoming release - it should not trigger 404. It's the same link for both admin and customer and does not require logging in:

This has now been reported in production, see:
https://openfoodnetwork.org.uk/ofn-uk-test-hub/shop

and the discussion in Slack:
https://openfoodnetwork.slack.com/archives/C02TZ6X00/p1608024278233200?thread_ts=1607940353.224600&cid=C02TZ6X00

Other questions raised: where are these files stored? S3, local server...?

Upgrading to S2 as discussed in the thread above - can we find out how many enterprises uploaded their file? - and moving to Dev Ready.

Yikes. There's a few local directories that are not persisted between deploys...

Ok, I've made some ofn-install changes that will allow us to persist PDFs between deploys. When it's ready to go we'll need to provision all servers and then copy any current T&C PDFs into the new path. And possibly rummage around in old builds for previous PDFs and copy them across as well... :see_no_evil:

We added this feature ~4 releases ago, so in theory we can have orphaned T&C PDFs in 4 different release backup directories in each instance. The paths are pretty standardised though, so in theory we can programatically pull those files out of all the release backups and into the new shared path.

Alright, the initial fix is working: https://github.com/openfoodfoundation/ofn-install/pull/685#issuecomment-747440876

I think I'll write a quick playbook to migrate previous PDFs to the new path, then we can do it on all servers at the same time. Otherwise fixing them one by one would be a total mess and would take a lot longer... #automatethesmallstuff

The 2 fixes I've created for this can be applied outside of release/deployment cycles (it's just ofn-install bits) :+1:

This should be fixed now :+1:

Was this page helpful?
0 / 5 - 0 ratings