Files
stateless-container-for-one…/init-odoo.sh
T
1b-agent b2e1d1d3d5 [FIX] odoo20: bind http_interface 0.0.0.0 + http_port rename
Symptom: fresh Odoo 20 deploy serves 127.0.0.1:8069 only; Traefik and the
swarm VIP get connection refused -> HTTP 502 through the preview domain.

Root cause (odoo/tools/config.py):
  - line 289: --http-interface my_default='127.0.0.1'
  - lines 768-770: empty http_interface is force-reset to 127.0.0.1
  - the legacy xmlrpc_port key no longer exists (renamed http_port), so
    the old conf line was silently ignored (port worked only via default)

Fix: generated odoo.conf now sets http_interface = 0.0.0.0 and
http_port = 8069. Verified end-to-end on the onebspace deployment:
internal 8069 binds 0.0.0.0, preview domain returns 200.
2026-11-10 14:30:57 +00:00

76 lines
2.3 KiB
Bash

#!/bin/bash
exec > /tmp/init.log 2>&1
set -x
if command -v apt-get >/dev/null 2>&1; then
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential pkg-config \
libpq-dev libpq5 \
libxml2-dev libxslt1-dev \
libldap2-dev libsasl2-dev \
libjpeg-dev zlib1g-dev \
libcurl4-openssl-dev libssl-dev libffi-dev \
libxml2 libxslt1.1 libldap2 libsasl2-2 \
libjpeg62-turbo zlib1g libcurl4 libssl3 libffi8 \
fonts-noto-cjk node-less \
>>/tmp/init.log 2>&1 || echo "[init] WARN: apt-get install had errors (continuing)"
fi
ODOO_INSTALLED=0
python3 -c "import odoo" 2>/dev/null && ODOO_INSTALLED=1
if [ "$ODOO_INSTALLED" = "0" ]; then
echo "[init] Installing Odoo from /mnt/one-os-dev (first boot — this takes ~5 min)..."
pip install --quiet --no-cache-dir --break-system-packages --upgrade pip wheel
pip install --quiet --no-cache-dir --break-system-packages psycopg2-binary
pip install --quiet --no-cache-dir --break-system-packages /mnt/one-os-dev
if [ -s /mnt/one-os-dev/requirements.txt ]; then
pip install --quiet --no-cache-dir --break-system-packages \
-r /mnt/one-os-dev/requirements.txt
fi
echo "[init] Odoo install complete."
else
echo "[init] Odoo already installed; skipping pip install."
fi
mkdir -p /etc/odoo /var/lib/odoo /var/log/odoo
cat > /etc/odoo/odoo.conf <<EOF
[options]
admin_passwd = ${ADMIN_PASSWD:-admin}
db_host = ${HOST}
db_port = ${PORT:-5432}
db_user = ${USER:-odoo}
db_password = ${PASSWORD}
dbfilter = .*
list_db = True
addons_path = /mnt/one-os-dev/addons,/mnt/one-os-dev/odoo/addons
data_dir = /var/lib/odoo
dev_mode = reload,qweb,assets,xml,werkzeug
http_interface = 0.0.0.0
http_port = 8069
workers = 0
log_level = info
EOF
echo "[init] Waiting for postgres at ${HOST}:${PORT}..."
for i in $(seq 1 30); do
python3 -c "
import socket, sys
s = socket.socket()
s.settimeout(2)
try:
s.connect(('${HOST}', int('${PORT:-5432}')))
sys.exit(0)
except Exception:
sys.exit(1)
" && break || sleep 2
done
echo "[init] Starting Odoo with --dev=reload (live edits auto-apply)..."
exec odoo -c /etc/odoo/odoo.conf \
--dev=reload,qweb,assets,xml,werkzeug \
--db-filter='.*' \
--limit-time-real=120 \
--log-level=info