Commit Graph
227 Commits
Author SHA1 Message Date
Patrick TombezandYannick Vaucher c03dd2ce80 fix: Update bucket name format for new convention defined in platform specifications 2021-11-03 12:37:27 +01:00
Patrick TombezandYannick Vaucher e20f833f4f [13.0][ADD] cloud_platform_azure 2021-11-03 12:37:27 +01:00
Yannick VaucherandGitHub bf51e0a122 Merge pull request #273 from camptocamp/12.0-bp-cloud-abstract
[12.0] Backport of cloud abstraction
2021-11-03 12:26:44 +01:00
Yannick VaucherandGitHub 848fa2873c Merge pull request #274 from camptocamp/12.0-bp-monitoring_promotheus
[12.0] Backport monitoring_promotheus from 13.0
2021-11-03 12:26:31 +01:00
Patrick TombezandYannick Vaucher c4cf4cb092 [13.0][IMP] Make cloud_platform fully abstract + update related modules (#244) 2021-11-03 10:11:41 +01:00
Yannick Vaucher 77f54c400c Backport monitoring_promotheus from 13.0 2021-11-03 10:05:51 +01:00
Patrick TombezandYannick Vaucher e6e3c34008 [13.0][ADD] monitoring_prometheus (#239)
[13.0][ADD] monitoring_prometheus
2021-11-03 09:58:56 +01:00
Yannick VaucherandGitHub 9bf1c0acf5 Merge pull request #262 from yankinmax/imp_add_s3_bucket_registry
[12.0][IMP] Add S3 Bucket Registry to store clients.
2021-10-12 18:54:05 +02:00
Yannick VaucherandGitHub 13c19a6669 Merge pull request #260 from nilshamerlinck/12.0-backport-attachment_azure
[MIG] attachment_azure: Backport from 13.0 to 12.0
2021-10-12 18:48:18 +02:00
Yannick VaucherandGitHub 355e73078a Merge pull request #263 from grindtildeath/12.0-fix-typeerror_resource_bucket_name
[12.0] attachment_s3: Fix TypeError with bucket_name
2021-10-05 16:56:44 +02:00
Akim Juillerat 80fd0bf130 attachment_s3: Fix TypeError after setting bucket_name in s3 resource params 2021-10-05 16:55:14 +02:00
Akim JuilleratandGitHub 6564ab7c97 Merge pull request #109 from grindtildeath/12.0_attachment_s3_connection_params
[12.0] attachment_s3: allow to override connection parameters
2021-09-28 16:54:12 +02:00
Akim Juillerat 143cede910 attachment_s3: allow to override connection parameters
_get_s3_connection_params can now be overrided to use different connection parameters
2021-09-28 15:56:31 +02:00
Maksym Yankin e1ab8233cd Add S3 Bucket Registry to store clients.
Each time _store_file functions are called a new S3 Bucket object was created.
Instead of creating a new one, we store the client in a Bucket Registry
to avoid checking if the Bucket exists every time.
2021-09-28 16:56:12 +03:00
Nils Hamerlinck dd245bd7c6 [12.0][IMP] attachment_azure: don't get blob content if we only need its size 2021-09-04 20:33:43 +07:00
Nils Hamerlinck 33d7ed3b91 [MIG] attachment_azure: Backport from 13.0 to 12.0 2021-09-04 20:33:43 +07:00
Nils Hamerlinck d801619f92 [13.0][FIX] attachment_azure: in 13.0, _file_read() is expected to return base64 encoded data 2021-09-04 17:57:23 +07:00
Patrick TombezandNils Hamerlinck 34a0045600 [MIG] attachment_azure: Backport from 14.0 to 13.0 2021-09-04 17:56:43 +07:00
Patrick TombezandNils Hamerlinck 0567247e98 [14.0][IMP] attachment_azure: Allow storage name override 2021-09-04 17:56:43 +07:00
Vincent RenavilleandNils Hamerlinck db9d9d5d37 [IMP] Add identity (#238)
* [IMP] can use ad identity to access storage
2021-09-04 17:56:03 +07:00
Nils Hamerlinck ac356bdffe [FIX] attachment_azure: clean dbname to fit with container naming rules 2021-09-04 17:56:03 +07:00
Nils Hamerlinck fdfdeab9eb [FIX] attachment_azure: higher level of permissions needed to create container and upload blobs when using the SAS token 2021-09-04 17:56:03 +07:00
Hiren PattaniandNils Hamerlinck f1dd47f960 [ADD] attachment_azure 2021-09-04 17:56:03 +07:00
Yannick VaucherandGitHub ff0deb2a61 Merge pull request #246 from grindtildeath/12.0-fix-base_fileurl_field_demo_test
[12.0] base_fileurl_field: Consider test mode and installation of demo data
2021-08-10 11:06:56 +02:00
Denis Leemann 849181c4a0 Run manually pre-commit hook 2021-08-09 16:15:45 +02:00
Akim Juillerat e82fe205a0 base_fileurl_field: disable pylint W8106:method-required-super 2021-08-05 14:25:56 +02:00
Akim Juillerat f36dd1bd00 base_fileurl_field: Consider test mode and installation of demo data 2021-08-02 14:37:49 +02:00
Yannick VaucherandGitHub 3cf835dbd2 Merge pull request #230 from yvaucher/12.0-bp-fix-bucket-name
[12.0] [FIX] Bucket name formatting
2021-05-31 09:50:30 +02:00
Miku LaitinenandYannick Vaucher 03bff76f7e [FIX] Bucket name formatting 2021-05-31 09:45:05 +02:00
Yannick VaucherandGitHub f800a4d9b7 Merge pull request #227 from yvaucher/12.0-bp-multi-tenancy
[12.0] [BP] attachment_s3: multi-tenancy use db name in bucket
2021-05-28 12:34:59 +02:00
Yannick Vaucher 6aeebfc455 attachment_s3: multi-tenancy use db name in bucket
Adds the possibility to insert `{db}` placeholder in the bucket name
that will be replaced by the database name to form a unique bucket
name per database.
2021-05-27 18:17:51 +02:00
Yannick VaucherandGitHub 1bd88f1e72 Merge pull request #220 from theoo/12.0
[IMP] session_redis: allow configuring Redis URL instead of host & port.
2021-04-12 20:54:36 +02:00
Miku LaitinenandThéo Reichel 86fc51b5a9 [IMP] session_redis: allow configuring Redis URL instead of host & port.
Back-porting from [13] branch
2021-03-29 18:26:21 +02:00
i-vyshnevskaandGitHub a64024dfe0 Merge pull request #197 from camptocamp/12.0-fix-force-storage-db
[12.0][IMP] force storage db
2020-09-14 13:52:55 +03:00
Iryna Vushnevska 6337607e2c [IMP] adapt features to v12 2020-08-25 15:34:53 +03:00
Guewen BaconnierandIryna Vushnevska b05c5eeb8b Rework and fix storage forced in database
The initial issue that triggered this rework is that the forced storage in
database was working only on writes, and was never applied on attachment
creations.

This feature is used to store small files that need to be read in a fast way in
database rather than in the object storage. Reading a file from the object
storage can take 150-200ms, which is fine for downloading a PDF file or a single
image, but not if you need 40 thumbnails.

Down the path to make a correction, I found that:

* the logic to force storage was called in `_inverse_datas`, which is not called
  during a create
* odoo implemented a new method `_get_datas_related_values`, which is a model
  method that receive only the data and the mimetype, and return the attachment
  values and write the file to the correct place

The `_get_datas_related_values` is where we want to plug this special storage,
as it is called for create and write, and already handle the values and
conditional write. But using this method, we have less information than before
about the attachment, so let's review the different criterias we had before:

* res_model: we were using it to always store attachments related to
  'ir.ui.view' in db, because assets are related to this model. However, we
  don't really need to check this: we should store any javascript and css
  documents in database.
* exclude res_model: we could have an exclusion list, to tell that for instance,
  for mail.message, we should never store any image in db. We don't have this
  information anymore, but I think it was never used and added "in case of".
  Because the default configuration is "mail.mail" and "mail.message" and I
  couldn't find any attachment with such res_model in any of our biggest
  databases. So this is removed.
* mimetype and data (size) are the last criteria and we still have them

The new system is only based on mimetype and data size and I think it's actually
more versatile. Previously, we could set a global size and include mimetypes,
but we couldn't say "I want to store all images below 50KB and all files of type
X below 10KB". Now, we have a single system parameter with a dict configuration
(`ir_attachment.storage.force.database`) defaulting to:

    {"image/": 51200, "application/javascript": 0, "text/css": 0}

Assets have a limit of zero, which means they will all be stored in the database
whatever their size is.

Overall, this is a great simplification of the module too, as the method
`_get_datas_related_values` integrates it better in the base calls of IrAttachment.

Note for upgrade:

I doubt we customized the previous system parameters which are now obsolete, but
if yes, the configuration may need to be moved to `ir_attachment.storage.force.database`.
For the record, the params were:

* mimetypes.list.storedb (default: image)
* file.maxsize.storedb (default: 51200)
* excluded.models.storedb (mail.message,mail.mail), no equivalent now

The method IrAttachment.force_storage_to_db_for_special_fields() should be called
through a migration script on existing databases to move the attachments back into
the database.
2020-08-25 14:26:03 +03:00
Guewen BaconnierandGitHub 234451065f Merge pull request #193 from acsone/12.0-188-port
[12.0][PORT] 188 from 10.0
2020-06-22 13:36:47 +02:00
Stéphane Bidoul 384c75061a Log uid 2020-06-22 08:42:25 +02:00
Stéphane Bidoul c3b061e980 Log request uuid 2020-06-22 08:42:25 +02:00
Guewen BaconnierandGitHub 0a592403e8 Merge pull request #174 from grindtildeath/12.0_attachment_s3_bin_size_close
[12.0] attachment_s3: Improvements
2020-06-22 07:45:26 +02:00
Guewen BaconnierandGitHub ef07381879 Merge pull request #140 from camptocamp/12-fixes
cloud_platform: fix default config
2020-06-22 07:39:28 +02:00
Guewen Baconnier 3036a8161e Update setuptools files 2020-06-22 07:21:54 +02:00
Guewen Baconnier 74c528e050 Ignore .eggs/ in gitignore 2020-06-22 07:21:43 +02:00
Guewen BaconnierandGitHub 981a99310c Merge pull request #184 from guewen/12.0-redis-json-encode-date
[12.0] Encode/decode date and datetime in redis sessions
2020-05-28 20:44:07 +02:00
Guewen BaconnierandGitHub a05bbfe517 Merge pull request #185 from PCatinean/12.0-session-preserve-forward-port-pc
12.0 session preserve forward port pc
2020-05-28 20:42:32 +02:00
Andreas PerhabandPaul c18e84a3bf [FIX] session_redis: fix flake8 errors 2020-05-26 14:46:56 +02:00
Andreas PerhabandPaul 9ac4d26470 [IMP] session_redis: add option to copy sessions from filesystem when starting 2020-05-26 14:39:27 +02:00
Andreas PerhabandPaul 18b5ceaebc [FIX] session_redis: add required option 'post_load' for server wide addon 2020-05-26 14:39:08 +02:00
Guewen Baconnier 2c5805e858 Add (de-)serialization of set objects in sessions 2020-05-26 11:39:39 +02:00
Guewen Baconnier 2a022ba537 Encode/decode date and datetime in redis sessions
In several places, odoo sets a datetime object directly in the
session. It works with the default session handler of odoo which
uses pickle.

But datetime and date are not json serializable by default.

Add custom encoder / decoder to handle them (from
https://github.com/OCA/queue/blob/dc12a6a20ecfd15c5b90f9b089c9a64cf9d8bbe4/queue_job/fields.py#L57-L99)

See the discussion raised by @PCatinean on https://github.com/camptocamp/odoo-cloud-platform/pull/176
2020-05-26 11:39:30 +02:00