-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
[#6531] Store raw emails with ActiveStorage #6539
Conversation
4e79c16
to
55efdc3
Compare
45c6213
to
430f2b9
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.
Magic! 🧙 Couple of minor tweaks to address but all good in principle. Haven't run it with S3 backend but – I presume – one wouldn't really notice much change!
Probably want to coordinate when we merge this to make sure we've got the config files in place and a plan for migration.
db/migrate/20210928115500_create_active_storage_tables.active_storage.rb
Outdated
Show resolved
Hide resolved
@garethrees any other thoughts on the fix ups before I merge? |
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.
any other thoughts on the fix ups before I merge?
Looks great! Nothing significant that I can think of, but a couple of small inline comments. Don't need to re-review.
48fedd5
to
8153c03
Compare
8153c03
to
1f16801
Compare
8b20931
to
6a32693
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.
This all looks great! Such an improvement!
The performance is noticeably slower, obviously, and that might get passed on to users since it is possible for us to do a first-parse of a raw email during the request cycle. I expect many will be parsed before storage:promote
happens, but they might not be. We did once proactively parse pro requests, so we could re-introduce something like that if it becomes a problem. I think we'll want to keep an eye on the amount of GET
requests we're seeing, since the only other place we'd see a GET
, I think, is via /admin/raw_emails/:id.format
.
Defaults to disk storage but adds example config and the gems required to store in Amazon S3 (or S3 like services), Azure or Google Cloud Storage. Fixes #6530
Preparing for a new context when we move to a `ActiveStorage` backed file store.
When the `ActiveStorage::Blob` file isn't attached then use the old file store. There are no specs currently for the `#directory` and `#filepath` methods. This due to a `if Rails.env.test?` conditional in the model. These methods won't be used when a install switches to `ActiveStorage` and so they can be deprecated.
This won't be used in 0.42 as in 0.41 installs will be required to migrate to `ActiveStorage`.
Add tasks to: 1. mirror files from primary ActiveStorage backend to secondary backends 2. promote mirrored files to be served from the secondary backend 3. unlink primary file if mirrored and promoted to secondary backend.
6a32693
to
f70328e
Compare
Relevant issue(s)
Fixes #6530
Fixes #6531
What does this do?
ActiveStorage
support for raw emailsrake
task to migrate raw emails on disk to aActiveStorage
backed file store.Why was this needed?
ActiveStorage
is integrated with cloud based services to so file stores can exist on S3. This will help installations as on disk raw emails file stores can get quite large. This makes migrated servers difficult and limits the ability to run more than one application instance.Implementation notes
The application doesn't require migration straight away and will fall back to the old file store if the files aren't attached.