Active Storage local data transfer

kjdelys kjdelys posted on 2024-04-23 05:16:28 UTC

Hello guys,
I'm facing a strange issue with active storage. I had an app using active storage locally on production. I'm now moving this data to a S3 compatible storage on contabo. I copy paste the content of my local storage in s3 bucket but it's not working. Image are not found.
Any idea?
Thanks in advance.

David Kimura PRO said 15 days ago :
You may need a rake task to run on the blobs. In the Rails console, look up a Blob that was uploaded.
ActiveStorage::Blob.first.service_name
It will likely return something like
local

Whatever you have set for the name in the storage.yml will be what you need to set for the service_name. You can bulk update this with something like
ActiveStorage::Blob.update_all(service_name: 'contabo')
Where, in this example, contabo would be the top level key name of the service in the storage.yml.

kjdelys PRO said 15 days ago :
Hey David,
I tried that. Not still working. The images are still broken.

kjdelys PRO said 9 days ago :
It seems it works now. To be honnest i don't know what changed

Login to Comment
Back to forums