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.
此 rake 任务在 2.9.0 BETA 8 中不再可用。
有人知道如何从 S3 迁移到本地吗?
您可以启用一个隐藏的站点设置,名为 download_s3_with_backups(不完全是这样,但我现在在手机上找不到它),然后恢复该备份。当您离开 cdck 托管时就会发生这种情况,而且它确实有效。您可能需要恢复到不同的服务器(并且您无论如何都会进行测试)。
编辑:谢谢 @Benjamin_D!它是 include_s3_uploads_in_backups
不。
backup_with_uploads 与 include_s3_uploads_in_backups 不同。前者将本地文件包含在备份中。后者每次进行备份时都会从 s3 下载每一个文件。而 s3 的全部意义在于您不需要备份它。
那么这包括在备份到 S3 时包含本地文件吗?
这会从 S3 存储下载文件以包含在备份中(可以是本地的或 S3 上的)
我正在尝试理解正确的步骤,目标是将所有文件从 S3 迁移到本地,所以如果我理解你的意思:
- 从 rails 控制台启用
backup_with_uploads - 创建一个备份(本地或 S3 上)
- 使用备份进行恢复
- 从 rails 控制台禁用
backup_with_uploads
这是正确的吗?
那么,从 S3 迁移到本地的最佳方法是什么?![]()
- 手动移动文件(优化/原始文件夹)并在禁用 Discourse 的 S3 选项后进行后置烘焙?
- 使用隐藏的
download_s3_with_backups管理员选项,下载并解压这些文件? rake uploads:migrate_from_s3?
