Skip to content

Commit

Permalink
Merge pull request #39 from acsone/add-odoo-18
Browse files Browse the repository at this point in the history
Add odoo 18
  • Loading branch information
sbidoul authored Sep 19, 2024
2 parents 408754b + 1957cdd commit 12ecafe
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 9 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,16 @@ jobs:
PYTHONTAG: py312
PYTHONBIN: python3.12
DISTRO: jammy
- ODOOVERSION: "18.0"
PYTHONTAG: py312
PYTHONBIN: python3.12
DISTRO: noble
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile-${{ matrix.ODOOVERSION }}
Expand All @@ -133,9 +131,17 @@ jobs:
ODOOVERSION: "${{ matrix.ODOOVERSION }}"
PYTHONTAG: "${{ matrix.PYTHONTAG }}"
DISTRO: "${{ matrix.DISTRO }}"
BUILDER: "default"
run: pytest -v tests
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.repository_owner == 'acsone' && github.ref == 'refs/heads/master' }}
- name: Push image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile-${{ matrix.ODOOVERSION }}
Expand Down
54 changes: 54 additions & 0 deletions Dockerfile-18.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ARG DISTRO=noble

FROM docker.io/ubuntu:$DISTRO

LABEL org.opencontainers.image.authors="ACSONE SA/NV"

ARG PYTHONBIN=python3.12

ENV \
ODOO_VERSION=18.0 \
ODOO_BIN=odoo \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
KWKHTMLTOPDF_SERVER_URL=http://kwkhtmltopdf


COPY ./install /tmp/install
RUN set -x \
&& /tmp/install/pre-install.sh \
&& /tmp/install/tools.sh \
&& /tmp/install/gosu.sh \
&& /tmp/install/python3.sh \
&& /tmp/install/wkhtmltopdf.sh \
&& /tmp/install/pgdg.sh \
&& /tmp/install/post-install-clean.sh \
&& rm -r /tmp/install

# isolate from system python libraries
RUN set -x \
&& $PYTHONBIN -m venv /odoo \
&& /odoo/bin/pip install -U pip
ENV PATH=/odoo/bin:$PATH
ENV VIRTUAL_ENV=/odoo

# odoo config file
COPY ./templates/${ODOO_VERSION} /odoo/templates
ENV OPENERP_SERVER=/etc/odoo.cfg
ENV ODOO_RC=/etc/odoo.cfg

# odoo data dir (filestore, etc)
RUN mkdir -p /data/odoo
VOLUME ["/data/odoo"]

EXPOSE 8069 8072

# root banner
COPY ./root-banner /etc
RUN echo "cat /etc/root-banner" >> /root/.bashrc

