Rasa Docker:无法连接到操作服务器,但它是 运行

Rasa Docker: Couldn't connect to the action server but it is running

我有一个完全在本地 运行 的 rasa 应用程序。之后,我使用 docker 构建并 运行 应用服务器和活动服务器。 rasa 核心服务器工作正常,直到将操作端点调用到 运行。行动。 我还在 endpoint.yml (http://127.0.0.1:5055/webhook) 中设置了动作端点 url 这是来自 rasa 核心服务器的日志:

2021-03-04 12:59:18 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'action_form_search'.

2021-03-04 12:59:18 ERROR rasa.core.actions.action - Failed to run custom action 'action_form_search'. Couldn't connect to the server at 'http://127.0.0.1:5055/webhook'. Is the server running? Error: Cannot connect to host 127.0.0.1:5055 ssl:default [Connection refused]

2021-03-04 12:59:18 ERROR rasa.core.processor - Encountered an exception while running action 'action_form_search'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

Traceback (most recent call last):

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection

return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa

File "uvloop/loop.pyx", line 1974, in create_connection

File "uvloop/loop.pyx", line 1951, in uvloop.loop.Loop.create_connection

ConnectionRefusedError: [Errno 111] Connection refused


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

File "/opt/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 670, in run

response = await self.action_endpoint.request(

File "/opt/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 146, in request

async with session.request(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__

self._resp = await self._coro

File "/opt/venv/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request

conn = await self._connector.connect(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect

proto = await self._create_connection(req, traces, timeout)

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection

_, proto = await self._create_direct_connection(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection

raise last_exc

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection

transp, proto = await self._wrap_create_connection(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection

raise client_error(req.connection_key, exc) from exc

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 127.0.0.1:5055 ssl:default [Connection refused]

这是来自服务器的日志

2021-03-04 12:58:29 INFO rasa_sdk.endpoint - Starting action endpoint server...

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_set_slot_test_1'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_set_slot_test_2'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_set_slot_test_3'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_response_test_4'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_form_search'.

2021-03-04 12:58:30 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://localhost:5055

Dockerfile(到 运行 rasa 核心服务器)

FROM rasa/rasa:2.3.2

COPY . /app

WORKDIR /app

EXPOSE 5005

COPY startup.sh /app/scripts/startup.sh

USER root
RUN pip install --no-cache rasa==2.3.2
RUN chmod a+x /app/scripts/startup.sh

WORKDIR /app

ENTRYPOINT ["bash"]

CMD ["scripts/startup.sh"]

Dockerfile(到 运行 操作服务器)

FROM python:3.7.5-slim

RUN apt-get update -qq

COPY . /app/actions/
COPY ./startup.sh /app/startup.sh
ADD requirements.txt /app/requirements.txt

WORKDIR /app

EXPOSE 5055

STOPSIGNAL SIGINT

USER root
RUN python -m pip install --upgrade pip
RUN pip install -r requirements.txt --no-cache-dir

RUN chmod a+rx ./startup.sh
ENTRYPOINT "./startup.sh"

我哪里错了?请帮助我!

有一个 docker-compose 文件您应该试试。您还应该确认操作服务器端口已公开并可通过 curl:

curl --request POST 'http://localhost:5055/webhook'