diff --git a/CHANGELOG.md b/CHANGELOG.md index 137b2ede..e641c04e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. The format * Image has env vars to initialize database. * `test-docker` uses new env vars to initialize database. * Extended usage section of Odoo Build README file. +* Use the prefixed `PG` env vars for database connection. ### Fixed diff --git a/addons/connector b/addons/connector index 93c8bbee..33b9bd86 160000 --- a/addons/connector +++ b/addons/connector @@ -1 +1 @@ -Subproject commit 93c8bbeee40618efaaad22dfa168b5b52f2751ff +Subproject commit 33b9bd86fb263c035bf3c8386dccde7f48801571 diff --git a/addons/hr b/addons/hr index 5155dac0..67f72850 160000 --- a/addons/hr +++ b/addons/hr @@ -1 +1 @@ -Subproject commit 5155dac079c5a66014ed38b5192cfafa29275618 +Subproject commit 67f72850824af1d4bc307922436d5b7d7110fc2b diff --git a/build/Dockerfile.mintsystem.odoo b/build/Dockerfile.mintsystem.odoo index 0d1edafc..e09c68d7 100644 --- a/build/Dockerfile.mintsystem.odoo +++ b/build/Dockerfile.mintsystem.odoo @@ -87,6 +87,10 @@ RUN npm install -g rtlcss RUN python3 -m venv /opt/odoo-venv ENV PATH=/opt/odoo-venv/bin:$PATH +# Install Odoo tools +COPY ./build/requirements.txt /opt/odoo-venv/ +RUN pip install --no-cache-dir -r /opt/odoo-venv/requirements.txt + # Install Odoo COPY ./odoo /opt/odoo RUN pip install --no-cache-dir -e /opt/odoo -r /opt/odoo/requirements.txt \ @@ -102,7 +106,7 @@ ENV ODOO_VERSION $ODOO_VERSION # Copy entrypoint script and Odoo configuration file COPY ./build/odoo.conf.template /etc/odoo/ COPY ./build/entrypoint.sh / -COPY ./build/parse-url /usr/local/bin/parse-url +COPY ./build/parse-url /usr/local/bin/ RUN chmod +x /usr/local/bin/parse-url # Create a user named odoo @@ -135,10 +139,10 @@ EXPOSE 8069 8071 8072 # Set the default config file ENV ODOO_RC /etc/odoo/odoo.conf -COPY ./build/wait-for-psql.py /usr/local/bin/wait-for-psql.py +COPY ./build/wait-for-psql.py /usr/local/bin/ # Set default user when running the container USER odoo ENTRYPOINT ["/entrypoint.sh"] -CMD ["odoo"] +CMD ["odoo"] \ No newline at end of file diff --git a/build/README.md b/build/README.md index 87f90f9f..f4f79bef 100644 --- a/build/README.md +++ b/build/README.md @@ -3,15 +3,15 @@ A better Odoo image. - Ships with python 3.11 -- Odoo source is based on exact git revision +- Odoo source is based on exact [revision](https://odoo.build/revisions.html) - Setup `odoo.conf` with environment vars - Clone addons from git repos - Install pip packages without building the image -- Detects addons in nested module folders +- Detect addons in nested module folders - Store session information in database - Get environment name from server config - Initialize database with selected modules -- Auto update modules that have changed +- Built-in [manifestoo](https://github.com/acsone/manifestoo) and [click-odoo-contrib](https://github.com/acsone/click-odoo-contrib) Source: @@ -22,14 +22,14 @@ version: "3" services: odoo: container_name: odoo - image: mintsystem/odoo:16.0.20241125 + image: mintsystem/odoo:16.0.20241220 depends_on: - db environment: - HOST: db - USER: odoo - PASSWORD: odoo - PORT: 5432 + PGHOST: db + PGUSER: odoo + PGPASSWORD: odoo + PGPORT: 5432 GIT_SSH_PUBLIC_KEY: ssh-ed25519 BBBBC3NzaC1lZDI1NTE5BBBBIDR9Ibi0mATjCyx1EYg594oFkY0rghtgo+pnFHOvAcym Mint-System-Project-MCC@github.com GIT_SSH_PRIVATE_KEY: | -----BEGIN OPENSSH PRIVATE KEY----- @@ -43,9 +43,8 @@ services: ODOO_DATABASE: 16.0 ODOO_INIT: True ODOO_INIT_LANG: de_CH - ODOO_ADDONS_AUTO_UPDATE: True ENVIRONMENT: production - PIP_INSTALL: postgres-client,manifestoo + PIP_INSTALL: prometheus-client SERVER_WIDE_MODULES: web,session_db SESSION_DB_URI: postgres://odoo:odoo@db/16.0 PROXY_MODE: True @@ -83,10 +82,10 @@ volumes: Odoo supports PostgreSQL database only. -* `HOST` Name of the database container. -* `USER` Database username. -* `PASSWORD` Database user password. -* `PORT` Postgres server port. Default is `5432`. +* `PGHOST` Name of the database container. +* `PGUSER` Database username. +* `PGPASSWORD` Database user password. +* `PGPORT` Postgres server port. Default is `5432`. ### Module Repos @@ -96,18 +95,20 @@ The entrypoint script can clone git repositories. * `GIT_SSH_PRIVATE_KEY` Private key for SSH connection. * `ADDONS_GIT_REPOS` Comma seperated list of git clone urls appended with `#` and branch name. -### Addons +### Addons Path -The entrypoint script searches for module folders in the addons paths and creates a new addons path. +The entrypoint script searches for module folders in the addons path and creates a new addons path. + +* `ODOO_ADDONS_PATH` Comma seperated list of container paths pointing to addon folders. + +### Initialize + +If enabled the entrypoint script initializes the Odoo database. -* `ODOO_ADDONS_PATH` Comma seperated list of container paths to the addons folders. * `ODOO_DATABASE` Name of the Odoo database. Default is `odoo`. * `ODOO_INIT` Enable to initalise the database. Default is `False`. * `ODOO_INIT_LANG` Language used for database initialisation. Default is `en_US`. * `ODOO_INIT_ADDONS` Provide comma separated list of modules for database initialisation. Default is `web`. -* `ODOO_ADDONS_AUTO_UPDATE` Detect file changes in module folders and update modules that changed. Default is `False`. - -The default login is `admin:admin`. ### Server Environment @@ -147,16 +148,36 @@ Here are the most important container paths. * `/opt/odoo-venv` This is where Python packages are installed. * `/mnt/extra-addons` Module folders are loaded from this path by default. +### Mainfestoo + +With the Manifestoo cli you can query the module manifests files. + +List all modules: + +```bash +docker exec odoo manifestoo --select-found list +``` + +### click-odoo + +With the click-odoo you can manage the Odoo database. + +Update all modules that have changed: + +```bash +docker exec odoo bash -c "click-odoo-update \$(grep addons_path /etc/odoo/odoo.conf | sed 's/addons_path = /--addons-path=/') -d odoo +``` + ## Develop As with every Docker image this image can be updated. ### Install packages -Extend the image with additional Python packages. +Extend the image with Python packages. ```dockerfile -FROM mintsystem/odoo:16.0.20241125 +FROM mintsystem/odoo:16.0.20241220 RUN pip install prometheus-client astor fastapi python-multipart ujson a2wsgi parse-accept-language pyjwt ``` @@ -166,7 +187,7 @@ RUN pip install prometheus-client astor fastapi python-multipart ujson a2wsgi pa Copy a custom Odoo conf file to the image. ```dockerfile -FROM mintsystem/odoo:16.0.20241125 +FROM mintsystem/odoo:16.0.20241220 COPY ./odoo.conf.template /etc/odoo/ ``` diff --git a/build/entrypoint.sh b/build/entrypoint.sh index acdb503e..11b52a3c 100755 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -99,32 +99,35 @@ set_odoo_config_env() { # Remove duplicate module paths ODOO_ADDONS_PATH=$(echo "$ODOO_ADDONS_PATH" | tr "," "\n" | sort -u | tr "\n" "," | sed 's/,$//') fi + + GIT_SSH_PRIVATE_KEY=$(echo -e "$GIT_SSH_PRIVATE_KEY" | base64 -w0) + export GIT_SSH_PRIVATE_KEY + export GIT_SSH_PUBLIC_KEY + : "${ENVIRONMENT:=development}" + export ENVIRONMENT + : "${SERVER_WIDE_MODULES:=web}" + export SERVER_WIDE_MODULES + : "${PROXY_MODE:=False}" + export PROXY_MODE : "${LOG_LEVEL:=info}" export LOG_LEVEL + + : "${LIST_DB:=True}" + export LIST_DB : "${ADMIN_PASSWD:=odoo}" export ADMIN_PASSWD : "${DBFILTER:=.*}" export DBFILTER - : "${ENVIRONMENT:=development}" - export ENVIRONMENT - : "${LIST_DB:=True}" - export LIST_DB - : "${PROXY_MODE:=False}" - export PROXY_MODE + : "${WORKERS:=0}" export WORKERS - : "${SERVER_WIDE_MODULES:=web}" - export SERVER_WIDE_MODULES : "${LIMIT_REQUEST:=8192}" export LIMIT_REQUEST : "${LIMIT_TIME_CPU:=60}" export LIMIT_TIME_CPU : "${LIMIT_TIME_REAL:=120}" export LIMIT_TIME_REAL - GIT_SSH_PRIVATE_KEY=$(echo -e "$GIT_SSH_PRIVATE_KEY" | base64 -w0) - export GIT_SSH_PRIVATE_KEY - export GIT_SSH_PUBLIC_KEY } set_odoo_config_env @@ -158,10 +161,10 @@ pip_install # set the postgres database host, port, user and password according to the environment # and pass them as arguments to the odoo process if not present in the config file -: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}} -: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}} -: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}} -: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}} +: ${PGHOST:=${DB_PORT_5432_TCP_ADDR:='db'}} +: ${PGPORT:=${DB_PORT_5432_TCP_PORT:=5432}} +: ${PGUSER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}} +: ${PGPASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}} DB_ARGS=() function check_config() { @@ -173,10 +176,10 @@ function check_config() { DB_ARGS+=("--${param}") DB_ARGS+=("${value}") } -check_config "db_host" "$HOST" -check_config "db_port" "$PORT" -check_config "db_user" "$USER" -check_config "db_password" "$PASSWORD" +check_config "db_host" "$PGHOST" +check_config "db_port" "$PGPORT" +check_config "db_user" "$PGUSER" +check_config "db_password" "$PGPASSWORD" init_db() { : "${ODOO_DATABASE:=odoo}" diff --git a/build/requirements.txt b/build/requirements.txt new file mode 100644 index 00000000..5297d197 --- /dev/null +++ b/build/requirements.txt @@ -0,0 +1,2 @@ +manifestoo +click-odoo-contrib \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6f76923a..6cbdee7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,10 @@ services: USER: odoo PASSWORD: odoo PORT: ${POSTGRES_PORT} + PGHOST: db + PGUSER: odoo + PGPASSWORD: odoo + PGPORT: ${POSTGRES_PORT} GIT_SSH_PUBLIC_KEY: ${GIT_SSH_PUBLIC_KEY} GIT_SSH_PRIVATE_KEY: ${GIT_SSH_PRIVATE_KEY} ADDONS_GIT_REPOS: ${ADDONS_GIT_REPOS} @@ -18,7 +22,6 @@ services: ODOO_INIT: ${ODOO_INIT} ODOO_INIT_LANG: ${ODOO_INIT_LANG} ODOO_INIT_ADDONS: ${ODOO_INIT_ADDONS} - ODOO_ADDONS_AUTO_UPDATE: ${ODOO_ADDONS_AUTO_UPDATE} ENVIRONMENT: ${ENVIRONMENT} PIP_INSTALL: ${PIP_INSTALL} SERVER_WIDE_MODULES: ${SERVER_WIDE_MODULES} diff --git a/enterprise b/enterprise index 0f2f65fc..11dfe245 160000 --- a/enterprise +++ b/enterprise @@ -1 +1 @@ -Subproject commit 0f2f65fc3d30fe18cfca243828c3c2ffc03a8400 +Subproject commit 11dfe2455173a158b1c1421012867fe5a38967a7 diff --git a/oca/sale-workflow b/oca/sale-workflow index bf65e8d1..c3c12176 160000 --- a/oca/sale-workflow +++ b/oca/sale-workflow @@ -1 +1 @@ -Subproject commit bf65e8d1e5354dda5a37a5ed309784f79732d2ba +Subproject commit c3c12176e2dead7e6c7f0e21308686c838c4cc6e diff --git a/odoo b/odoo index c666e182..ced51f4d 160000 --- a/odoo +++ b/odoo @@ -1 +1 @@ -Subproject commit c666e18295f3387391d8cd416543cbbdad52cdbd +Subproject commit ced51f4db71cdd92eca588a29bede7df46931f83 diff --git a/scripts/odoo_revision_16.0.20241220 b/scripts/odoo_revision_16.0.20241220 new file mode 100755 index 00000000..b0703435 --- /dev/null +++ b/scripts/odoo_revision_16.0.20241220 @@ -0,0 +1,5 @@ +ODOO_REVISION=16.0.20241220 +ODOO_REF=b2e2927db2bd23310deefea17edec18e7683d278 +ODOO_ENTERPRISE_REF=c30ec470ed1441c89b80632cc68f610b46096786 +ODOO_THEME_REF=6681d6cc6d72a5f1cfb242846713cc92fee83f28 +ODOO_DOCKER_REF=odoo@sha256:f815afc0a7635ef5e34b2031f27cb8b7b15b242dd59f001cc380386328a5a629 \ No newline at end of file diff --git a/task b/task index 6695c8d0..8381fd2c 100755 --- a/task +++ b/task @@ -552,7 +552,7 @@ function build() { docker image rm "${DOCKER_REGISTRY}${DOCKER_TAG}" ODOO_DATE="" - if [[ "ODOO_REVISION" != "GIT_BRANCH" ]]; then + if [[ "ODOO_REVISION" != "$GIT_BRANCH" ]]; then ODOO_DATE=$(echo "$ODOO_REVISION" | cut -d'.' -f3-) fi @@ -858,7 +858,7 @@ function test-docker() { export ODOO_INIT=True export ODOO_INIT_LANG=de_CH - export ODOO_INIT_ADDONS=server_environment_ir_config_parameter,prometheus_exporter,mail_server_filter,git_base,contacts,web_enterprise + export ODOO_INIT_ADDONS=server_environment_ir_config_parameter,module_auto_update,prometheus_exporter,mail_server_filter,git_base,contacts,web_enterprise start } diff --git a/themes b/themes index fe912395..6681d6cc 160000 --- a/themes +++ b/themes @@ -1 +1 @@ -Subproject commit fe9123958637da9535981da6b5084847657ef8b3 +Subproject commit 6681d6cc6d72a5f1cfb242846713cc92fee83f28