Continuing the discussion from How do I move my s3 upload bucket from one provider to another?:
I’m trying to move from a GCP bucket to an AWS S3 bucket. The old system doesn’t use an S3 CDN (the guy who set it up didn’t really know what he was doing, apparently).
I used s3cmd
to sync the old GCP bucket to a local filesytem, then used it again to push the assets to the new S3 bucket. The system is now properly configured with S3 and site CDNs as described in Using Object Storage for Uploads (S3 & Clones).
The above-linked topic suggested using rake posts:remap
to update the posts (I guess I should also rebake all posts? Or at least those matching the old bucket?).
When I did the posts:remap
it remapped only one post.
Upload.order(Arel.sql('RANDOM()')).limit(10).pluck(:id, :url)
shows all of those having the old bucket… Ah. that’s the issue. We need not a rake posts:remap
but a discourse remap
as described at Change the domain name or rename my Discourse?.
Yes. I think so.
I’ll see about getting that done Real Soon Now. @Falco , in broad strokes, it’s something like
- create new bucket and CDN for it, rebuild container to use the new bucket/CDN & make sure it works
- configure
s3cmd
for the old bucket and sync the data to local. - configure
s3cmd
for the new bucket and sync the data up to the new bucket - do a
discourse remap OLD-BUCKET-DOMAIN-NAME NEW-BUCKET-DOMAIN-NAME
- rebake
Does that seem right?
If you use the same CDN for the old an new bucket, you might save having to do the rebake, but getting that timing just right seems a bit tricky (can’t change the CDN origin until data is in the new bucket, but you’d need to somehow make sure that nothing got uploaded to the old bucket during the sync process?)–maybe just say that it’s possible.