Action Server Docker-Compose Connection refused

@threxx in actions.py file :stuck_out_tongue:

Share some code with me where you mentioned the path.

Tip:

as you are copying the data to.

volumes:
        - ./actions:/app/actions
        - ./data:/app/data

So now your path will be "./app/data/"

For Demo use only:


class GetAnswer(Action):
    def __init__(self):
        self.faq = pd.read_csv("./data/faq.csv")
        qs = list(self.faq["question"])
        with open("./data/nlu/faq.yml", "wt", encoding="utf-8") as f:
            f.write('version: "2.0"\n')
            f.write("nlu: \n- intent: faq\n  examples: | \n")
            for q in qs:
                f.write(f"    - {q}\n")

this I mentioned the path as relative, and it’s inside my container.

Got it?

@threxx yes now, you dockerfile and docker-compose make more sense to me :slight_smile: great work, hope the docker post helped you.

Yes yes yes, you not did do it? :upside_down_face: Just copy everything to docker container, how it will run, you need to clone just like your local machine.

The path will work only if it sees the data

Question

@threxx do you have any database?

@nik202 no, no database. Just the folder data, with the files mentioned above. This is so strange, I really don’t know why I cannot access the actions / why they are not found. When building the docker-compose there are no errors, same when it start, it indicates that the action server is running.

@threxx you need to inspect the container, did you see my thread above, I have mentioned how to inspect the container. If you mount the volume and all the data is shown there, then it is perfect, if not then it’s an issue.

docker exec -u root -t -i actions_server /bin/bash

see all the local machine data are exist in the container or not.

@nik202 Ah I might have missed that, I will try this now!

This code is using API and this is my concern or still I am missing something.

@threxx go ahead, me still here.

@nik202 okay just tried this and both folders data and actions are completely empty :frowning:

And yes, I am calling an API but with a URL (https://something/something)

:stuck_out_tongue: so just copy it, mount the volume?

@threxx did you provide the API key or is the data have everything?

Genric thumb rule, copy everything in a container and enjoy a cup of coffee /tea :slight_smile: later.

@threxx do you have any requirements.txt for actions?

@nik202

(maybe a really stupid question) but should I copy everything manually or edit the script? Because if I do it manually I need to do it everytime I rebuild the docker-compose right? So I would rather have it in the script, but then my question is again where I need to add it. (I am really a noob with docker, you might have figured)

The API seems to have everything. It’s a private API with a token authentication, this should work I guess. No requirements.txt for actions

@threxx you are now an expert ok, so relax (docker is just this only) . If you have a docker desktop, delete all images and containers and run it again. I have again seen your code is fine, and me thinking about what can be the issue.

No never not

you doing just fine ok.

It’s already working in the local host as you said, do we have any code for API call?

@threxx

Add this please:


FROM rasa/rasa-sdk:3.0.2

WORKDIR /app

USER root

COPY ./actions /app/actions
COPY ./data /app/data


CMD ["start", "--actions", "actions"]

@nik202 okay I deleted everything, and rebuild the docker-compose, checked the actions sever again, but still, everything is empty.

I will try this now

@threxx just inspect that you get all the data as same as local host or not and you win!!

@nik202 I adjusted the action Dockerfile and now when building the docker-compose I get the following error:

 => ERROR [abc_en_action_server 3/4] COPY ./actions /app/actions                                                                                                                                  0.0s
 => ERROR [abc_en_action_server 4/4] COPY ./data /app/data                                                                                                                                        0.0s
------
 > [abc_en_action_server 3/4] COPY ./actions /app/actions:
------
------
 > [abc_en_action_server 4/4] COPY ./data /app/data:
------
failed to solve: rpc error: code = Unknown desc = failed to compute cache key: "/actions" not found: not found

@threxx :frowning: remote procedure call (RPC)? your code is on another computer?

@nik202 No, everything is on my machine. This is so weird. I will try cleanup the repository tomorrow and then will try this again. Maybe it’s because of that strange structure. Will keep you posted tomorrow. Thanks for all you help so far.

@threxx Sure, no worries. my response will be delayed as me computing tomorrow, I’ll reply as soon as I saw your message. I believe you will fix this issue. good luck!

@nik202 Thanks for all your help, today in the morning I was able to fix the problem. The directory was not correctly mounted, so I fixed that in the docker-compose file and now everything works fine. Thanks again for all your help and patience! I really learned a lot

@threxx Great, finally!! Please can I request to close this thread as a solution for yourself and for others. Happy learning and good luck with your project.