WIP: [FIX] longpolling is replace by websocket since 16.0 version of odoo in reverse proxy #30

Open
njeudy wants to merge 2 commits from odoo_fix_webhook_url into master
  1. 15
      odoo-tecnativa/lib/common
  2. 14
      odoo-tecnativa/metadata.yml

15
odoo-tecnativa/lib/common

@ -9,3 +9,18 @@ get_odoo_uid() {
info "openerp uid from ${DARKYELLOW}$SERVICE_NAME${NORMAL} is '$odoo_uid'"
echo "$odoo_uid"
}
get_odoo_version() {
local odoo_version
odoo_version=$(cached_cmd_on_base_image "$SERVICE_NAME" \
"python -c 'import odoo; print(odoo.cli.server.__version__)'"
) || {
debug "Failed to query for odoo version in ${DARKYELLOW}$SERVICE_NAME${NORMAL} base image."
return 1
}
info "odoo version from ${DARKYELLOW}$SERVICE_NAME${NORMAL} is '$odoo_version'"
echo "${odoo_version%%.*}"
}
export -f get_odoo_version

14
odoo-tecnativa/metadata.yml

@ -14,7 +14,7 @@ docker-compose:
tty: true
environment:
INITIAL_LANG: fr_FR
LIST_DB: 'true'
LIST_DB: "true"
default-options:
workers: 1
@ -63,9 +63,16 @@ uses:
- !bash-stdout |
workers=$(relation-base-compose-get workers 2>/dev/null)
workers=${workers:-1}
version=$(cached_cmd_on_base_image "$MASTER_BASE_SERVICE_NAME" \
"python -c 'import odoo; print(odoo.cli.server.__version__)'") || exit 1
if [ "$workers" -gt 1 ]; then
echo "ProxyPass /longpolling/ http://${MASTER_BASE_SERVICE_NAME}:8072/longpolling/"
echo "ProxyPassReverse /longpolling/ http://${MASTER_BASE_SERVICE_NAME}:8072/longpolling/"
if [ "${version%.*}" -lt 15 ]; then
echo "ProxyPass /longpolling/ http://${MASTER_BASE_SERVICE_NAME}:8072/longpolling/"
echo "ProxyPassReverse /longpolling/ http://${MASTER_BASE_SERVICE_NAME}:8072/longpolling/"
else
echo "ProxyPass /websocket ws://${MASTER_BASE_SERVICE_NAME}:8072/websocket"
echo "ProxyPassReverse /websocket ws://${MASTER_BASE_SERVICE_NAME}:8072/websocket"
fi
fi
backup:
constraint: recommended
@ -81,7 +88,6 @@ uses:
## - must start with a '/', will start from $SERVICE_DATASTORE
exclude-patterns:
- "/var/lib/odoo/sessions/"
# network-isolation:
# whitelist: ## required external services used by this service
# - www.google.com

Loading…
Cancel
Save