Skip to content
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

[IMP] Add some more default configurations #62

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion 11.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ ONBUILD ARG PGUSER=odoo
ONBUILD ARG PGPASSWORD=odoopassword
ONBUILD ARG PGHOST=db
ONBUILD ARG PGDATABASE=prod
ONBUILD ARG ODOO_MAX_CRON_THREADS=1
ONBUILD ARG ODOO_WORKERS=4
ONBUILD ARG ODOO_LIMIT_TIME_REAL=120
ONBUILD ARG ODOO_LIMIT_TIME_CPU=60
ONBUILD ARG ODOO_LIMIT_MEMORY_HARD=805306368
ONBUILD ARG ODOO_LIMIT_MEMORY_SOFT=671088640
ONBUILD ARG ODOO_LIMIT_REQUEST=8192
ONBUILD ARG ODOO_LIMIT_TIME_REAL_CRON=-1
ONBUILD ARG ODOO_DB_FILTER=""
ONBUILD ARG ODOO_LIST_DB=1
ONBUILD ARG ODOO_LOG_LEVEL=info
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to translate these ARG into ENV, like in the v8 dockerfile. That's the cause of v11 failure.

# Config variables
ONBUILD ENV ADMIN_PASSWORD="$ADMIN_PASSWORD" \
UNACCENT="$UNACCENT" \
Expand All @@ -46,7 +57,18 @@ ONBUILD ENV ADMIN_PASSWORD="$ADMIN_PASSWORD" \
SMTP_PASSWORD="$SMTP_PASSWORD" \
SMTP_SSL="$SMTP_SSL" \
EMAIL_FROM="$EMAIL_FROM" \
WITHOUT_DEMO="$WITHOUT_DEMO"
WITHOUT_DEMO="$WITHOUT_DEMO" \
ODOO_MAX_CRON_THREADS="$ODOO_MAX_CRON_THREADS" \
ODOO_WORKERS="$ODOO_WORKERS" \
ODOO_LIMIT_TIME_REAL="$ODOO_LIMIT_TIME_REAL" \
ODOO_LIMIT_TIME_CPU="$ODOO_LIMIT_TIME_CPU" \
ODOO_LIMIT_MEMORY_HARD="$ODOO_LIMIT_MEMORY_HARD" \
ODOO_LIMIT_MEMORY_SOFT="$ODOO_LIMIT_MEMORY_SOFT" \
ODOO_LIMIT_REQUEST="$ODOO_LIMIT_REQUEST" \
ODOO_LIMIT_TIME_REAL_CRON="$ODOO_LIMIT_TIME_REAL_CRON" \
ODOO_DB_FILTER="$ODOO_DB_FILTER" \
ODOO_LIST_DB="$ODOO_LIST_DB" \
ODOO_LOG_LEVEL="$ODOO_LOG_LEVEL"
ONBUILD ARG LOCAL_CUSTOM_DIR=./custom
ONBUILD COPY $LOCAL_CUSTOM_DIR /opt/odoo/custom
# https://docs.python.org/2.7/library/logging.html#levels
Expand Down
25 changes: 24 additions & 1 deletion 8.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ ONBUILD ARG PGUSER=odoo
ONBUILD ARG PGPASSWORD=odoopassword
ONBUILD ARG PGHOST=db
ONBUILD ARG PGDATABASE=prod
ONBUILD ARG ODOO_MAX_CRON_THREADS=1
ONBUILD ARG ODOO_WORKERS=4
ONBUILD ARG ODOO_LIMIT_TIME_REAL=120
ONBUILD ARG ODOO_LIMIT_TIME_CPU=60
ONBUILD ARG ODOO_LIMIT_MEMORY_HARD=805306368
ONBUILD ARG ODOO_LIMIT_MEMORY_SOFT=671088640
ONBUILD ARG ODOO_LIMIT_REQUEST=8192
ONBUILD ARG ODOO_LIMIT_TIME_REAL_CRON=-1
ONBUILD ARG ODOO_DB_FILTER=""
ONBUILD ARG ODOO_LIST_DB=1
ONBUILD ARG ODOO_LOG_LEVEL=info
# Config variables
ONBUILD ENV ADMIN_PASSWORD="$ADMIN_PASSWORD" \
UNACCENT="$UNACCENT" \
Expand All @@ -48,7 +59,19 @@ ONBUILD ENV ADMIN_PASSWORD="$ADMIN_PASSWORD" \
SMTP_PASSWORD="$SMTP_PASSWORD" \
SMTP_SSL="$SMTP_SSL" \
EMAIL_FROM="$EMAIL_FROM" \
WITHOUT_DEMO="$WITHOUT_DEMO"
WITHOUT_DEMO="$WITHOUT_DEMO" \
ODOO_MAX_CRON_THREADS="$ODOO_MAX_CRON_THREADS" \
ODOO_WORKERS="$ODOO_WORKERS" \
ODOO_LIMIT_TIME_REAL="$ODOO_LIMIT_TIME_REAL" \
ODOO_LIMIT_TIME_CPU="$ODOO_LIMIT_TIME_CPU" \
ODOO_LIMIT_MEMORY_HARD="$ODOO_LIMIT_MEMORY_HARD" \
ODOO_LIMIT_MEMORY_SOFT="$ODOO_LIMIT_MEMORY_SOFT" \
ODOO_LIMIT_REQUEST="$ODOO_LIMIT_REQUEST" \
ODOO_LIMIT_TIME_REAL_CRON="$ODOO_LIMIT_TIME_REAL_CRON" \
ODOO_DB_FILTER="$ODOO_DB_FILTER" \
ODOO_LIST_DB="$ODOO_LIST_DB" \
ODOO_LOG_LEVEL="$ODOO_LOG_LEVEL"
>>>>>>> [IMP] Add some more default configurations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops.. wrong rebase

