Can't run custom action with Docker - Rasa Open Source - Rasa Community Forum
Can’t run custom action with Docker
post by vivitare on Nov 15, 2019
Hey i’m trying to create a chatbot with RASA in Docker but i can’t use custom action, the bot don’t respond.
I’m running the action server in a Docker container with docker-compose. This is the docker-compose.yml file :
version: '3.0'
services:
action_server:
image: rasa/rasa-sdk:latest
volumes:
- ./actions:/app/actions
And this is my endpoints.yml file :
action_endpoint:
url: "http://action_server:5055/webhook"
To interact with the chatbot, I execute rasa/rasa:latest image Docker with this command :
docker run -it --network="chatbot_rasa_default" -v $(pwd):/app rasa/rasa interactive
But at the moment where the bot should execute the custom action, he said nothing (it’s the same thing when i use rasa shell -vv cmd):
? Your input -> hey
? Your NLU model classified 'hey' with intent 'greet' and there are no entities, is this correct? Yes
------
Chat History
# Bot You
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
1 action_listen
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
2 hey
intent: greet 0.80
------
? The bot wants to run 'action_hello_world', correct? Yes
------
Chat History
# Bot You
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
1 action_listen
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
2 hey
intent: greet 0.80
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
3 action_hello_world 1.00
------
? The bot wants to run 'action_listen', correct? (Y/n)
The bot should respond “Hello World !” because it is written in action/action.py file :
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHelloWorld(Action):
def name(self):
return "action_hello_world"
def run(self, dispatcher, tracker, domain):
print("Hello")
print("this is tracker",tracker)
dispatcher.utter_message("Hello World!")
return []
But I noticed that the action server logs returned nothing :
[root@vm]# docker-compose up
Creating network "chatbot_rasa_default" with the default driver
Creating chatbot_rasa_action_server_1 ... done
Attaching to chatbot_rasa_action_server_1
action_server_1 | 2019-11-15 10:19:17 INFO rasa_sdk.endpoint - Starting action endpoint server...
action_server_1 | 2019-11-15 10:19:17 INFO rasa_sdk.executor - Registered function for 'action_hello_world'.
action_server_1 | 2019-11-15 10:19:17 INFO rasa_sdk.endpoint - Action endpoint is up and running on http ('0.0.0.0', 5055)
Why the bot didn’t respond “hello world !”? I missed a step?
post by fuih on Nov 17, 2019
Hello @vivitare,
Are you running the Rasa server and the action server separately, not in the same Docker network ? I don’t see the Rasa server service in your docker-compose.yml
post by vivitare on Nov 18, 2019
Thks @fuih
Nope, they can communicate with each other because I run rasa with this command :
docker run -it --network="chatbot_rasa_default" -v $(pwd):/app rasa/rasa:latest shell -vv
When he can’t communicate with the action server, a message appears that they can’t communicate with each other.
post by imLew on Nov 25, 2019
Are you running it in two separate docker containers or the way it is described in Running Rasa with Docker? If they are separate I think you might need to open the port for the action server.
post by vivitare on Dec 6, 2019
they don’t need open port because they are in the same network, they can ping between them.
post by bubjanes on Apr 24, 2020
Hola @vivitare!
Shooting from the hip here a little, but I think I had the same problem. Try making the docker --network in your docker container the same as the action_endpoint in endpoints.yml.
So the final command would look something like this:
docker run -it --network="action_server" -v $(pwd):/app rasa/rasa:latest shell -vv
Hope that helps!
post by Pisou on Oct 20, 2022
@vivitare I had the same problem. You were able to solve it ?