-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
[16.0][MIG] storage_backend_s3: Migration to 16.0 #270
[16.0][MIG] storage_backend_s3: Migration to 16.0 #270
Conversation
- refactor the way to build the url (use a generic base_url). - make more generic the storage backend by moving specific feature in storage file - better name for variable "name" in store and retrieve method use "relative_path" instead - extra amazon S3 storage component in a separated module with test using vcrpy
…t with the specifiation of the type of file binary or base64
* support custom endpoint * refactor bucket handling * re-register vcrpy tests
Every time the selection field was loaded S3 API were called to retrieve regions. This can have a big impact on computing URLs and in any case is useless if we assume that regions do not change every now and then.
Hello maintainers and community, We've worked on migrating the storage_backend_s3 addon to Odoo 16.0. Changes made:
I kindly ask for a review of these changes and any feedback is greatly appreciated. Thank you for your time and effort. |
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.
Code review: LGTM!
@xavierpiernas Why do you need |
We have tested the suggested app and we have noticed that images uploaded to website are also stored in S3 but the preview is not working. Is this a normal behaviour? @lmignon |
@xavierpiernas Yes it's the normal behaviour. I'm developping a new addon dedicated to the store of images into a filesystem storage (#274) It defines a new kind of field from odoo import models
from odoo.addons.fs_image.fields import FsImage
class FsImageMixin(models.AbstractModel):
_name = 'fs.image.mixin'
_description = "FS Image Mixin"
image_1920 = FsImage("Image", max_width=1920, max_height=1920)
# resized fields stored (as attachment) for performance
image_1024 = FsImage("Image 1024", related="image_1920", max_width=1024, max_height=1024, store=True)
image_128 = FsImage("Image 128", related="image_1920", max_width=128, max_height=128, store=True) This new field also allows you to set and get the The main question here is to know how many resolutions we want to store by default.
In odoo 16 only the sizes 1920 and 1024 and 128 are used into the web and if even if you declare the an Image wihtout max_width and max_height, it will be limited by the system parameter |
Would it not be possible to allow Odoo to resize these images on the fly whenever the size parameters are specified in the request? Currently with the version we have installed, requests such as
I've tracked down the issue up to this point and I assume it is because the Stream object that we are creating does not have the data property set to a value that can be processed by the This Stream object is created via the Thank you for your time! |
@prgueza Is see how and where I could solve the problem you report. I'll keep you informed once it's done. Nevertheless you've to keep in mind that when you ask odoo to resize images on the fly, you consume cpu time and memory. The streaming benefits are also lost since the current implementation of the resize process need to get the image in memory and return the result as in memory bytes.... |
@lmignon Thank you very much, you are a lifesaver!
I completely agree! This is not ideal for us and we are also looking for better ways to do this, the solution you proposed here sounds perfect for us! However, I think that crashing like it does now is not ideal either, I'd much rather have it working while we look for a better alternative than seeing errors like the one I commented about. Something we are also looking into is being able to use the 1. If
|
@prgueza Thank you for all your feedback. Regarding the use and the configuration of
With When you ask for a file to odoo at All this is the theory and you could maybe encounter a bug also into this part. As soon as I've time, I'll set up our server to use Regards. |
Hi @lmignon! Thanks for your response!
I had read the documentation, but I hadn't though about the We will be keeping an eye on your progress with the bug fixes and stability features for this module, thanks for your contributions! As of today we don't have the time nor the knowledge to contribute more than with user testing and bug reporting. |
Hi @prgueza
The bugs are now fixed in #274. The commit history has to be cleaned up and some specific unittests added.
Functional tests and good bug reports are valuable contributions. Regards |
Thank you for your hard work and dedication. We're currently in the process of testing the new fs_image module, and it's performing well in displaying image previews. However, we've encountered difficulties when attempting to migrate our existing attachments from the filestore. We've implemented a scheduled action that executes the "force_storage" function, which appears to be the main one. Unfortunately, every time we initiate this process, our environment loses connection. It's possible that this issue is related to performance limitations in our development environment. We're planning to address this by allocating additional resources. Additionally, we've experimented with a server action that executes the "_move_attachment_to_store" function for individual attachments and small sets. While it has proven effective for some, it does not work consistently for others. We would greatly appreciate any insights or guidance you could provide to help us navigate this migration process and ensure a successful outcome. |
@xavierpiernas Do you've solved your problem? What's the status of this PR? If you want to have it merged, can you fix the conflicts? Regards |
Greetings @lmignon, Good news! We've successfully migrated the attachments using the "fs_" apps. This means we no longer need the "storage_backend_s3". I think sticking with the "fs_" apps, especially with the new "fs_image," is a better option. So, I think we can close this PR. Thanks a lot for your help. Cheers. |
Thank you for your feedback @xavierpiernas . |
No description provided.