From 85ed4b3a97b5e13ab3ccdcaf62691a4dd402e130 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 19 Nov 2024 16:07:43 +0100 Subject: [PATCH 1/2] update to run with podman containers --- .gitignore | 2 - Makefile | 7 +- README.rst | 59 ++-------- changelog | 6 + conf.d/main | 103 +++++------------- overlay/etc/apache2/sites-available/odoo.conf | 34 ------ overlay/etc/nginx/conf.d/odoo.conf | 27 +++++ overlay/etc/odoo/odoo.conf | 5 + overlay/etc/turnkey-podman/.env.template | 8 ++ overlay/usr/lib/inithooks/bin/odoo.py | 57 ++++------ .../lib/inithooks/firstboot.d/19pod-images | 50 +++++++++ .../inithooks/firstboot.d/20-odoo-db-secrets | 24 ---- .../inithooks/firstboot.d/20gen-pod-secrets | 16 +++ overlay/usr/lib/inithooks/firstboot.d/39pod | 56 ++++++++++ overlay/usr/lib/inithooks/firstboot.d/40odoo | 15 +-- overlay/var/cache/podman-images/.keep | 0 plan/main | 16 +-- 17 files changed, 239 insertions(+), 246 deletions(-) delete mode 100644 overlay/etc/apache2/sites-available/odoo.conf create mode 100644 overlay/etc/nginx/conf.d/odoo.conf create mode 100644 overlay/etc/odoo/odoo.conf create mode 100644 overlay/etc/turnkey-podman/.env.template create mode 100755 overlay/usr/lib/inithooks/firstboot.d/19pod-images delete mode 100755 overlay/usr/lib/inithooks/firstboot.d/20-odoo-db-secrets create mode 100755 overlay/usr/lib/inithooks/firstboot.d/20gen-pod-secrets create mode 100755 overlay/usr/lib/inithooks/firstboot.d/39pod create mode 100644 overlay/var/cache/podman-images/.keep diff --git a/.gitignore b/.gitignore index 17a8d54..378eac2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ build -*.pyc -*.bak diff --git a/Makefile b/Makefile index ba971ab..03e8b1c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,2 @@ -CREDIT_ANCHORTEXT = Turnkey Odoo Appliance - -BACKPORTS=y # install Odoo v16.x from backports -BACKPORTS_PINS=odoo-16 - -include $(FAB_PATH)/common/mk/turnkey/lapp.mk +CREDIT_ANCHORTEXT = TurnKey Odoo Appliance include $(FAB_PATH)/common/mk/turnkey.mk diff --git a/README.rst b/README.rst index c68e98f..d428778 100644 --- a/README.rst +++ b/README.rst @@ -14,70 +14,35 @@ This appliance includes all the standard features in `TurnKey Core`_: - Odoo configurations for TurnKey v18.x: - - Odoo v16 installed from debian backports apt repo (v18.x). + - Odoo v18 installed from Docker Hub. - Includes modules from base install of Odoo. -- **Security note**: As of 18.0, due to using the debian backports repo - Updates to Odoo **ARE NOT** configured to install automatically. +- **Security note**: Updates to Odoo **ARE NOT** configured to install automatically. - SSL support out of the box. - `Adminer`_ administration frontend for PostgreSQL (listening on port 12322 - uses SSL). -- Webmin modules for configuring Apache2, PostgreSQL and Postfix. - -**To create a new Odoo Databse (i.e. site)** - -To create a new Odoo DB, the Odoo config file needs to be edited and the -Odoo service restarted. - -Overview of process: -1. Edit /etc/odoo/odoo - - change value of "db_name" from "TurnkeylinuxExample" to your desired DB - name -2. Restart odoo.service -3. Reload Odoo login screen in your browser and you should be good to go - -Webmin steps: -1. - - Browse to 'Tools' >> 'FileManager' - - Navigate to '/etc/odoo' and edit the 'odoo.conf' file - - Edit as per step 1 above - - Save changes -2. - - Navigate to 'System' >> 'Bootup and Shutdown' - - Find the "odoo.service" in the list and select it via the checkbox - - Scroll to the bottom and select 'Restart' -3. - - As per step 3 above - -CLI steps: -1. - - Edit /etc/odoo/odoo as per step 1 -2. - - Restart odoo.service:: - - systemctl restart odoo -3. - - As per step 3 above +- Webmin modules for configuring PostgreSQL and Postfix. **Notice for special Odoo Localization** -In case you run a L10n Odoo Localization you will need other PIP Packages -and Libs installed on your system, please check your localization support on -OCA_. +In case you need an Odoo Localization you might need other `pip` packages +and libs installed in the `odoo` container, please check your localization support +on OCA_. Credentials *(passwords set at first boot)* ------------------------------------------- **Note**: the Odoo password set at firstboot applies to both the Odoo -admin account (example app) AND the masterpassword - however these can be -changed individually after firstboot. +admin account (example app) AND the master password, however these can be +changed individually as per upstream docs_ after firstboot. - Webmin, SSH: username **root** -- PostgreSQL, Adminer: username **postgres** +- PostgreSQL, Adminer: randomly generated (see `/etc/turnkey-podman/.env`) - Odoo Master Account: **admin** -.. _Odoo: https://www.odoo.com/ +.. _Odoo: https://www.odoo.com .. _TurnKey Core: https://www.turnkeylinux.org/core -.. _Adminer: https://www.adminer.org/ +.. _Adminer: https://www.adminer.org .. _OCA: https://github.com/OCA +.. _docs: https://www.odoo.com/documentation diff --git a/changelog b/changelog index 37dd4e1..19b904b 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,9 @@ +turnkey-odoo-18.1 (1) turnkey; urgency=low + + * Install Odoo v18, PostgreSQL v15 and latest Nginx from Docker Hub images. + + -- Anton Pyrogovskyi Tue, 19 Nov 2024 16:11:52 +0100 + turnkey-odoo-18.0 (1) turnkey; urgency=low * Install Odoo v16.x from Debian backports (bookworm-backports) apt diff --git a/conf.d/main b/conf.d/main index 74d377a..7ccc9cd 100755 --- a/conf.d/main +++ b/conf.d/main @@ -1,87 +1,38 @@ #!/bin/bash -ex -# Set variables -# - -DB_USER=odoo -DB_PASS=$(mcookie) -DB_NAME="TurnkeylinuxExample" +export DEPS=( postgres:15-alpine nginx:alpine odoo:18 ) -# We will use a random password for now. Reset during inithook -ODOO_ADMIN_PASSWORD=$(mcookie) +# clean up build fs +fs_cleanup() { + mount -l -t fuse.fuse-overlayfs | cut -d " " -f3 | xargs -rL1 fusermount -u || true + umount -vRf /sys || true + rm -f /dev/fuse +} -# User name that Odoo will run under -SERVICE_USER=$DB_USER +cache_images() { + # umount everything if build fails; otherwise `deck -D` won't work! + trap fs_cleanup INT TERM EXIT -CONF=/etc/odoo/odoo.conf + # podman requires sysfs & cgroups & fuse for fuse-overlayfs + mount -t sysfs sysfs /sys -o ro,nosuid,nodev,noexec,relatime + mkdir -p /sys/fs/{cgroup,fuse/connections} + mount -t cgroup2 cgroup2 /sys/fs/cgroup -o rw,nosuid,nodev,noexec,relatime + mount -t fusectl fusectl /sys/fs/fuse/connections -o rw,nosuid,nodev,noexec,relatime + mknod /dev/fuse -m 0666 c 10 229 || true -# Create database role for odoo -# ******************************************* - -# Start postgresql server -systemctl start postgresql + [[ "$FAB_HTTP_PROXY" ]] && export HTTP_PROXY="$FAB_HTTP_PROXY" -# Create db user -su postgres -c "createuser --superuser --createdb --no-createrole $DB_USER" + local name + for i in "${DEPS[@]}"; do + name="$(basename "$i" | cut -d':' -f1)" -# Set db user password -su postgres -c "psql postgres" << EOF -alter user $DB_USER with encrypted password '$DB_PASS'; -EOF -su postgres -c "psql postgres" << EOF -create database "$DB_NAME" owner $DB_USER; -EOF + podman pull "docker.io/$i" + podman save --format oci-dir -o "/var/cache/podman-images/$name" "$i" + done -# Set password/name in config file -sed -i "s|db_password =.*|db_password = $DB_PASS|" $CONF -sed -i "s|db_host =.*|db_host = localhost|" $CONF -echo "db_name = $DB_NAME" >> $CONF + unset HTTP_PROXY -# Stop postgresql server -systemctl stop postgresql + podman system reset -f +} -# Set admin password to random value for now -sed -i "s|admin_passwd =.*|admin_passwd = $ODOO_ADMIN_PASSWORD|" $CONF -chown odoo:odoo $CONF - -# Add and disable service user -usermod -L $SERVICE_USER - -# Enable needed modules -a2enmod proxy_http headers rewrite - -# Configure sites -a2dissite 000-default -a2ensite odoo.conf - -# Populate database -systemctl start postgresql -systemctl start apache2 - -su odoo -g odoo -s '/bin/bash' -c 'odoo -i base \ - --stop-after-init --db_host=localhost \ - -d '"\"$DB_NAME\""' \ - -r '"\"$DB_USER\""' \ - -w '"\"$DB_PASS\""' \ - -s -c '"\"$CONF\"" - -# enable and start odoo -systemctl enable odoo -systemctl start odoo - -while [[ "$(curl -Lk http://localhost)" = *"Unavailable"* ]]; do - sleep 1 -done - -URL="https://127.0.0.1/web" -CURL="curl --insecure -c /tmp/cookie -b /tmp/cookie" - -$CURL $URL/login -sleep 1 -$CURL $URL/database/manager -sleep 1 -$CURL $URL/database/change_password --data-raw "master_pwd=admin&master_pwd_new=${ODOO_ADMIN_PASSWORD}" - -systemctl stop odoo -systemctl stop postgresql -systemctl stop apache2 +cache_images diff --git a/overlay/etc/apache2/sites-available/odoo.conf b/overlay/etc/apache2/sites-available/odoo.conf deleted file mode 100644 index e1cbb55..0000000 --- a/overlay/etc/apache2/sites-available/odoo.conf +++ /dev/null @@ -1,34 +0,0 @@ -ServerName localhost - - - RewriteEngine on - ReWriteCond %{SERVER_PORT} !^443$ - RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] - - - - SSLEngine on - ServerAdmin webmaster@localhost - - ProxyRequests Off - - - Order deny,allow - Allow from all - - - ProxyVia On - - # Needed for real time message / chat feature (longpolling) - ProxyPass /longpolling/poll http://127.0.0.1:8072/longpolling/poll/ timeout=200 - ProxyPass /longpolling/poll/ http://127.0.0.1:8072/longpolling/poll/ timeout=200 - ProxyPassReverse /longpolling/poll/ http://127.0.0.1:8072/longpolling/poll/ - - ProxyPass / http://127.0.0.1:8069/ timeout=200 - ProxyPassReverse / http://127.0.0.1:8069/ - - RequestHeader set "X-Forwarded-Proto" "https" - - # Fix IE problem (http error 408/409) - SetEnv proxy-nokeepalive 1 - diff --git a/overlay/etc/nginx/conf.d/odoo.conf b/overlay/etc/nginx/conf.d/odoo.conf new file mode 100644 index 0000000..3242af0 --- /dev/null +++ b/overlay/etc/nginx/conf.d/odoo.conf @@ -0,0 +1,27 @@ +server { + listen 80 default_server; + server_name _; + + location / { + return 301 https://$http_host$request_uri; + } +} + +server { + listen 443 ssl default_server; + server_name _; + http2 on; + + ssl_certificate /etc/ssl/private/cert.pem; + ssl_certificate_key /etc/ssl/private/cert.key; + ssl_dhparam /etc/ssl/private/dhparams.pem; + + proxy_set_header X-Forwarded-Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + location / { + proxy_pass http://127.0.0.1:8069; + } +} + diff --git a/overlay/etc/odoo/odoo.conf b/overlay/etc/odoo/odoo.conf new file mode 100644 index 0000000..b662e5c --- /dev/null +++ b/overlay/etc/odoo/odoo.conf @@ -0,0 +1,5 @@ +[options] +addons_path = /mnt/extra-addons +data_dir = /var/lib/odoo +admin_passwd = admin +proxy_mode = True diff --git a/overlay/etc/turnkey-podman/.env.template b/overlay/etc/turnkey-podman/.env.template new file mode 100644 index 0000000..e4ab00f --- /dev/null +++ b/overlay/etc/turnkey-podman/.env.template @@ -0,0 +1,8 @@ +# db container +POSTGRES_DB=${DB_NAME} +POSTGRES_USER=${DB_USER} +POSTGRES_PASSWORD=${DB_PASS} + +# odoo container +USER=${DB_USER} +PASSWORD=${DB_PASS} diff --git a/overlay/usr/lib/inithooks/bin/odoo.py b/overlay/usr/lib/inithooks/bin/odoo.py index 76cbf67..99e2a2e 100755 --- a/overlay/usr/lib/inithooks/bin/odoo.py +++ b/overlay/usr/lib/inithooks/bin/odoo.py @@ -1,35 +1,29 @@ #!/usr/bin/python3 +"""Set Odoo admin/master password -"""Set Odoo Admin Password Option: - --pass= unless provided, will ask interactively + --pass= unless provided, will ask interactively """ -import re +import os import sys import getopt - -import crypt -import random -import hashlib -import configparser - import subprocess + +from libinithooks import inithooks_cache from libinithooks.dialog_wrapper import Dialog -from pgsqlconf import PostgreSQL from passlib.context import CryptContext def usage(s=None): if s: - print("Error:", s, file=sys.stderr) + print("Error:", s, file=sys.stderr, **kwargs) print("Syntax: %s [options]" % sys.argv[0], file=sys.stderr) print(__doc__, file=sys.stderr) sys.exit(1) def main(): try: - opts, args = getopt.gnu_getopt(sys.argv[1:], "h", - ['help', 'pass=']) + opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass=']) except getopt.GetoptError as e: usage(e) @@ -40,38 +34,27 @@ def main(): elif opt == '--pass': password = val - if not password: d = Dialog('TurnKey Linux - First boot configuration') password = d.get_password( - "Odoo Database Managment & example 'admin' Password", - "Enter new password for Odoo Database Management - create/delete/manage Odoo DBs. " - "This password will also login to 'admin' account of default/example Odoo.", - blacklist=['\\', '/']) + "Odoo Password", + "Enter new password for the Odoo 'admin' account and database management.", + ) - processed_password = CryptContext(['pbkdf2_sha512']).hash(password) + hash = CryptContext(schemes=['pbkdf2_sha512']).hash(password) - default_db = 'TurnkeylinuxExample' - default_db_exists = True - try: - p = PostgreSQL(default_db) - p.execute("UPDATE res_users SET password='{}' WHERE id=2".format( - processed_password).encode('utf8')) - except subprocess.CalledProcessError as e: - default_db_exists = False - print(f"Default DB ({default_db}) not found - skipping setting passsword for that") + db_name = os.environ.get("POSTGRES_DB", "odoo") + db_user = os.environ.get("POSTGRES_USER", "odoo") - sys.path.insert(0, '/usr/lib/python3/dist-packages') - import odoo - odoo.tools.config.parse_config(['--config=/etc/odoo/odoo.conf']) - odoo.tools.config.set_admin_password(password) - odoo.tools.config.save() + stmts = ["UPDATE res_users SET password='%s' WHERE id=2;" % (hash)] + for stmt in stmts: + _ = subprocess.run(["podman", "exec", "db", "psql", "-U", db_user, db_name, "-c", stmt]) - # restart odoo to apply updated password - subprocess.run(['systemctl', 'restart', 'odoo']) + config = "/etc/odoo/odoo.conf" + _ = subprocess.run(["sed", "-ri", 's|^admin_passwd.*$|admin_passwd = %s|' % (hash), config]) - if not default_db_exists: - sys.exit(1) + print("Restarting services; please wait...") + _ = subprocess.run(['podman', 'restart', 'odoo']) if __name__ == "__main__": main() diff --git a/overlay/usr/lib/inithooks/firstboot.d/19pod-images b/overlay/usr/lib/inithooks/firstboot.d/19pod-images new file mode 100755 index 0000000..9d789ce --- /dev/null +++ b/overlay/usr/lib/inithooks/firstboot.d/19pod-images @@ -0,0 +1,50 @@ +#!/bin/bash -ex +# load cached Podman images + +. /etc/default/inithooks +[ -e "$INITHOOKS_CONF" ] && . "$INITHOOKS_CONF" + +CACHE='/var/cache/podman-images' + +if [[ -d "$CACHE" ]]; then + echo 'Loading stored Podman images...' + + if mount | grep -q 'on / .*live'; then + # grow tmpfs + mount -o remount,size=90% /run/live/overlay + + MAX="$(du -sm "$CACHE" | sort -rh | head -1 | cut -f1)" + FREE="$(free -m | head -2 | tail -1 | awk '{print $7;}')" + + echo "Running live -- checking memory usage." + echo "Max memory used for images will be ${MAX}M, ${FREE}M is currently free." + + if [[ "$MAX" -ge "$FREE" ]]; then + echo "max ${MAX}M >= free ${FREE}M!" + echo "Install to disk or add more RAM." + echo "Cannot run live on this system, exiting." + exit 1 + else + echo 'This is fine.' + fi + fi + + # load and clean up images + for i in "$CACHE"/*; do + podman load -qi "${i}" + + # restore old tag for sane updates later + TAG="$(basename "$i")" + ORIG_TAG="$(jq -r '.manifests | .[] | .annotations | .[]' "${i}/index.json")" + podman tag "$TAG" "$ORIG_TAG" # restores original registry tag + podman rmi "localhost$i:latest" # removes just the one local tag + rm -r "${i}" + done + + echo 'Images loaded:' + podman images + + rm -rf "$CACHE" +else + echo 'No cached Podman images to load, skipping...' +fi diff --git a/overlay/usr/lib/inithooks/firstboot.d/20-odoo-db-secrets b/overlay/usr/lib/inithooks/firstboot.d/20-odoo-db-secrets deleted file mode 100755 index 3a3b039..0000000 --- a/overlay/usr/lib/inithooks/firstboot.d/20-odoo-db-secrets +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -e -# regenerate odoo pgsql password - -. /etc/default/inithooks - -CONF=/etc/odoo/odoo.conf -DB_USER=odoo - -# Create new password -DB_PASS=$(mcookie) - -# Set new password in config file -sed -i "s|db_password =.*|db_password = $DB_PASS|" $CONF - -# Update the pastgres user password -$INITHOOKS_PATH/bin/pgsqlconf.py --user=$DB_USER --pass="$DB_PASS" - -# Since we reset the password, reload Odoo -# Don't use systemd/systemctl right now as lxc/ovz does not -# use systemd -service odoo restart - -# Webserver will error if postgresql is not restarted -service postgresql restart diff --git a/overlay/usr/lib/inithooks/firstboot.d/20gen-pod-secrets b/overlay/usr/lib/inithooks/firstboot.d/20gen-pod-secrets new file mode 100755 index 0000000..e10309b --- /dev/null +++ b/overlay/usr/lib/inithooks/firstboot.d/20gen-pod-secrets @@ -0,0 +1,16 @@ +#!/bin/bash -ex +# generate DB secrets + +. /etc/default/inithooks + +[ -e "$INITHOOKS_CONF" ] && . "$INITHOOKS_CONF" + +SRC="/etc/turnkey-podman/.env.template" +DST="/etc/turnkey-podman/.env" + +DB_NAME="$(mcookie)" +DB_USER="$(mcookie)" +DB_PASS="$(mcookie)" + +export DB_NAME DB_USER DB_PASS +envsubst < "$SRC" > "$DST" diff --git a/overlay/usr/lib/inithooks/firstboot.d/39pod b/overlay/usr/lib/inithooks/firstboot.d/39pod new file mode 100755 index 0000000..20edd90 --- /dev/null +++ b/overlay/usr/lib/inithooks/firstboot.d/39pod @@ -0,0 +1,56 @@ +#!/bin/bash -ex +# initialize pod + +. /etc/default/inithooks +[ -e "$INITHOOKS_CONF" ] && . "$INITHOOKS_CONF" + +echo 'Setting up pod...' + +pod() { + op="$1" + shift + + case "$op" in + run) + set -- --rm "$@" + ;; + create) + set -- --replace --restart always "$@" + ;; + esac + + set -- "$op" --pod app "$@" + podman "$@" +} + +echo 'Creating app pod...' +podman pod create --replace --name app -p 80:80 -p 443:443 -p 127.0.0.1:5432:5432 + +ENVFILE='/etc/turnkey-podman/.env' +. "$ENVFILE" + +# db +echo 'Setting up database...' + +PG_IMAGE='postgres:15-alpine' +PG_VOLUME='data-pg:/var/lib/postgresql/data:rw' + +pod run -d --name db -v "$PG_VOLUME" --env-file "$ENVFILE" "$PG_IMAGE" + +# nginx +echo 'Setting up nginx...' + +NGX_VOLUME="/etc/nginx/conf.d:/etc/nginx/conf.d:ro" +TLS_VOLUME='/etc/ssl/private:/etc/ssl/private:ro' + +pod create --name nginx -v "$NGX_VOLUME" -v "$TLS_VOLUME" nginx:alpine + +echo 'Setting up Odoo...' + +ODOO_VOLUME='data-odoo:/var/lib/odoo:rw' +ODOO_CONFIG='/etc/odoo/odoo.conf:/etc/odoo/odoo.conf:ro' + +pod run -v "$ODOO_VOLUME" --env-file "$ENVFILE" odoo:18 odoo --no-http --stop-after-init --without-demo=all -d "$POSTGRES_DB" -i base +pod create --name odoo -v "$ODOO_VOLUME" -v "$ODOO_CONFIG" --env-file "$ENVFILE" odoo:18 + +podman pod start app diff --git a/overlay/usr/lib/inithooks/firstboot.d/40odoo b/overlay/usr/lib/inithooks/firstboot.d/40odoo index dd8f6d9..4123a80 100755 --- a/overlay/usr/lib/inithooks/firstboot.d/40odoo +++ b/overlay/usr/lib/inithooks/firstboot.d/40odoo @@ -1,13 +1,10 @@ -#!/bin/bash -e -# set Odoo Admin password +#!/bin/bash -e +# set Odoo admin password . /etc/default/inithooks -[ -e $INITHOOKS_CONF ] && . $INITHOOKS_CONF +[ -e "$INITHOOKS_CONF" ] && . "$INITHOOKS_CONF" +[ -e "/etc/turnkey-podman/.env" ] && . "/etc/turnkey-podman/.env" -$INITHOOKS_PATH/bin/odoo.py --pass="$APP_PASS" - -# Since we reset the password, reload Odoo -# Don't use systemd/systemctl right now as lxc/ovz does not -# use systemd -service odoo restart +export POSTGRES_USER POSTGRES_DB +"$INITHOOKS_PATH/bin/odoo.py" --pass="$APP_PASS" diff --git a/overlay/var/cache/podman-images/.keep b/overlay/var/cache/podman-images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/plan/main b/plan/main index db0e703..8d10e73 100644 --- a/plan/main +++ b/plan/main @@ -1,13 +1,7 @@ #include -#include -odoo-16 -xfonts-75dpi -wkhtmltopdf -python3-psycogreen - -adduser -postgresql-client -python3 - -python3-passlib /* Needed to set admin password */ +jq +podman +catatonit +fuse-overlayfs +python3-passlib /* Needed to set admin password */ From cca9734401237beac6a921431acbbc6e7e2a4c30 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 28 Nov 2024 16:37:11 +0100 Subject: [PATCH 2/2] fix 39pod inithook --- overlay/usr/lib/inithooks/firstboot.d/39pod | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/overlay/usr/lib/inithooks/firstboot.d/39pod b/overlay/usr/lib/inithooks/firstboot.d/39pod index 20edd90..77f338f 100755 --- a/overlay/usr/lib/inithooks/firstboot.d/39pod +++ b/overlay/usr/lib/inithooks/firstboot.d/39pod @@ -47,10 +47,14 @@ pod create --name nginx -v "$NGX_VOLUME" -v "$TLS_VOLUME" nginx:alpine echo 'Setting up Odoo...' +mkdir -p "/opt/odoo/addons" + ODOO_VOLUME='data-odoo:/var/lib/odoo:rw' +ODOO_ADDONS='/opt/odoo/addons:/mnt/extra-addons:ro' ODOO_CONFIG='/etc/odoo/odoo.conf:/etc/odoo/odoo.conf:ro' pod run -v "$ODOO_VOLUME" --env-file "$ENVFILE" odoo:18 odoo --no-http --stop-after-init --without-demo=all -d "$POSTGRES_DB" -i base -pod create --name odoo -v "$ODOO_VOLUME" -v "$ODOO_CONFIG" --env-file "$ENVFILE" odoo:18 +pod create --name odoo -v "$ODOO_VOLUME" -v "$ODOO_ADDONS" -v "$ODOO_CONFIG" --env-file "$ENVFILE" odoo:18 +pod create --name db -v "$PG_VOLUME" --env-file "$ENVFILE" "$PG_IMAGE" podman pod start app