Open neilarellano opened 3 weeks ago
@antidipyramid The issue here is that while the event packets exist within the s3 bucket and staging/production databases have the correct slugs to find each event's packet, the full urls always point to the testing bucket. There is an event.packet.is_ready
method in the event template that's in charge of displaying the download link, which returns true if the attachment url resolves with a 200 status code. Most attachments on both environments seem to exist in the testing bucket, and most resolve correctly. But there are a handful including the above Planning and Program Committee attachment that actually exist in the prod bucket instead.
Another example is this PTSC meeting. These can be tested using something like https://<bucket name>-testing.s3.amazonaws.com/<event slug>.pdf
and removing the "-testing" portion of the url checks if it's in the prod bucket.
Do you have an idea what is uploading these attachments? I'm imagining a couple solutions here, and both could be used simultaneously:
is_ready()
to check the prod bucket if the url doesn't resolve.@xmedr We set the attachment bucket URL as an environment variable in Heroku. It looks like the MERGE_HOST
variable on the prod site was set to the testing URL so I imagine that's the source of the problem 🙂
We'll also need to update that variable in the prod Dashboard as well. After, we may need to do some manual work to update packet URLs in the database.
I'm actually not super familiar with the attachment logic so pairing on this might be a good way for both of us to learn more. What do you think?
@antidipyramid That sounds great! I'll put a time on the calendar for next week, feel free to move it if you need to
@hancush We figured out what was pushing packets over to testing as opposed to the production bucket, and have a fix coming to make sure that future packets/attachments always get uploaded to prod. The next task would be to correct previous urls in the councilmatic db to point to the right bucket. We have two options here and wanted to get your opinion on them:
@xmedr I'd go programmatic. To confirm, you're proposing something like this?
# for packet in packets with testing urls
# check for packet in prod bucket
# if packet in prod bucket
# update to prod url
Might I suggest an else clause that runs the merge if the packet is not in the prod bucket?
# else
# mark packet as not ready
# run merge for packet
Conveniently, you can simply call the packet's save()
method to run the merge, then it will update the URL for you.
N.b., this script / migration should run after the merge host is updated to the production bucket, if it hasn't been already.
To confirm, you're proposing something like this?
Right! That's exactly what I was thinking. And thanks for those extra tips, I'll be using them.
this script / migration should run after the merge host is updated to the production bucket
Agreed. Councilmatic prod has already had its merge host updated, so I should be alright to get started on this.
@antidipyramid will open a separate PR to update the dashboard environment variables with the correct endpoints as well.
We noticed that Planning and Programming and Finance, Budget, and Audit Committee Meetings for this month are missing the “Download Agenda and Attachments” buttons.
The script for this second link may not be working.