COPY ./start-entrypoint.d /odoo/start-entrypoint.d
COPY ./bin/entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["odoo"]
2 changes: 2 additions & 0 deletions install/python3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ elif [ "${UBUNTU_CODENAME}" == "focal" ] ; then
SYSTEM_PYTHON=python3.8
elif [ "${UBUNTU_CODENAME}" == "jammy" ] ; then
SYSTEM_PYTHON=python3.10
elif [ "${UBUNTU_CODENAME}" == "noble" ] ; then
SYSTEM_PYTHON=python3.12
else
echo "Unknown UBUNTU_CODENAME '${UBUNTU_CODENAME}'"
exit 1
Expand Down
39 changes: 39 additions & 0 deletions templates/18.0/answers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
declare -x ADDONS_PATH="${ADDONS_PATH:-}"
declare -x DB_TEMPLATE="${DB_TEMPLATE:-template1}"
declare -x DB_HOST="${DB_HOST:-}"
declare -x DB_PORT="${DB_PORT:-5432}"
declare -x DB_REPLICA_HOST="${DB_REPLICA_HOST:-False}"
declare -x DB_REPLICA_PORT="${DB_REPLICA_PORT:-False}"
declare -x DB_NAME="${DB_NAME:-}"
declare -x DB_USER="${DB_USER:-}"
declare -x DB_PASSWORD="${DB_PASSWORD:-}"
declare -x DB_SSLMODE="${DB_SSLMODE:-prefer}"
declare -x DB_FILTER="${DB_FILTER:-^(${DB_NAME//,/|})$}"
declare -x LIST_DB="${LIST_DB:-False}"
declare -x ADMIN_PASSWD="${ADMIN_PASSWD:-}"
declare -x DB_MAXCONN="${DB_MAXCONN:-64}"
declare -x LIMIT_MEMORY_SOFT="${LIMIT_MEMORY_SOFT:-2147483648}"
declare -x LIMIT_MEMORY_SOFT_GEVENT="${LIMIT_MEMORY_SOFT_GEVENT:-False}"
declare -x LIMIT_MEMORY_HARD="${LIMIT_MEMORY_HARD:-2684354560}"
declare -x LIMIT_MEMORY_HARD_GEVENT="${LIMIT_MEMORY_HARD_GEVENT:-False}"
declare -x LIMIT_REQUEST="${LIMIT_REQUEST:-8192}"
declare -x LIMIT_TIME_CPU="${LIMIT_TIME_CPU:-60}"
declare -x LIMIT_TIME_REAL="${LIMIT_TIME_REAL:-120}"
declare -x LIMIT_TIME_REAL_CRON="${LIMIT_TIME_REAL_CRON:-120}"
declare -x LOG_HANDLER="${LOG_HANDLER:-':INFO'}"
declare -x LOG_LEVEL="${LOG_LEVEL:-info}"
declare -x MAX_CRON_THREADS="${MAX_CRON_THREADS:-2}"
declare -x WORKERS="${WORKERS:-4}"
declare -x LOGFILE="${LOGFILE:-None}"
declare -x LOG_DB="${LOG_DB:-False}"
declare -x SYSLOG="${SYSLOG:-False}"
declare -x RUNNING_ENV="${RUNNING_ENV:-dev}"
declare -x WITHOUT_DEMO="${WITHOUT_DEMO:-True}"
declare -x SERVER_WIDE_MODULES="${SERVER_WIDE_MODULES:-}"
declare -x UNACCENT="${UNACCENT:-False}"
declare -x ADDITIONAL_ODOO_RC="${ADDITIONAL_ODOO_RC:-}"
declare -x PGHOST=${DB_HOST}
declare -x PGPORT=${DB_PORT:-5432}
declare -x PGUSER=${DB_USER}
declare -x PGPASSWORD=${DB_PASSWORD}
declare -x PGDATABASE=${DB_NAME}
55 changes: 55 additions & 0 deletions templates/18.0/odoo.cfg.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[options]
addons_path = ${ADDONS_PATH}
data_dir = /data/odoo
auto_reload = False
db_template = ${DB_TEMPLATE}
db_host = ${DB_HOST}
db_port = ${DB_PORT}
db_replica_host = ${DB_REPLICA_HOST}
db_replica_port = ${DB_REPLICA_PORT}
db_name = ${DB_NAME}
db_user = ${DB_USER}
db_password = ${DB_PASSWORD}
db_sslmode = ${DB_SSLMODE}
dbfilter = ${DB_FILTER}
list_db = ${LIST_DB}
admin_passwd = ${ADMIN_PASSWD}
db_maxconn = ${DB_MAXCONN}
limit_memory_soft = ${LIMIT_MEMORY_SOFT}
limit_memory_soft_gevent = ${LIMIT_MEMORY_SOFT_GEVENT}
limit_memory_hard = ${LIMIT_MEMORY_HARD}
limit_memory_hard_gevent = ${LIMIT_MEMORY_HARD_GEVENT}
limit_request = ${LIMIT_REQUEST}
limit_time_cpu = ${LIMIT_TIME_CPU}
limit_time_real = ${LIMIT_TIME_REAL}
limit_time_real_cron = ${LIMIT_TIME_REAL_CRON}
log_handler = ${LOG_HANDLER}
log_level = ${LOG_LEVEL}
max_cron_threads = ${MAX_CRON_THREADS}
workers = ${WORKERS}
logfile = ${LOGFILE}
log_db = ${LOG_DB}
logrotate = True
syslog = ${SYSLOG}
running_env = ${RUNNING_ENV}
without_demo = ${WITHOUT_DEMO}
server_wide_modules = ${SERVER_WIDE_MODULES}
; We can activate proxy_mode even if we are not behind a proxy, because
; it is used only if HTTP_X_FORWARDED_HOST is set in environ
proxy_mode = True
; csv_internal_sep = ,
; debug_mode = False
; email_from = False
; http_port = 8069
; http_enable = True
; http_interface =
; gevent_port = 8072
; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False
; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False
unaccent = ${UNACCENT}
${ADDITIONAL_ODOO_RC}
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def compose_build():
cmd.extend(["--build-arg", f"PYTHONTAG={os.environ['PYTHONTAG']}"])
if "DISTRO" in os.environ:
cmd.extend(["--build-arg", f"DISTRO={os.environ['DISTRO']}"])
if "BUILDER" in os.environ:
cmd.extend(["--builder", os.environ["BUILDER"]])
subprocess.run(cmd, check=True, cwd=HERE)


