From af83a19fa4fd0f5fa6ae38ed2d2bf5a6cbf2344e Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 05:10:20 -0500 Subject: [PATCH 1/4] finished sentry integration --- .env.example | 2 +- odoo/odoo.conf | 17 +++++++++++++++++ odoo/requirements.txt | 1 + odoo/third-party-addons.sh | 23 +++++++++++++++-------- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 69975a1..552183f 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,7 @@ APP_ENV=local INIT= UPDATE= -LOAD=base,web,session_redis,attachment_s3 +LOAD=base,web,session_redis,attachment_s3,sentry WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test diff --git a/odoo/odoo.conf b/odoo/odoo.conf index 39b7ccc..c4a2208 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -263,6 +263,23 @@ limit_request = ${LIMIT_REQUEST} ; External Integrations ; ;-----------------------------; +;--------------; +; Sentry ; +;--------------; +sentry_dsn = https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 +sentry_enabled = true +sentry_logging_level = warn +# sentry_exclude_loggers = werkzeug +# sentry_ignore_exceptions = odoo.exceptions.AccessDenied, +# odoo.exceptions.AccessError,odoo.exceptions.MissingError, +# odoo.exceptions.RedirectWarning,odoo.exceptions.UserError, +# odoo.exceptions.ValidationError,odoo.exceptions.Warning, +# odoo.exceptions.except_orm +sentry_include_context = true +# sentry_environment = production +# sentry_release = 1 +# sentry_odoo_dir = + ;-------------; ; Redis ; ;-------------; diff --git a/odoo/requirements.txt b/odoo/requirements.txt index 181b3bb..2fa9750 100644 --- a/odoo/requirements.txt +++ b/odoo/requirements.txt @@ -2,3 +2,4 @@ debugpy websocket-client redis boto3 +sentry-sdk diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index a34bc85..1e57cd8 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -4,17 +4,24 @@ set -e # Check if the repository directory exists if [ ! -d "odoo-cloud-platform" ]; then - git clone https://github.com/camptocamp/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; + git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 fi -# Define the path to the manifest file -redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" -# Define the path to the manifest file -s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" +# Check if the repository directory exists +if [ ! -d "server-tools" ]; then + git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; + cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry +fi -# Modify the manifest file -python3 /fix-manifest.py $redis_manifest -python3 /fix-manifest.py $s3_manifest +# Define the path to the manifest files +redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" +s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" +sentry_manifest="${THIRD_PARTY_ADDONS}/sentry/__manifest__.py" + +# Modify the manifest files +# python3 /fix-manifest.py $redis_manifest +# python3 /fix-manifest.py $s3_manifest +# python3 /fix-manifest.py $sentry_manifest From 48cb2c06cbe8591b2514dfea79a71e5eed5f272c Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 05:43:40 -0500 Subject: [PATCH 2/4] variables reaccomodation --- .env.example | 67 +++++++++++++++++++++++--------------- docker-compose.yml | 11 ++++--- odoo/odoo.conf | 11 ++++--- odoo/third-party-addons.sh | 10 ------ 4 files changed, 54 insertions(+), 45 deletions(-) diff --git a/.env.example b/.env.example index 552183f..f81a39b 100644 --- a/.env.example +++ b/.env.example @@ -26,7 +26,7 @@ LOAD_LANGUAGE= DB_SSLMODE=prefer DB_MAXCONN=64 DB_TEMPLATE=unaccent_template -UNACCENT=True +UNACCENT=False LIST_DB=True DBFILTER=.* @@ -66,19 +66,22 @@ REDIS_PORT=6379 REDIS_PASSWORD= REDIS_URL= REDIS_PREFIX=odoo +REDIS_SENTINEL_MASTER_NAME= +REDIS_SENTINEL_HOST= +REDIS_SENTINEL_PORT=26379 REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 -REDIS_DATA=/var/lib/keydb # Filesystem S3_VIRTUAL_HOST=s3.odoocker.test S3_API_PORT=9000 S3_CONSOLE_PORT=9001 + +AWS_HOST=http://s3:${S3_API_PORT} +AWS_REGION= AWS_ACCESS_KEY_ID=myaccesskey AWS_SECRET_ACCESS_KEY=mysecretkey AWS_BUCKETNAME=odoocker -AWS_HOST=http://s3:${S3_API_PORT} -AWS_REGION= # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test @@ -103,8 +106,8 @@ SUPPORT_EMAIL=mail@example.com # Containers' Tags ODOO_TAG=16.0 POSTGRES_TAG=16.0 -REDIS_TAG=latest -S3_TAG=latest +KEYDB_TAG=latest +MINIO_TAG=latest NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 @@ -159,14 +162,14 @@ XMLRPCS=True PROXY_MODE=True X_SENDFILE=False -# Testing +# Testing Group TEST_FILE=False TEST_ENABLE=${TEST_ENABLE} TEST_TAGS=${TEST_TAGS} SCREENCASTS=None SCREENSHOTS=/tmp/odoo_tests -# Logging +# Logging Group LOG_LEVEL=${LOG_LEVEL} LOG_HANDLER=odoo.http.rpc.request:${LOG_HANDLER_LEVEL},odoo.http.rpc.response:${LOG_HANDLER_LEVEL},:${LOG_HANDLER_LEVEL},odoo.sql_db:${LOG_HANDLER_LEVEL} LOG_DB=False @@ -174,7 +177,7 @@ LOG_DB_LEVEL=${LOG_LEVEL} SYSLOG=False LOGFILE= -# Email +# SMTP Group EMAIL_FROM=${EMAIL_FROM} FROM_FILTER=${FROM_FILTER} SMTP_SERVER=${SMTP_SERVER} @@ -224,6 +227,29 @@ LIMIT_TIME_REAL=480 LIMIT_TIME_REAL_CRON=600 LIMIT_REQUEST=8192 +# Redis +ODOO_SESSION_REDIS=${SESSION_REDIS} +ODOO_SESSION_REDIS_HOST=${REDIS_HOST} +ODOO_SESSION_REDIS_PORT=${REDIS_PORT} +ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} +ODOO_SESSION_REDIS_URL=${REDIS_URL} +ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} +ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME=${REDIS_SENTINEL_MASTER_NAME} +ODOO_SESSION_REDIS_SENTINEL_HOST=${REDIS_SENTINEL_HOST} +ODOO_SESSION_REDIS_SENTINEL_PORT=${REDIS_SENTINEL_PORT} +ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} + +# Base Attachment Object Storage +DISABLE_ATTACHMENT_STORAGE=0 + +# S3 +AWS_HOST=${AWS_HOST} +AWS_REGION=${AWS_REGION} +AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} +AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} +AWS_BUCKETNAME=${AWS_BUCKETNAME} + #--------------# # Docker # #--------------# @@ -270,25 +296,12 @@ DEFAULT_EMAIL=${SUPPORT_EMAIL} #-------------# # Redis # #-------------# -ODOO_SESSION_REDIS=${SESSION_REDIS} -ODOO_SESSION_REDIS_HOST=${REDIS_HOST} -ODOO_SESSION_REDIS_PORT=${REDIS_PORT} -ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} -ODOO_SESSION_REDIS_URL=${REDIS_URL} -ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} -ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} -ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} +KEYDB_PORT=${REDIS_PORT} +KEYDB_DATA=/var/lib/keydb -#----------# -# S3 # -#----------# -AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} -AWS_REGION=${AWS_REGION} -AWS_HOST=${AWS_HOST} -AWS_BUCKETNAME=${AWS_BUCKETNAME} - -DISABLE_ATTACHMENT_STORAGE=0 +#-------------# +# Minio # +#-------------# MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID} MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY} MINIO_VIRTUAL_HOST=${S3_VIRTUAL_HOST} diff --git a/docker-compose.yml b/docker-compose.yml index 3ee8949..39ff117 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,9 @@ services: - ODOO_SESSION_REDIS_PASSWORD - ODOO_SESSION_REDIS_URL - ODOO_SESSION_REDIS_PREFIX + - ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME + - ODOO_SESSION_REDIS_SENTINEL_HOST + - ODOO_SESSION_REDIS_SENTINEL_PORT - ODOO_SESSION_REDIS_EXPIRATION - ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS - AWS_HOST @@ -69,18 +72,18 @@ services: - internal redis: - image: eqalpha/keydb:${REDIS_TAG} + image: eqalpha/keydb:${KEYDB_TAG} platform: linux/amd64 ports: - - ${REDIS_PORT}:${REDIS_PORT} + - ${KEYDB_PORT}:${KEYDB_PORT} restart: unless-stopped volumes: - - redis-data:${REDIS_DATA} + - redis-data:${KEYDB_DATA} networks: - internal s3: - image: minio/minio:${S3_TAG} + image: minio/minio:${MINIO_TAG} environment: - MINIO_ROOT_USER - MINIO_ROOT_PASSWORD diff --git a/odoo/odoo.conf b/odoo/odoo.conf index c4a2208..68f169d 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -44,7 +44,7 @@ addons_path = ${ADDONS_PATH} upgrade_path = ${UPGRADE_PATH} ; --load -server_wide_modules = ${SERVER_WIDE_MODULES} +server_wide_modules = ${LOAD} ; --data-dir data_dir = ${DATA_DIR} @@ -307,12 +307,15 @@ ODOO_SESSION_REDIS_EXPIRATION = ${ODOO_SESSION_REDIS_EXPIRATION} ; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = ${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} +;--------------------------------------; +; Base Attachment Object Storage ; +;--------------------------------------; +; -- Disable Attachment Object Storage +DISABLE_ATTACHMENT_STORAGE = ${DISABLE_ATTACHMENT_STORAGE} + ;----------; ; S3 ; ;----------; -; -- Disable S3 storage -DISABLE_ATTACHMENT_STORAGE = ${DISABLE_ATTACHMENT_STORAGE} - ; -- Not required if using AWS S3 AWS_HOST = ${AWS_HOST} diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index 1e57cd8..b32e745 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -15,13 +15,3 @@ if [ ! -d "server-tools" ]; then git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry fi - -# Define the path to the manifest files -redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" -s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" -sentry_manifest="${THIRD_PARTY_ADDONS}/sentry/__manifest__.py" - -# Modify the manifest files -# python3 /fix-manifest.py $redis_manifest -# python3 /fix-manifest.py $s3_manifest -# python3 /fix-manifest.py $sentry_manifest From 1e11d3fb37254c7e36f05bc88d4c50741c8ea1ea Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 05:55:00 -0500 Subject: [PATCH 3/4] refactor --- .env.example | 12 +++++++++++- odoo/odoo.conf | 22 +++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.env.example b/.env.example index f81a39b..798f40c 100644 --- a/.env.example +++ b/.env.example @@ -34,6 +34,16 @@ DBFILTER=.* LOG_LEVEL=info # Additional logs LOG_HANDLER_LEVEL=INFO +# Sentry +SENTRY_DSN= +SENTRY_ENABLED=true +SENTRY_LOGGING_LEVEL=warn +SENTRY_EXCLUDE_LOGGERS= +SENTRY_IGNORE_EXCEPTIONS= +SENTRY_INCLUDE_CONTEXT=true +SENTRY_ENVIRONMENT=production +SENTRY_RELEASE= +SENTRY_ODOO_DIR= # Nginx CORS_ALLOWED_DOMAIN="'http://external-domain.test'" @@ -65,7 +75,7 @@ REDIS_HOST=redis REDIS_PORT=6379 REDIS_PASSWORD= REDIS_URL= -REDIS_PREFIX=odoo +REDIS_PREFIX=odoocker REDIS_SENTINEL_MASTER_NAME= REDIS_SENTINEL_HOST= REDIS_SENTINEL_PORT=26379 diff --git a/odoo/odoo.conf b/odoo/odoo.conf index 68f169d..f202f75 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -266,19 +266,15 @@ limit_request = ${LIMIT_REQUEST} ;--------------; ; Sentry ; ;--------------; -sentry_dsn = https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 -sentry_enabled = true -sentry_logging_level = warn -# sentry_exclude_loggers = werkzeug -# sentry_ignore_exceptions = odoo.exceptions.AccessDenied, -# odoo.exceptions.AccessError,odoo.exceptions.MissingError, -# odoo.exceptions.RedirectWarning,odoo.exceptions.UserError, -# odoo.exceptions.ValidationError,odoo.exceptions.Warning, -# odoo.exceptions.except_orm -sentry_include_context = true -# sentry_environment = production -# sentry_release = 1 -# sentry_odoo_dir = +sentry_dsn = ${SENTRY_DSN} +sentry_enabled = ${SENTRY_ENABLED} +sentry_logging_level = ${SENTRY_LOGGING_LEVEL} +sentry_exclude_loggers = ${SENTRY_EXCLUDE_LOGGERS} +sentry_ignore_exceptions = ${SENTRY_IGNORE_EXCEPTIONS} +sentry_include_context = ${SENTRY_INCLUDE_CONTEXT} +sentry_environment = ${SENTRY_ENVIRONMENT} +sentry_release = ${SENTRY_RELEASE} +sentry_odoo_dir = ${SENTRY_ODOO_DIR} ;-------------; ; Redis ; From 3595ed42cbd9764b2baff5bf2f0e05fa6b1e4fc7 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 06:05:51 -0500 Subject: [PATCH 4/4] cleanup --- .env.example | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.env.example b/.env.example index 798f40c..388438d 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,7 @@ APP_ENV=local INIT= UPDATE= LOAD=base,web,session_redis,attachment_s3,sentry +ROOT_PATH=/usr/lib/python3/dist-packages/odoo WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test @@ -35,7 +36,7 @@ LOG_LEVEL=info # Additional logs LOG_HANDLER_LEVEL=INFO # Sentry -SENTRY_DSN= +SENTRY_DSN=https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 SENTRY_ENABLED=true SENTRY_LOGGING_LEVEL=warn SENTRY_EXCLUDE_LOGGERS= @@ -43,7 +44,7 @@ SENTRY_IGNORE_EXCEPTIONS= SENTRY_INCLUDE_CONTEXT=true SENTRY_ENVIRONMENT=production SENTRY_RELEASE= -SENTRY_ODOO_DIR= +SENTRY_ODOO_DIR=${ROOT_PATH} # Nginx CORS_ALLOWED_DOMAIN="'http://external-domain.test'" @@ -123,19 +124,6 @@ NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 PGADMIN_TAG=7.6 -#------------# -# Odoo # -#------------# -# Options not exposed on the command line. -ADMIN_PASSWD=${ADMIN_PASSWD} -CSV_INTERNAL_SEP=, -PUBLISHER_WARRANTY_URL=http://services.openerp.com/publisher-warranty/ -ROOT_PATH=/usr/lib/python3/dist-packages/odoo -REPORTGZ=False -WEBSOCKET_KEEP_ALIVE_TIMEOUT=3600 -WEBSOCKET_RATE_LIMIT_BURST=10 -WEBSOCKET_RATE_LIMIT_DELAY=0.2 - # Custom paths COMMUNITY_ADDONS=${ROOT_PATH}/addons ENTERPRISE_ADDONS=${ROOT_PATH}/enterprise @@ -145,6 +133,19 @@ CUSTOM_ADDONS=${ROOT_PATH}/custom-addons LOG_PATH=/var/log/odoo/odoo.log DEBUG_PATH=/usr/bin/odoo +#------------# +# Odoo # +#------------# +# Options not exposed on the command line. +ADMIN_PASSWD=${ADMIN_PASSWD} +CSV_INTERNAL_SEP=, +PUBLISHER_WARRANTY_URL=http://services.openerp.com/publisher-warranty/ +ROOT_PATH=${ROOT_PATH} +REPORTGZ=False +WEBSOCKET_KEEP_ALIVE_TIMEOUT=3600 +WEBSOCKET_RATE_LIMIT_BURST=10 +WEBSOCKET_RATE_LIMIT_DELAY=0.2 + # Server startup config ODOO_RC=${ROOT_PATH}/odoo.conf SAVE=False