Commit Graph
100 Commits
Author SHA1 Message Date
Guewen Baconnier eb0ced89fc Filter /monitoring/status werkzeug logs
With healtchecks, they constitute 95% of our logs. Let's stop wasting
resources and shut them up.
2019-07-12 16:25:51 +02:00
Guewen BaconnierandGitHub c8936964a8 Merge pull request #60 from guewen/11.0-swift-auth-session
[11.0] attachment_swift: share a session for all connections
2019-05-21 14:52:24 +02:00
Guewen Baconnier b45b4d23a9 Override dependencies with different name and pin versions
The name of the libs and python packages are different, Odoo expects
the inner python package in the manifest, but setuptools cannot find the
libs in pypi, overrides them with the libs names.
2019-05-09 10:10:36 +02:00
Guewen Baconnier fe827e6b3f Pin PyYAML version because 5.x does not work with Odoo
It would raise ConstructorError: could not determine a constructor for the tag '!record'
2019-05-09 10:10:36 +02:00
Guewen Baconnier 8a4e9d1f84 attachment_swift: share a session for all connections
OVH's Swift applies a rate limit on the authentication.

attachment_swift authenticates again each time it has to read/write an
attachment. When running upgrades on upgrades of files or installing a
new DB, at some point, we get rejected with HTTP 429.

This commit introduces a shared storage for Swift Session. All
connections will reuses the same authentication token created the first
time a connection needs a Session.