Expand Down
55 changes: 55 additions & 0 deletions tests/data/expected-default-odoo-cfg-18.0.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[options]
addons_path =
data_dir = /data/odoo
auto_reload = False
db_template = template1
db_host = postgres
db_port = 5432
db_replica_host = False
db_replica_port = False
db_name = odoodb
db_user = odoouser
db_password = odoopassword
db_sslmode = prefer
dbfilter = ^(odoodb)$
list_db = False
admin_passwd =
db_maxconn = 64
limit_memory_soft = 2147483648
limit_memory_soft_gevent = False
limit_memory_hard = 2684354560
limit_memory_hard_gevent = False
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = 120
log_handler = ':INFO'
log_level = info
max_cron_threads = 2
workers = 4
logfile = None
log_db = False
logrotate = True
syslog = False
running_env = dev
without_demo = True
server_wide_modules =
; We can activate proxy_mode even if we are not behind a proxy, because
; it is used only if HTTP_X_FORWARDED_HOST is set in environ
proxy_mode = True
; csv_internal_sep = ,
; debug_mode = False
; email_from = False
; http_port = 8069
; http_enable = True
; http_interface =
; gevent_port = 8072
; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False
; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False
unaccent = False

55 changes: 55 additions & 0 deletions tests/data/expected-odoo-cfg-18.0.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[options]
addons_path = *ADDONS_PATH*
data_dir = /data/odoo
auto_reload = False
db_template = *DB_TEMPLATE*
db_host = *DB_HOST*
db_port = *DB_PORT*
db_replica_host = *DB_REPLICA_HOST*
db_replica_port = *DB_REPLICA_PORT*
db_name = *DB_NAME*
db_user = *DB_USER*
db_password = *DB_PASSWORD*
db_sslmode = *DB_SSLMODE*
dbfilter = *DB_FILTER*
list_db = *LIST_DB*
admin_passwd = *ADMIN_PASSWD*
db_maxconn = *DB_MAXCONN*
limit_memory_soft = *LIMIT_MEMORY_SOFT*
limit_memory_soft_gevent = *LIMIT_MEMORY_SOFT_GEVENT*
limit_memory_hard = *LIMIT_MEMORY_HARD*
limit_memory_hard_gevent = *LIMIT_MEMORY_HARD_GEVENT*
limit_request = *LIMIT_REQUEST*
limit_time_cpu = *LIMIT_TIME_CPU*
limit_time_real = *LIMIT_TIME_REAL*
limit_time_real_cron = *LIMIT_TIME_REAL_CRON*
log_handler = *LOG_HANDLER*
log_level = *LOG_LEVEL*
max_cron_threads = *MAX_CRON_THREADS*
workers = *WORKERS*
logfile = *LOGFILE*
log_db = *LOG_DB*
logrotate = True
syslog = *SYSLOG*
running_env = *RUNNING_ENV*
without_demo = *WITHOUT_DEMO*
server_wide_modules = *SERVER_WIDE_MODULES*
; We can activate proxy_mode even if we are not behind a proxy, because
; it is used only if HTTP_X_FORWARDED_HOST is set in environ
proxy_mode = True
; csv_internal_sep = ,
; debug_mode = False
; email_from = False
; http_port = 8069
; http_enable = True
; http_interface =
; gevent_port = 8072
; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False
; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False
unaccent = *UNACCENT*
*ADDITIONAL_ODOO_RC*
1 change: 0 additions & 1 deletion tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
services:
odoo:
build: .
Expand Down
4 changes: 4 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,19 @@ def test_odoo_cfg_env_vars():
"ADMIN_PASSWD",
"DB_FILTER",
"DB_HOST",
"DB_REPLICA_HOST",
"DB_MAXCONN",
"DB_NAME",
"DB_PASSWORD",
"DB_PORT",
"DB_REPLICA_PORT",
"DB_SSLMODE",
"DB_TEMPLATE",
"DB_USER",
"LIMIT_MEMORY_HARD",
"LIMIT_MEMORY_HARD_GEVENT",
"LIMIT_MEMORY_SOFT",
"LIMIT_MEMORY_SOFT_GEVENT",
"LIMIT_REQUEST",
"LIMIT_TIME_CPU",
"LIMIT_TIME_REAL",
Expand Down

0 comments on commit 12ecafe

Please sign in to comment.