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.
Diese Rake-Aufgabe ist in 2.9.0 BETA 8 nicht mehr verfügbar.
Hat jemand Ideen, wie man von S3 zu lokal migriert?
Sie können die versteckte Website-Einstellung aktivieren, die ungefähr download_s3_with_backups heißt (das ist nicht ganz richtig, aber ich kann sie gerade nicht auf meinem Handy finden) und dann dieses Backup wiederherstellen. Das passiert, wenn Sie cdck Hosting verlassen, und es funktioniert. Möglicherweise müssen Sie auf einen anderen Server wiederherstellen (und das würden Sie sowieso zum Testen tun).
Bearbeiten: Danke @Benjamin_D! Es ist include_s3_uploads_in_backups
Ist diese Option nicht auf der Seite „Einstellungen“ in den Steuerelementen der Admin-Website verfügbar, auf der Seite „Backup-Einstellungen“? Ist das nicht auch das Gegenteil des Herunterladens der S3-Dateien?
Nein.
backup_with_uploads ist nicht dasselbe wie include_s3_uploads_in_backups. Das eine schließt lokale Dateien in das Backup ein. Das andere lädt jede einzelne Datei von S3 herunter, jedes Mal, wenn Sie ein Backup erstellen. Und der eigentliche Sinn von S3 ist, dass Sie keine Backups davon erstellen müssen.
Beinhaltet dies lokale Dateien bei der Sicherung auf S3?
Dies lädt Dateien aus dem S3-Speicher herunter, um sie in das Backup aufzunehmen (welches lokal oder auf S3 sein kann).
Ich versuche, die richtigen Schritte hier zu verstehen. Das Ziel ist es, alle Dateien von S3 auf lokal zu migrieren. Wenn ich also richtig verstehe, was Sie sagen:
- Aktivieren Sie
backup_with_uploadsüber die Rails-Konsole - Erstellen Sie ein Backup (entweder lokal oder auf S3)
- Stellen Sie mit dem Backup wieder her
- Deaktivieren Sie
backup_with_uploadsüber die Rails-Konsole
Ist das richtig?
Also, was ist der beste Ansatz, um von S3 zu lokal zu wechseln? ![]()
- Die Dateien manuell verschieben (optimierte/originale Ordner) und nach dem Deaktivieren der S3-Option von Discourse einen Post-Rebake durchführen?
- Die beschattete Admin-Option
download_s3_with_backupsverwenden, diese Dateien herunterladen und entpacken? rake uploads:migrate_from_s3?
