Commit Graph
63 Commits
Author SHA1 Message Date
Guewen Baconnier c3d9aceb0f Document a weird domain which is there for a reason
The reason being:
https://github.com/odoo/odoo/blob/9032617120138848c63b3cfa5d1913c5e5ad76db/odoo/addons/base/ir/ir_attachment.py#L344-L347

I nearly deleted this domain but it was too weird to be there for no
reason. A comment explaining the issue was really missing.
2018-06-13 17:16:07 +02:00
Guewen Baconnier ddb7656abd Fix attachments stored in FS instead of object storage
Assume the following situation:

* We have installed addons base, sale and attachment_s3 (hence
base_attachment_object_storage as dependency)
* All attachments are in S3 already
* We run an upgrade of the 'base' addon, 'sale' is upgraded before
attachment_s3 in the order of loading.
* Sale updates the icon of the Sale menu
* As attachment_s3 is not loaded yet, the attachment is created in the
filestore

Now if we don't persist the filestore or use different servers, we'll
lose the images of the menus (or any attachment loaded by the
install/upgrade of an addon).

The implemented solution is to move the attachments from the filestore
to the object storage at the loading of the module. However, this
operation can take time and it shouldn't be run by 2 processes at the
same time, so we want to detect if the module is loaded during a normal odoo
startup or when some addons have been upgraded. There is nothing anymore
at this point which allow us to know that modules just have been
upgraded except... in the caller frame (load_modules). We have to rely
on the inpect module and get the caller frame, which is not recommended,
but seems the only way, besides, it's not called often and if
_register_hook was called from another place, it would have no effect
(unless the other place has a variable 'update_module' too).
2018-06-13 17:15:45 +02:00
Guewen Baconnier f915b8a1be Ensure that migration of files is commited before deleting files
When moving attachments from the filestore to an object storage, the
filesystem files will be deleted only after the commit, so if the
transaction is rollbacked, we still have the local files for another
try.
2018-06-13 17:15:18 +02:00
Guewen Baconnier a0c926a478 Expire sessions generated by health checks quickly
The default expiration of sessions is 7 days. With healthchecks run
every few seconds, we quickly have millions of anonymous sessions in
Redis. Allow to define a custom expiration for some sessions and set a
very short one for the monitoring requests.
2018-01-04 09:27:50 +01:00
Guewen BaconnierandGitHub 7f5f6d0f92 Merge pull request #14 from guewen/9.0-better-s3-access-error-msg
[9.0] Make error message more precise for S3 access
2017-08-29 11:37:15 +02:00
Guewen Baconnier 64b79cc848 Make error message more precise for S3 access
The previous error message let think that you should set AWS_BUCKETNAME,
although you should set it only if you are trying to write in this
repository.
2017-08-28 14:40:31 +02:00
Guewen BaconnierandGitHub 418e0cc3ff Merge pull request #10 from guewen/9.0-session-redis-sentinel
[9.0] Allow to use a Redis Sentinel
2017-05-18 16:40:14 +02:00
Guewen Baconnier bcb4b8b98d Allow to use a Redis Sentinel 2017-05-16 09:07:30 +02:00
Guewen Baconnier 4823d10eb5 Do not force metrics on production 2017-04-29 09:19:16 +02:00
Guewen Baconnier 5d6fc2722c Fix calls on multi instead of record 2017-04-26 15:58:39 +02:00
Guewen BaconnierandGitHub 188643b7d3 Merge pull request #7 from guewen/fix-slow-partner-kanban-view
Fix Contacts view too slow to display
2017-02-09 13:13:53 +01:00
Guewen Baconnier 4d8400d0bf Fix Contacts view too slow to display
The 'base' Kanban view for res.partner in 9.0 loads the large 'image'
field in the 'search_read' but display the 'small_image'. The js code
also has to issue js calls to get the small images as they have not been
prefetched. This is noticeably slow to load when the large images are
read from S3 which is slower than a local filesystem/database.

This fix loads the 'small_image' instead of the large one.

This bug has been fixed in Odoo 10.0.
2017-02-09 11:49:23 +01:00
Guewen Baconnier 8ad99c9336 Add more details in asserts 2017-01-17 11:07:36 +01:00
Guewen BaconnierandGitHub 4cd8c214ec Merge pull request #6 from guewen/9.0-attachment-fast-web-access
Store files that need fast access in the database
2017-01-16 17:27:31 +01:00
Guewen Baconnier 624cc0b743 Store files that need fast access in the database
An Object Storage read is slower than a disk of database access.
It might take ~200 to 300ms to retrieve a file content.

