Odoo Bus.bus 不可用

Odoo Bus.bus unavailable

在 docker 本地 运行 odoo v14 时,我经常收到以下错误消息:

odoo-14.0-stage    | 2021-04-26 10:51:00,476 10 ERROR update odoo.http: Exception during JSON request handling. 
odoo-14.0-stage    | Traceback (most recent call last):
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
odoo-14.0-stage    |     result = request.dispatch()
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 683, in dispatch
odoo-14.0-stage    |     result = self._call_function(**self.params)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 359, in _call_function
odoo-14.0-stage    |     return checked_call(self.db, *args, **kwargs)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/service/model.py", line 94, in wrapper
odoo-14.0-stage    |     return f(dbname, *args, **kwargs)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 347, in checked_call
odoo-14.0-stage    |     result = self.endpoint(*a, **kw)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 912, in __call__
odoo-14.0-stage    |     return self.method(*args, **kw)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 531, in response_wrap
odoo-14.0-stage    |     response = f(*args, **kw)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/addons/bus/controllers/main.py", line 35, in poll
odoo-14.0-stage    |     raise Exception("bus.Bus unavailable")
odoo-14.0-stage    | Exception
odoo-14.0-stage    | 
odoo-14.0-stage    | The above exception was the direct cause of the following exception:
odoo-14.0-stage    | 
odoo-14.0-stage    | Traceback (most recent call last):
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 639, in _handle_exception
odoo-14.0-stage    |     return super(JsonRequest, self)._handle_exception(exception)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 315, in _handle_exception
odoo-14.0-stage    |     raise exception.with_traceback(None) from new_cause
odoo-14.0-stage    | Exception: bus.Bus unavailable

我的 odoo.conf 文件:

[options]

# Service Settings
addons_path = /home/odoo/addons/odoo/addons,/home/odoo/addons/extra,/home/odoo/custom/custom_addons,/home/odoo/custom/edited_addons,/home/odoo/custom/paysy_addons
data_dir = /var/lib/odoo

# Database
db_host = postgres-12.2
db_user = odoo_13_0_stage
db_password = password

# Tuning Options
workers = 2
max_cron_threads = 1
limit_time_cpu = 600
limit_time_real = 1200
osv_memory_age_limit = 1.0
osv_memory_count_limit = False

# Network / Ports
xmlrpc_port = 8069
netrpc_port = 8070
xmlrpcs_port = 8071
longpolling_port = 8072
proxy_mode = True

我认为这与长轮询有关,但不确定。如您所见,我已经将 proxy_mode 设置为 true,配置了长轮询端口并设置了 2 个 worker。我还尝试按照其他地方的建议配置零个或两个以上的工作人员。

希望有人能提供帮助。

PS: 按照我的 docker-compose 文件:

version: "3.9"
services:

    odoo-14.0-stage:
        container_name: odoo-14.0-stage
        image: odoo-14.0:stage
        build: ./volumes/
        ports:
            - 13001:8069/tcp
            - 8070:8070
            - 8071:8071
            - 8072:8072
        depends_on:
            - postgres-12.2
        volumes:
            - ./config:/etc/odoo:ro
            - ./volumes:/home/odoo/addons
            - ./addons:/home/odoo/custom
            - ./data:/var/lib/odoo
        restart: always

    postgres-12.2:
        container_name: postgres-12.2
        image: postgres:12.2
        build: ./postgres/12.2/
        volumes:
            - ./postgres/12.2/volumes/data:/var/lib/postgresql/data:delegated
        restart: always

这些日志是 Odoo 告诉您需要正确配置代理的神秘方式。

Odoo正常操作都是通过主(也叫HTTP)端口来完成的,默认是8069。但是长轮询请求有点不同:

  • 在线程模式下(workers = 0,最适合开发),它们通过相同的 8069 端口。
  • 在多进程模式下(workers = 2 或更多,最适合生产),他们使用默认侦听端口 8072 的特定进程。

您的浏览器对 Odoo 的配置方式一无所知。它只是通过同一个端口发出所有请求,无论它是什么(提示:HTTP 默认使用 80,而 HTTPS 使用 443)。

这就是为什么,如果您在多进程模式下使用 Odoo,Web 浏览器和 Odoo 之间必须有一个反向代理,根据路径将请求定向到正确的端口。

Odoo 文档提供了一个 nginx 配置示例和更多详细信息。查看它们:https://www.odoo.com/documentation/14.0/administration/install/deploy.html#id7