Migrating uploads from s3 to local

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
2 Likes

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?

2 Likes

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.

2 Likes

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.

3 Likes

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.

1 Like