This is not an issue for attachments such as the pdf files or any
attachment that we want to read on demand. But that's too slow for
files needed to render a web page.

We'll store in the database:

* Assets (js, css, ...). As a side effect, the databases will be more
  portable, as assets are rebuilt frequently, storing them in the Object
  Storage led the integration server to try to read assets deleted since
  long ago
* Attachments linked to Binary fields named 'image_small',
  'image_medium', 'web_icon_data'. Those fields are often used on kanban
  views that display a lot a images and retrieving them all was then
  very slow (Odoo does not do async requests).

The migration to S3 is no longer called during initialization of the
registry: it would be too slow as we would have to define if the
attachments must be kept in database or sent to S3 on each new start. It
means we have to call `env['ir.attachment'].force_storage()` to run the
migration.
2017-01-16 17:12:52 +01:00
Guewen Baconnier 022f9003e8 Add debug logs in session_redis 2016-12-14 11:25:12 +01:00
Guewen Baconnier 997f92aaab Rename builtin id variable 2016-12-13 12:21:37 +01:00
Guewen Baconnier d138a1fd3d Be more defensive against concurrent workers
When migrating attachments to S3, several workers may try to migrate
the same attachments. Do not fail when both update the same attachment.
2016-12-13 12:01:50 +01:00
Guewen Baconnier 5f61ed8985 registry is useless in the second branch 2016-12-13 09:06:50 +01:00
Guewen Baconnier 53d7cdf3e7 Fix attachment_s3: do not open a new cursor
Because it provokes serialization errors during the installation or
update of addons. Do not commit as we might commit unwanted things...
Later, we might want to add a specific, more elaborate, migration
process.
2016-12-13 08:58:08 +01:00
Guewen BaconnierandGitHub 8b15070c7f Merge pull request #4 from guewen/add-load-readme
Document --load option for some addons
2016-11-14 08:29:51 +01:00
Guewen Baconnier 607268bd4f Delete S3 file only when bucket is the current one 2016-11-14 08:29:13 +01:00
Guewen Baconnier 779aa03c57 Explicit attachment_s3 must be started in --load 2016-11-10 16:14:19 +01:00
Guewen Baconnier 92880deeab Explicit session_redis must be started in --load 2016-11-10 16:14:19 +01:00
Guewen Baconnier 78ac4d306e Document --load option 2016-11-10 16:14:19 +01:00
Guewen Baconnier 110ec2399d Add logging when deleting file on the object storage 2016-11-07 10:11:23 +01:00
Guewen Baconnier 7f262799cf Do not care if an attachment could not be deleted 2016-11-07 09:50:26 +01:00
Guewen Baconnier 8400c0f34e Set statsd customer 2016-11-04 13:39:50 +01:00
Guewen Baconnier f643c19fba Do not fail when an attachment cannot be read
It would be blocking and a missing attachment might be a minor issue.
Only warn when such a file is missing.
2016-11-04 13:38:31 +01:00
Guewen BaconnierandGitHub 80ac235c28 Merge pull request #3 from guewen/grafana-statsd
Add statsd addon
2016-11-04 10:35:25 +01:00
Guewen Baconnier 65e9bad4e5 Add monitoring_statsd in cloud_platform 2016-11-04 10:30:10 +01:00
Guewen Baconnier d53ef3de37 Add statsd metrics addon 2016-11-04 10:30:10 +01:00
Guewen BaconnierandGitHub 23634feb46 Merge pull request #2 from guewen/logging-json
Add logging_json
2016-11-04 10:20:20 +01:00
Guewen Baconnier bed41d6719 Add requirements.txt 2016-11-03 17:37:00 +01:00
Guewen Baconnier e5c1afb09e Fix server_environment_files error 2016-11-03 17:07:47 +01:00
Guewen Baconnier 3c8b74369b Make pylint happy 2016-11-03 16:58:36 +01:00
Guewen Baconnier 3fd26cb894 Fix travis configuration 2016-11-03 16:46:42 +01:00
Guewen Baconnier 7eafdd75f4 Add oca-dependencies 2016-11-03 16:24:47 +01:00
Guewen Baconnier b5f00c26dc Fix pep8 2016-11-02 10:29:02 +01:00
Guewen Baconnier ec1f3fc61a Add logging_json
Output odoo logs as json
2016-11-02 10:10:05 +01:00
Guewen Baconnier 46231b3365 Fix pep8 2016-11-02 09:55:36 +01:00
Guewen Baconnier 1d4f76de2b Migrate attachments s3 to new pattern
So remove the compatibility code altogether
2016-11-01 08:55:00 +01:00
Guewen Baconnier 963b65e99d Storage should be 's3' 2016-10-31 17:23:20 +01:00
Guewen Baconnier ab0fa598ca Adapt cloud_platform setup for 73aaff6
Following the changes in attachment_s3
2016-10-31 14:05:58 +01:00
Guewen Baconnier 73aaff62fc Rework attachment_s3:
* store the S3 uri in the 'store_fname' (s3://bucket/key)
* the read-only mode is now built-in, as we store the bucket name, if a
  instance is started with a different bucket or another filestore
  method, it will continue to read the previous attachments on their
  stored bucket, but new attachments will be stored on the new one
* remove config in ir.config_parameter, it makes all the stuff more
  complex and we don't use them (config file would be more interesting)
* automatically migrate the attachments on loading of the server, so
  if an ir.attachment has been created during the module
  upgrade/initialization before attachment_s3 is loaded, it will be sent
  to S3 as soon as it's loaded
2016-10-31 13:57:20 +01:00
Guewen Baconnier fde2688b27 Do not require REDIS on dev environment 2016-10-28 12:06:51 +02:00
Guewen Baconnier 202d37f08b Relax rules for the redis prefix
If we run 2 instances with the 'integration' server_env, we want 2
the ability to use different prefixes.
2016-10-25 13:26:26 +02:00
Guewen Baconnier 6eb25377fb Remove extra parameter 2016-10-25 12:09:27 +02:00
Guewen Baconnier e286a0da1a Allow different bucket name than *-odoo-prod
Only force it if the server-env is 'prod'. When we have no production
yet, the integration will have its own bucket.
2016-10-25 10:16:26 +02:00
Guewen Baconnier fedfbb199e Allow s3 on non-prod environment
But force it to be readonly
2016-10-25 09:55:29 +02:00
Guewen Baconnier fb7c07a47c Install session_redis and monitoring_status 2016-10-25 09:39:28 +02:00
Guewen Baconnier 952a35854e Add monitoring_status, new route for health checks 2016-10-25 09:39:03 +02:00
Guewen Baconnier 982285b298 Add a cloud_platform 'profile' addon
* When installed, it pulls the addons required for Odoo to run on the
  Cloud Platform.
* It provides a method to configure Odoo at the installation.
* It checks if the environment variables are correct according the the
  'server environment'
* And add documentation
2016-10-25 09:38:48 +02:00
Guewen Baconnier 63daa99cdd Add session_redis 2016-10-24 17:12:27 +02:00
Guewen Baconnier 9ca3f87614 Remove the bin_size return
When we return a bin_size (such as 28672), the web client does not
accept it as as bin size and try to use it as value for the b64 src of
the image.  Though, returning the image as b64 in all cases does seem to
be supported.
2016-10-24 17:12:27 +02:00
Guewen Baconnier ec59d275e2 Add read-only mode that fallbacks on the database 2016-10-24 17:12:27 +02:00
Guewen Baconnier 7825661a1a Add attachment_s3 2016-10-24 17:12:27 +02:00
Guewen Baconnier 2f00f776e8 Fix queries without status_code 2016-10-10 13:34:10 +02:00
Guewen Baconnier c8f330321b Add possibility to add a filter
But still output everything
2016-08-31 16:58:39 +02:00
Guewen Baconnier 838b9721f2 Add blacklist for monitored requests 2016-08-31 16:30:57 +02:00
Guewen Baconnier c6c18194e4 Add monitoring_log_requests
Addons that logs requests for usage analysis
2016-08-31 16:08:28 +02:00
Guewen Baconnier 8e3f231cea Add base files 2016-08-31 15:31:44 +02:00
Guewen Baconnier c412ef7544 Initial commit 2016-08-31 15:31:39 +02:00