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
Active storage migrations service #7902
Conversation
I've change the seeds to generate much more attachments and seed attachments for all uploaders defined with CW. This modified seed process creates 13322 attachments with a total size of 584M.
In both cases all the files were migrated with the same checksum. I've used the files used by seeds usually and added another one for some new attachments. These are the files:
It would be nice to test the task in a more realistic environment |
5f6b12d
to
20a2059
Compare
4544f40
to
7346e1b
Compare
Rebased on top of |
7346e1b
to
c65d370
Compare
d6b1a29
to
6bda58d
Compare
…chment! CarrierWaveMigratorService method
When attachment is remote and large enough the file is stored in a Tempfile, but if it's small URI.open returns a StringIO. This methods calculates the checksum correctly both when original attachment is local or stored remotely
9405466
to
088c28c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!! 👏👏
* develop: (32 commits) Remove obsolete rake webpack task (#8237) Active storage migrations service (#7902) Fix content type delegation to blank attachments (#8230) Evote bug fixing (#8220) Fix the proposal data migration for proposals without authors or organization (#8015) Bump addressable version because security issues (#8229) Online meetings iframe visibility with time (#8097) Meetings iframe and iframe URL (#8096) Remove flaky test on meetings (#8226) Fix broken tests after problematic PRs (#8224) Apply permissions system to comments (#8035) Set current_component as commentable when commentable is a participatory space (#8189) Fix don't require inactive authorization handlers (#8122) Improve metrics calculations performance (#8215) Fix performance issue in notification settings page (#8155) Active storage migration (#7598) Update manual installation guide in documentation (#8217) Load JS configuration in elections focus mode layout (#8213) Fix user activity pagination when there are hidden items (#8202) Make it possible to define SCSS settings overrides from modules (#8198) ...
* Add service to migrate CarrierWave attachments to ActiveStorage * WIP * Change migration to add checks, migrate content blocks and use CW uploaders * Include check info in migration tasks * Remove duplication * Prepare migration service to work with CarrierWave::Storage::Fog attachments * Disable rubocop offense to allow excess of parameters in migrate_attachment! CarrierWaveMigratorService method * Change checksum calculation of file depending of its type When attachment is remote and large enough the file is stored in a Tempfile, but if it's small URI.open returns a StringIO. This methods calculates the checksum correctly both when original attachment is local or stored remotely * Fix rubocop offense * Remove unused method * fix: don't migrate models from modules not loaded * Fix file cw_file method when cw attachments are stored in local filesystem * Fix lint issues * Force the loading of the models in MIGRATION_ATTRIBUTES constant * Skip allowlists in CW uploaders * Use relative path in favicon_link_tag * Update CHANGELOG.md * Use protocol if required in urls generated by application_uploader * Revert "Use relative path in favicon_link_tag" This reverts commit 09542dd. Co-authored-by: Fernando Blat <fernando@blat.es> Co-authored-by: Leonardo Diez <leiodd@gmail.com>
* Add service to migrate CarrierWave attachments to ActiveStorage * WIP * Change migration to add checks, migrate content blocks and use CW uploaders * Include check info in migration tasks * Remove duplication * Prepare migration service to work with CarrierWave::Storage::Fog attachments * Disable rubocop offense to allow excess of parameters in migrate_attachment! CarrierWaveMigratorService method * Change checksum calculation of file depending of its type When attachment is remote and large enough the file is stored in a Tempfile, but if it's small URI.open returns a StringIO. This methods calculates the checksum correctly both when original attachment is local or stored remotely * Fix rubocop offense * Remove unused method * fix: don't migrate models from modules not loaded * Fix file cw_file method when cw attachments are stored in local filesystem * Fix lint issues * Force the loading of the models in MIGRATION_ATTRIBUTES constant * Skip allowlists in CW uploaders * Use relative path in favicon_link_tag * Update CHANGELOG.md * Use protocol if required in urls generated by application_uploader * Revert "Use relative path in favicon_link_tag" This reverts commit 09542dd. Co-authored-by: Fernando Blat <fernando@blat.es> Co-authored-by: Leonardo Diez <leiodd@gmail.com>
…ploader and add `url` method that was originally added in Decidim::ApplicationUploader see also: decidim/decidim#7902
🎩 What? Why?
This PR add the tasks required to migrate files in CarrierWave to ActiveStorage attachments:
tmp/attachment_mappings.csv
. If the task detects that there already exists an attached file with ActiveStorage the export is skipped and no checks are made. To run this task execute:Both tasks generate a log file in
log/
with the result of the migration of each file and/or the checksum verification result.📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/
.📷 Screenshots
Please add screenshots of the changes you're proposing