I want to migrate my files from s3 back to local. I’m manually transferring all files from s3 to uploads folder. Then should be changing the base url of upload links, back to forum base url, sufficient to do the job done?
Why aren’t you using the built-in rake task? afaik it’s called uploads:migrate_from_s3
cd /var/discourse
./launcher enter app
rake uploads:migrate_from_s3
Then disable the enable s3 uploads site setting:
And finally rebake:
rake posts:rebake
Because my s3 is minio and I’m not sure if this function is compatible with it or not.
I tried this and after it was done, I didnt see any change in uploads. Still uploads are served from s3. btw the rake task was wierd to me. It ended so fast while I have thousnds of s3 uploads. It shouldve taked a while.
I have all my uploads transferred to local manually. Is there something that I can do to change all of the links in database and posts directly? I don’t need to use this rake task.
Did you figure this out? I’m also looking to migrate all assets (everything except backups) from S3 back to the local. Is there an easy way to do this?
I too am looking for similar option. But I read somewhere on this very site, that for this to work correctly, some big problems are to be sorted first. So, for the time being, they recommend not to shift S3 to local.
Though I’m also anxiously waiting for the solution to this problem.
There is a hidden site setting called something like “download S3 uploads to local on backup”. I think you can use that and restore to another server (or maybe your server if you change settings with shadowed site settings in environment variables). This is what cdck does when you close an account and I’ve never had trouble restoring one of their backups.
I did commanded that setting in Rails console SiteSetting.include_s3_uploads_in_backups = true. But it still didn’t (seem to) have any effect. The backup still was the same size (approx 375 MB, even when my uploads are around 700 MB to 1GB).
If by ‘Shadowed site settings’ you mean all the S3 site settings in Disco Web UI, then I do have all those settings filled in those fields.
I’m also looking to migrate my uploads from S3 to local (separate VPS). Is there a documented procedure for this?
Not really. I’d try using the setting I described above
Is there a way to find these hidden settings?
The one that you might need in context of this discussion is mentioned above. You can see them all in site_settings.yml in the Discourse source.
Questo rake task non è più disponibile in 2.9.0 BETA 8
Qualcuno ha idee su come migrare da S3 a locale?
Puoi attivare l’impostazione del sito nascosta chiamata qualcosa come download_s3_with_backups (non è proprio così ma non riesco a trovarla ora sul telefono) e poi ripristinare quel backup. Questo è ciò che accade quando lasci il hosting di cdck e funziona. Potrebbe essere necessario ripristinare su un server diverso (e comunque lo faresti per testare).
Modifica: grazie @Benjamin_D! è include_s3_uploads_in_backups
Quell’opzione non è disponibile nella pagina delle impostazioni dei controlli del sito Web di amministrazione, pagina delle impostazioni di Backup? Inoltre, non è l’opposto del download dei file S3?
No.
backup_with_uploads non è la stessa cosa di include_s3_uploads_in_backups. Uno include i file locali nel backup. L’altro scarica ogni singolo file da s3 ogni volta che si effettua un backup. E l’intero scopo di s3 è che non è necessario effettuarne il backup.
Quindi questo include i file locali durante il backup su S3
Questo scarica i file dallo store S3 per includerli nel backup (che potrebbe essere locale o su S3)
Sto cercando di capire i passaggi giusti qui, l’obiettivo è migrare tutti i file da S3 a locale, quindi se ho capito bene quello che stai dicendo:
- Abilita
backup_with_uploadsdalla console rails - Crea un backup (locale o su S3)
- Ripristina usando il backup
- Disabilita
backup_with_uploadsdalla console rails
È corretto?
Quindi, qual è l’approccio migliore per spostarsi da S3 al locale? ![]()
- Spostare manualmente i file (cartelle optimized/original) e fare un post-rebake dopo aver disabilitato l’opzione S3 da Discourse?
- Utilizzare l’opzione admin
download_s3_with_backupsin ombra, scaricare e decomprimere quei file? rake uploads:migrate_from_s3?
