Can't get custom actions with rasa-x on docker

I use rasa-x installed with docker on an aws server. I my actions.py file ready, my docker-compose.yml file prepared as in the “run rasa with docker” tutorial, and my endpoints set-up. When using only rasa installed without docker I managed to use Custom Actions easily, but with docker it seems that it does not connect to the action server : “Cannot connect to host action_server:5055 ssl:None [Name or service not known]” as an error. I have tried many things (change endpoints and docker-compose file mainly) but I did not success, and that is problem to use my model with rasa-x.

I will appreciate any kind of help, and can provide any information to solve my problem.

Thanks

Hi @billbokay, welcome to the forum! Please check out the instructions on how to use custom action servers here: Deploy to a Server (point 3). You will essentially have to replace your app entry in your docker-compose.yml with

app:
    image: rasa/rasa-sdk:latest
    volumes:
      - ./actions:/app/actions

Or better: create a docker-compose.override.yaml.

This will start the action server at http://app:5005, meaning you need the following entry in your endpoints.yml:

action_endpoint:
  url: http://app:5055/webhook

I hope that helps!

Hi @ricwo , thank you very much for your help !

Following your advice I added the line under “volumes” in my docker-compose.yml (and I understood why it is better to create a docker-compose.override.yml, will do it later).

It seems to have improved situation : now when I run docker-compose up it register my custom actions and print “Action endpoint is up and running. on (‘0.0.0.0’, 5055)”, so far so good.

But two things seem to still break :

  • first I have when I run the docker-compose up the error " No model found. Train a model before running the server using rasa train." followed by “docker_rasa3_rasa_1 exited with code 0” ; however I have already trained several models, using the command “docker run -v $(pwd):/app rasa/rasa:latest-full train --domain domain.yml --data data --config config/config.yml --out models --fixed-model-name my_model” What am I missing here ?

  • then I still have the previous error when talking to the chatbot : “Is the server running? Error: Cannot connect to host rasa:5055 ssl:None [Name or service not known]” I don’t know if this is linked to the previous problem, or to the endpoints.yml.

I also have a very basic question, the plan is to run docker-compose up in a terminal tab, and to run rasa shell in another terminal, then I should have my custom actions working, right ?

Thanks again for your help

What does your endpoints.yml look like? What exactly does the section you added to your docker-compose.yml look like?

As for training, it sounds like from your initial question that you’re running a rasa X setup, not just rasa. It would be easiest to visit the UI and train your model there once your containers are up.

docker-compose_forum endpoints_forum

Here are my endpoints and docker-compose.

I understand, but (perhaps am I not enough used to the UI) but I found it less flexible and less precise. And I thought it was a good first step to have my custom actions work first in the terminal before anything else. And the error “No model found etc” will still be a concern I think ?

In fact I use more Rasa-x as a front end for other users to test my bot.

Thanks again for your help !

Hi @billbokay, from looking at your endpoint configuration, it seems that rasa is looking for an action endpoint at http://rasa:5055 which is not the location of your action server. Please change it to

action_endpoint:
  url: http://action_server:5055/webhook

Let me know if that works!

Hi @ricwo, thank you for your suggestion ! It does not work much. In fact before editing this post I tried several things to replace the “rasa” in the URL : “action_server” as it is in the “running rasa with Docker” tutorial, the IP of the server, and this “rasa” for no real reason (that I forgot to change before replying).

In fact I can now no more run the “rasa run actions” command, I get the error “No model found. Train a model before running the server using rasa train.” from this command too (which was not the case before, I do not know what changed to get this)…

Whatever the end I appreciate your help and hope you don’t lose to much time on me !

Hi @billbokay, I just had another look at your docker-compose file and it looks like you’re not exposing port 5055. Please add

ports:
    - "5055:5055"

to the service.

In fact I can now no more run the “rasa run actions” command

Where are you running this command? It’s not necessary if you run your actions server as a separate service.

Alright thank you, I added port 5055, but it did not seem to have changed anything yet.

I run this docker run -it -v $(pwd):/app rasa/rasa run actions in a terminal tab, in the folder of my docker-compose.yml.

Any idea ?

Hi @billbokay, I’m a little confused as to why you’re running that docker command. Your app service runs python -m rasa_sdk --actions automatically, so there really shouldn’t be a need for you to run that command manually. Your app service is the action server, so please just start that as it is, and likewise your rasa service can just be started with docker-compose up as well (no need for a docker run -it command). I hope that helps!

Hi, here the output of my docker-compose up :

Which seems to be another error I agree.

But I ran the docker run command in order to test my bot without launching the docker-compose up. And the fact that it does not work and that I get this error is a bit confusing for me !

Hi @billbokay, can you share the exact docker-compose.yml that led to the error you posted? would you mind updating to the latest Rasa version? Does the problem still happen?

Hello @ricwo I did as in your example changed action_server:5055 to myip:5055 in endpoints.yml file it works good in rasa shell mode but when I upload this code to github then connect to rasa x custom actions don’t work.

Hey @MMustafa, can you say a little more about this? How did you deploy Rasa X?

I used docker to deploy rasa x.I did everything as in this tutorial The Rasa Masterclass Handbook: Episode 9. Bot works properly in rasa shell but when I use rasa x ui it does’t reply with custom actions.For example when I write recommend film of genre comedy it just shows that next actions is “action_film” but does not show answer in my case it is links to film web sites

My endpoints.yml file: action_endpoint: url: “http://lmy_server_ip:5055/webhook”

docker-compose.override.yml file: version: ‘3.4’ services: app: image: ‘rasa/rasa-sdk:latest’ volumes: - ‘./actions:/app/actions’ expose: - ‘5055’ depends_on: - rasa-production

Would you mind posting the logs of your custom action server (sudo docker-compose logs rasa-app_1)?

Thanks for response @ricwo! I have error as in pictures below.Sorry i just did screens)

My rasa-x version==0.28.3 and rasa==1.10.0

Thanks! IT would be useful to see the action server logs specifically (rasa-app_1) - you can get those by running sudo docker-compose logs rasa-app_1