Skip to content

Commit

Permalink
Merge pull request #407 from ForgeFlow/fix-longpolling-16
Browse files Browse the repository at this point in the history
[FIX] Update longpolling route for Odoo 16.0
  • Loading branch information
pedrobaeza authored Oct 23, 2023
2 parents 9d9c2bc + 21d457d commit f16565e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions _traefik1_labels.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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) %}

Expand Down Expand Up @@ -87,11 +87,12 @@
}}
{%- endif %}
{%- if not domain_group.path_prefixes %}
{%- set longpolling_route = "/longpolling/" 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,
)
Expand Down
3 changes: 2 additions & 1 deletion _traefik2_labels.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,13 @@

{#- Longpolling router #}
{%- if not domain_group.path_prefixes %}
{%- set longpolling_route = "PathPrefix(`/longpolling/`)" if odoo_version < 16 else "Path(`/websocket`)" -%}
{{-
router(
domain_group=domain_group,
key=key,
suffix="longpolling",
rule="%s && PathPrefix(`/longpolling/`)" % domains_rule(domain_group),
rule="%s && %s" % (domains_rule(domain_group), longpolling_route),
service="longpolling",
middlewares=_ns.basic_middlewares,
)
Expand Down
3 changes: 2 additions & 1 deletion devel.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +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"
- "127.0.0.1:{{ macros.version_major(odoo_version) }}072:8072"
environment:
PORT: "6899 8069"
PORT: "6899 8069 8072"
TARGET: odoo

odoo:
Expand Down
2 changes: 1 addition & 1 deletion prod.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f16565e

Please sign in to comment.