Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Script to migrate images between providers #9117

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

FranciscoJBrito
Copy link

Pull Request Template

Description

Storage migration functionality, which allows the transfer of images from one on-premises provider to another (e.g. AWS, Google, etc.) using Active Storage.
I ran the unit and integration tests and they all passed correctly.

The command to execute the migration is FROM=from_service TO=to_service rake storage:migrate

Fixes #7907

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I have tested the storage migration functionality by running the provided unit and integration tests. Additionally, I manually tested the migration process in a local development environment by following these steps:

Set up two storage services (e.g., AWS S3 and Google Cloud Storage) with valid configurations.
Execute the FROM=local TO=amazon rake storage:migrate task with appropriate FROM and TO arguments to migrate blobs between the services.
Verified that the blobs were successfully transferred to the target storage service.
Checked for any error messages or unexpected behavior during the migration process.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules


puts "#{ActiveStorage::Blob.count} Blobs to migrate from #{from_service_name} to #{to_service_name}"
ActiveStorage::Blob.find_each do |blob|
next unless blob.image?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line prevents uploading of audio files received via WhatsApp. It will possibly impact PDF's and other files in general.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hiagodotme, of course, I assumed they wanted to export only images because the issue specifically mentioned images, but we can add other types of files without a problem. 👍🏼

Copy link

🐢 Turtley slow progress alert! This pull request has been idle for over 30 days. Can we please speed things up and either merge it or release it back into the wild?

@github-actions github-actions bot added the stale label Apr 27, 2024
@FranciscoJBrito
Copy link
Author

Hi @sojan-official, can I ask you for help with the checks that I am not being able to pass, if you can help me identify what the problem is why I am not being able to pass the checks???

@github-actions github-actions bot removed the stale label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Script to change local-storage to AWS
3 participants