From 107281041c507b0e2bee4e5c94c556601d30fbd7 Mon Sep 17 00:00:00 2001 From: Pablo Esteban Date: Thu, 5 Oct 2023 09:20:31 +0200 Subject: [PATCH 1/4] [FIX] Update longpolling route for Odoo 16.0 --- _traefik1_labels.yml.jinja | 5 +++-- _traefik2_labels.yml.jinja | 3 ++- devel.yaml.jinja | 7 +++++++ prod.yaml.jinja | 2 +- test.yaml.jinja | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/_traefik1_labels.yml.jinja b/_traefik1_labels.yml.jinja index fff2019d..c3036666 100644 --- a/_traefik1_labels.yml.jinja +++ b/_traefik1_labels.yml.jinja @@ -43,7 +43,7 @@ {%- endif %} {%- endmacro %} -{%- macro odoo(domain_groups_list, paths_without_crawlers) %} +{%- macro odoo(domain_groups_list, paths_without_crawlers, odoo_version) %} traefik.domain: {{ macros.first_main_domain(domain_groups_list)|tojson }} {%- call(domain_group) macros.domains_loop_grouped(domain_groups_list) %} @@ -87,11 +87,12 @@ }} {%- endif %} {%- if not domain_group.path_prefixes %} + {%- set longpolling_route = "/longpoling/" if odoo_version < 16 else "/websocket" -%} {{- router( prefix="longpolling", index0=domain_group.loop.index0, - rule=domains_rule(domain_group.hosts, ["/longpolling/"]), + rule=domains_rule(domain_group.hosts, [longpolling_route]), entrypoints=domain_group.entrypoints, port=8072, ) diff --git a/_traefik2_labels.yml.jinja b/_traefik2_labels.yml.jinja index ee9774ec..325d55d3 100644 --- a/_traefik2_labels.yml.jinja +++ b/_traefik2_labels.yml.jinja @@ -154,12 +154,13 @@ {#- Longpolling router #} {%- if not domain_group.path_prefixes %} + {%- set longpolling_route = "/longpoling/" if odoo_version < 16 else "/websocket" -%} {{- router( domain_group=domain_group, key=key, suffix="longpolling", - rule="%s && PathPrefix(`/longpolling/`)" % domains_rule(domain_group), + rule="%s && PathPrefix(`%s`)" % (domains_rule(domain_group), longpolling_route), service="longpolling", middlewares=_ns.basic_middlewares, ) diff --git a/devel.yaml.jinja b/devel.yaml.jinja index 9f6428fc..50b2f94a 100644 --- a/devel.yaml.jinja +++ b/devel.yaml.jinja @@ -20,8 +20,15 @@ services: ports: - "127.0.0.1:{{ macros.version_major(odoo_version) }}899:6899" - "127.0.0.1:{{ macros.version_major(odoo_version) }}069:8069" + {%- if odoo_version >= 16 %} + - "127.0.0.1:{{ macros.version_major(odoo_version) }}072:8072" + {%- endif %} environment: + {%- if odoo_version < 16 %} PORT: "6899 8069" + {%- else %} + PORT: "6899 8069 8072" + {%- endif %} TARGET: odoo odoo: diff --git a/prod.yaml.jinja b/prod.yaml.jinja index fd1d73bf..10bd461c 100644 --- a/prod.yaml.jinja +++ b/prod.yaml.jinja @@ -37,7 +37,7 @@ services: doodba.domain.main: {{ macros.first_main_domain(domains_prod)|tojson }} {%- if odoo_proxy == "traefik" and domains_prod %} traefik.enable: "true" - {{- traefik1_labels.odoo(domains_prod, paths_without_crawlers) }} + {{- traefik1_labels.odoo(domains_prod, paths_without_crawlers, odoo_version) }} {{- traefik2_labels.common_middlewares(_key, cidr_whitelist) }} {{- traefik2_labels.odoo( domains_prod, diff --git a/test.yaml.jinja b/test.yaml.jinja index a03c840b..3c746f59 100644 --- a/test.yaml.jinja +++ b/test.yaml.jinja @@ -35,7 +35,7 @@ services: doodba.domain.main: {{ macros.first_main_domain(domains_test)|tojson }} {%- if odoo_proxy == "traefik" and domains_test %} traefik.enable: "true" - {{- traefik1_labels.odoo(domains_test, ["/"]) }} + {{- traefik1_labels.odoo(domains_test, ["/"], odoo_version) }} {{- traefik2_labels.odoo( domains_test, cidr_whitelist, From 3fcbbb7ff1f4f1c65109935bba9f8c3caf132344 Mon Sep 17 00:00:00 2001 From: Pablo Esteban Date: Tue, 10 Oct 2023 08:24:45 +0200 Subject: [PATCH 2/4] [FIX] Fix typo longpoling -> longpolling --- _traefik1_labels.yml.jinja | 2 +- _traefik2_labels.yml.jinja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_traefik1_labels.yml.jinja b/_traefik1_labels.yml.jinja index c3036666..f2df7dc2 100644 --- a/_traefik1_labels.yml.jinja +++ b/_traefik1_labels.yml.jinja @@ -87,7 +87,7 @@ }} {%- endif %} {%- if not domain_group.path_prefixes %} - {%- set longpolling_route = "/longpoling/" if odoo_version < 16 else "/websocket" -%} + {%- set longpolling_route = "/longpolling/" if odoo_version < 16 else "/websocket" -%} {{- router( prefix="longpolling", diff --git a/_traefik2_labels.yml.jinja b/_traefik2_labels.yml.jinja index 325d55d3..94621e7e 100644 --- a/_traefik2_labels.yml.jinja +++ b/_traefik2_labels.yml.jinja @@ -154,7 +154,7 @@ {#- Longpolling router #} {%- if not domain_group.path_prefixes %} - {%- set longpolling_route = "/longpoling/" if odoo_version < 16 else "/websocket" -%} + {%- set longpolling_route = "/longpolling/" if odoo_version < 16 else "/websocket" -%} {{- router( domain_group=domain_group, From 29cb514b239bfd1804f8de58604370fcf5c28f72 Mon Sep 17 00:00:00 2001 From: Pablo Esteban Date: Mon, 16 Oct 2023 13:05:53 +0200 Subject: [PATCH 3/4] [FIX] _traefik2_labels.yml.jinja: use Path instead of PathPrefix for odoo >= 16 --- _traefik2_labels.yml.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_traefik2_labels.yml.jinja b/_traefik2_labels.yml.jinja index 94621e7e..bcd6ce0e 100644 --- a/_traefik2_labels.yml.jinja +++ b/_traefik2_labels.yml.jinja @@ -154,13 +154,13 @@ {#- Longpolling router #} {%- if not domain_group.path_prefixes %} - {%- set longpolling_route = "/longpolling/" if odoo_version < 16 else "/websocket" -%} + {%- set longpolling_route = "PathPrefix(`/longpolling/`)" if odoo_version < 16 else "Path(`/websocket`)" -%} {{- router( domain_group=domain_group, key=key, suffix="longpolling", - rule="%s && PathPrefix(`%s`)" % (domains_rule(domain_group), longpolling_route), + rule="%s && %s" % (domains_rule(domain_group), longpolling_route), service="longpolling", middlewares=_ns.basic_middlewares, ) From 21d457d887ceda866c0888f7a459fb36349a238a Mon Sep 17 00:00:00 2001 From: Pablo Esteban Date: Mon, 16 Oct 2023 13:06:37 +0200 Subject: [PATCH 4/4] [FIX] devel.yaml.jinja: remove conditional --- devel.yaml.jinja | 6 ------ 1 file changed, 6 deletions(-) diff --git a/devel.yaml.jinja b/devel.yaml.jinja index 50b2f94a..a7ca099b 100644 --- a/devel.yaml.jinja +++ b/devel.yaml.jinja @@ -20,15 +20,9 @@ services: ports: - "127.0.0.1:{{ macros.version_major(odoo_version) }}899:6899" - "127.0.0.1:{{ macros.version_major(odoo_version) }}069:8069" - {%- if odoo_version >= 16 %} - "127.0.0.1:{{ macros.version_major(odoo_version) }}072:8072" - {%- endif %} environment: - {%- if odoo_version < 16 %} - PORT: "6899 8069" - {%- else %} PORT: "6899 8069 8072" - {%- endif %} TARGET: odoo odoo: