To migrate documents stored in ActiveStorage from S3 to a storage in the local file system, do the following:
-
Configure a
local
service inconfig/storage.yml
: -
Run the following script to download all files from S3 and store them in your local file system. Note that at while this runs, you should not create new documents as those would otherwise be missing.
Script taken from https://www.stefanwienert.de/blog/2018/11/05/active-storage-migrate-between-providers-from-local-to-amazon/
-
Change the storage service in
config/production.rb
tolocal
and re-deploy: -
You can now re-enable creation of new documents.