Note: needs python-swiftclient>=3.7.0 to have
https://github.com/openstack/python-swiftclient/commit/1971ef880ff225379d4a91f00f89f323a1605eeb
2019-05-09 10:10:36 +02:00
Guewen Baconnier 440600e89f Add missing variable in documentation example 2019-05-09 10:04:45 +02:00
Guewen BaconnierandGitHub 2dff3e9676 Merge pull request #44 from Numigi/11.0-monitoring_log_requests_dispatch_classmethod
monitoring_log_request: _dispatch is a classmethod
2019-02-12 08:25:57 +01:00
Guewen BaconnierandGitHub 1e310e34a8 Merge pull request #42 from tschanzt/allow_more_bucket_names
allow more bucket names
2019-01-14 16:27:31 +01:00
Guewen Baconnier bdde32b3b8 Add setuptools files 2018-12-03 10:07:58 +01:00
Guewen Baconnier 636af1884f Edit readme 2018-12-03 10:07:07 +01:00
Guewen Baconnier 96f4e75311 base_attachment_object_storage: bump 1.1.0 2018-06-13 17:25:21 +02:00
Guewen BaconnierandGitHub 19dcbff646 Merge pull request #35 from guewen/11.0-force-storage-at-upgrade
11.0 Fix attachments stored in FS instead of object storage
2018-06-13 17:24:50 +02:00
Guewen Baconnier 371e5439e6 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 16:05:34 +02:00
Guewen Baconnier 6ab3038a90 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 16:05:26 +02:00
Guewen Baconnier fb3d3134d6 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 16:04:55 +02:00
Guewen BaconnierandGitHub 2ec125cccd Merge pull request #31 from guewen/11.0-swift-pass-region-name
Propagage region_name to swift connection
2018-03-29 16:44:39 +02:00
Guewen Baconnier 529c4066fa Propagage region_name to swift connection
Otherwise, the bucket will be in the incorrect region
2018-03-16 09:10:58 +01:00
Guewen BaconnierandGitHub c35483d948 Merge pull request #29 from guewen/11.0-fix-redis-stored-log
Fix order of args in logs
2018-03-15 12:27:47 +01:00
Guewen Baconnier 543a9eb22d Fix order of args in logs 2018-03-13 15:00:26 +01:00
Guewen BaconnierandGitHub 68c161e345 Merge pull request #28 from camptocamp/yvaucher-patch-1
Remove useless call to lower()
2018-02-08 15:32:14 +01:00
Guewen Baconnierandjcoux 39e71ff334 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-11 10:46:55 +01:00
Guewen Baconnier e3799cd54b Change OCA dependency to server-env
server_environment addons have been moved there
2018-01-11 10:41:26 +01:00
Guewen Baconnier 6cc18007dd Remove web_kanban, does no longer exist in 11.0 2018-01-11 10:41:26 +01:00
Guewen Baconnier bfaca4628a Tentative to fix travis build 2018-01-11 10:41:26 +01:00
Guewen Baconnier 5b37af2376 Fix flake8 warning 2018-01-11 10:41:26 +01:00
Guewen Baconnier 207cd6504c Encode/decode redis data which expects bytes 2017-11-15 16:25:02 +01:00
Guewen Baconnier ea44b4fd15 Remove call to encode, str expected, not bytes (py3) 2017-11-15 16:15:39 +01:00
Guewen Baconnier 08329c91d2 Replace value.decode('base64') by base64.b64decode (py3) 2017-11-15 15:54:59 +01:00
Guewen Baconnier 5901ca82a2 Set version in .travis.yml 2017-11-15 15:42:25 +01:00
Guewen Baconnier 4bb649f729 Add check for empty bucket on integration 2017-11-15 15:03:03 +01:00
Guewen Baconnier b084ce278a Set addons installable 2017-11-15 14:56:45 +01:00
Guewen Baconnier f9c290a45a Apply 2to3 automatic migration 2017-11-15 14:55:11 +01:00
Guewen Baconnier 96c9a38150 Set addons uninstallable 2017-11-15 14:31:23 +01:00
Guewen BaconnierandGitHub 98d7bc3096 Merge pull request #19 from yvaucher/aws-region
Add AWS_REGION to connect to bucket with specific region
2017-11-15 14:28:54 +01:00
Guewen BaconnierandGitHub aaf56d5027 Merge pull request #18 from TDu/mock-test-swift
Mock Swift client api in tests
2017-11-10 09:00:38 +01:00
Guewen Baconnier 7999386273 Fix tests
When there is no write container setup, no write/delete actions are
done.
2017-11-10 08:52:53 +01:00
Guewen BaconnierandGitHub 86e5bd3ad7 Merge pull request #16 from TDu/add-ovh-platform
[BSRTL-215] Add OVH as an option for the cloud platform
2017-09-21 09:03:46 +02:00
Guewen Baconnier ee8038b388 Update doc 2017-09-20 15:42:25 +02:00
Guewen Baconnier abe34fcaa2 Return empty result on file read error
This is how the core implementation works
2017-09-20 15:42:25 +02:00
Guewen Baconnier cbef735c76 Abstract object storage in attachment_s3
Using the base_attachment_object_storage module, the same way
attachment_swift is done. Fixed a few issues along the way in
attachment_swift.
2017-09-20 15:42:25 +02:00
Guewen Baconnier edc700c807 Configure storage by platform kind 2017-09-20 15:42:25 +02:00
Guewen Baconnier 81196a8058 Various small changes after review 2017-09-20 12:43:38 +02:00
Guewen Baconnier 5d30207963 Merge branch 'TDu-swift-integration' into 10.0 2017-09-01 11:15:33 +02:00
Guewen BaconnierandGitHub 27707f7271 Merge pull request #13 from guewen/better-s3-access-error-msg
[10.0] Make error message more precise for S3 access
2017-08-29 11:37:32 +02:00
Guewen Baconnier f1e84b5562 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:37:45 +02:00
Guewen BaconnierandGitHub e67626945e Merge pull request #11 from guewen/10.0-session-redis-sentinel
[10.0] Allow to use a Redis Sentinel
2017-05-18 16:40:25 +02:00
Guewen Baconnier c7240e1fe1 Allow to use a Redis Sentinel 2017-05-16 09:07:59 +02:00
Guewen Baconnier 2b81b7a6fb Do not require to run statds metrics 2017-04-29 09:20:55 +02:00
Guewen Baconnier f0519cf2f6 Add more details in asserts 2017-01-17 11:11:47 +01:00
Guewen BaconnierandGitHub 540269f59e Merge pull request #5 from guewen/10.0-attachment-fast-web-access
Store files that need fast access in the database
2017-01-16 17:27:39 +01:00
Guewen Baconnier 795692ad78 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 14:04:24 +01:00
Guewen Baconnier 4eecb899f3 Fix IrHttp._dispatch is now a class method 2016-12-21 23:21:57 +01:00
Guewen Baconnier 8e4b461c75 Migrate addons to 10.0 2016-12-21 21:29:09 +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