ONBUILD ARG LOCAL_CUSTOM_DIR=./custom
ONBUILD COPY $LOCAL_CUSTOM_DIR /opt/odoo/custom
# https://docs.python.org/2.7/library/logging.html#levels
Expand Down
1 change: 0 additions & 1 deletion conf.d/00-base.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[options]
; Configuration file template that will be expanded on build
admin_passwd = $ADMIN_PASSWORD
data_dir = /var/lib/odoo
unaccent = $UNACCENT
8 changes: 8 additions & 0 deletions conf.d/60-performance.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
max_cron_threads = $ODOO_MAX_CRON_THREADS
workers = $ODOO_WORKERS
limit_time_real = $ODOO_LIMIT_TIME_REAL
limit_time_cpu = $ODOO_LIMIT_TIME_CPU
limit_memory_hard = $ODOO_LIMIT_MEMORY_HARD
limit_memory_soft = $ODOO_LIMIT_MEMORY_SOFT
limit_request = $ODOO_LIMIT_REQUEST
limit_time_real_cron = $ODOO_LIMIT_TIME_REAL_CRON
3 changes: 3 additions & 0 deletions conf.d/70-security.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
admin_passwd = $ADMIN_PASSWORD
dbfilter = $ODOO_DB_FILTER
list_db = $ODOO_LIST_DB
1 change: 1 addition & 0 deletions conf.d/80-logging.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
log_level = $ODOO_LOG_LEVEL
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def test_settings(self):
("--stop-after-init",),
# SMTP settings work
("./custom/scripts/test_smtp_settings.py",),
# Environment vars were converted to config
("bash", "-c",
"odoo --stop-after-init && custom/extras/goodconf.py"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --stop-after-init is done above, just call goodconf

)
# Odoo 8.0 has no shell
for sub_env in matrix(odoo_skip={"8.0"}):
Expand Down
4 changes: 4 additions & 0 deletions tests/scaffoldings/dotd/custom/extras/goodconf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/local/bin/python-odoo-shell
from odoo.tools import config
assert config.get("limit_request") == "8000"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still fails on line 3.

I'm suspecting that duplicate keys cannot be correctly parsed, or that the parameter is converted to int and thus this assertion fails.

Maybe could you add assertion messages that help us to debug further? Example:

assert config.get("limit_request") == 8000, "%r is not %r" % (config.get("limit_request"), 8000)

... and the same in line 4

assert not config.get("list_db")
2 changes: 2 additions & 0 deletions tests/scaffoldings/dotd/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ services:
PGPASSWORD: anotherodoopassword
PGHOST: postgresql
PGDATABASE: ${DBNAME:-prod}
ODOO_LIMIT_REQUEST: 8000
ODOO_LIST_DB: 0
depends_on:
- postgresql
volumes:
Expand Down