For the record I eventually got this to work. I started fresh (i.e. from a snapshot of my instance) and I’m fairly certain the process that worked in the end was:
- use the rails console to run
SiteSetting.include_s3_uploads_in_backups=true - create a new backup
- restore from this backup
- use
discourse remapto update references to my various S3 file locations to a local location - rebake posts and rebuild both my docker containers
Thanks @pfaffman for pointing me in the right direction here.
EDIT
I might as well raise this. After my previous post, I realised that six of our topics still have broken images (though the vast majority are OK now).
They are our six oldest posts and all the original images had a different S3 URL than all the others. Clearly this isn’t coincidence. So I checked that all those files are in the uploads/default/original/1X directory, and they all are. Then I ran a remap command using this unique S3 URL - and that appeared to edit the right number of posts. Then I rebaked and rebuilt the containers, but these topics are still broken. Does anyone have any idea why a small number would fail like this?