Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Update longpolling route for Odoo 16.0 #407

Merged
merged 4 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed. Development is done in threaded mode, so only 1 port is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that most users won't ever need it, but if for some reason someone tries to run devel.yaml with --workers > 1 (maybe they need to debug something in pre-fork mode), then it won't work.

Still, if you are sure, I will revert it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, then don't restrict this to only v16+. Older versions also used that port, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, fixed it.

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