I have created a rasa chatbot which uses “botfront” and runs on both rasa and action server. I want to containerize all my rasa code and generate a link that i can put in socketUrl of botfront so that I can send index.html file to anyone and the test user will be able to interact with my bot. How can I achieve this? is there some tutorial that would help me?
@mangesh You saying, you want to share the docker container, using Index.html huh? Do you known ngrok ?
Yes, I once used ngrok for deploying chatbot to telegram. I only know that much
@mangesh Firstly, the approach you targeting is not feasible (but can be also), But, this can be done, you can run your rasa + GUI using docker, and whilst using ngrok you can generate the link and share. Only, one drawback, the link will be able to work till your system is open.
Actually, I was saying can I create and host docker container having my rasa code so that anytime if anyone just opens index.html, the chatbot will work.
@mangesh Containers and there images are on docker hub so they will be live.
Okay, and if I have created my rasa application already without docker, do I need to create that project again from scratch using docker?
Oh, I guess I need to learn more about it
@mangesh Yeps, and to deal with Rasa-webchat GUI is not easy task it is developed on React JS and node.js, as experts like me on React and Node not trying to take a nightmare
Please find the steps as per our discussion:
For Wordpress:
- For creating a docker image for Wordpress site for deployment purpose only; running on localhost 8000 Quick Wordpress Setup With Docker - YouTube
- Deploying rasa on Wordpress site please follow this link DEPLOY RASA CHATBOT TO WORDPRESS WEBSITE | WORDPRESS | INNOVATE YOURSELF - YouTube
For Docker Environment:
-
Create the Dockerhub ID from https://hub.docker.com
-
Create a Docker image for action server by the name Dockerfile (blue logo), if you have any requirements, please make a requirement.txt file in the same folder with all the packages in it.
Snippet code:
FROM rasa/rasa-sdk:2.7.0
WORKDIR /app
COPY requirement.txt requirement.txt
USER root
RUN pip install -r requirement.txt
EXPOSE 5055
USER 1001
Note: If you did not require the requirement.txt file at the moment please commented
- Dockerfile for Rasa; create outside the actions folder where other related files by the name Dockerfile (blue logo)
Snippet code:
FROM rasa/rasa:2.7.1
WORKDIR '/app'
COPY . /app
USER root
RUN rasa train
VOLUME /app/models
CMD [ "run","-m","/app/models","--enable-api","--cors","*","--debug" ,"--endpoints", "endpoints.yml", "--log-file", "out.log", "--debug"]
EXPOSE 5005
- Create the docker-compose.yml file same as you created the above file outside the actions folder by the name docker-compose.yml (pink logo)
Snippet code:
version: '3'
services:
rasa:
container_name: "rasa_server"
user: root
build:
context: .
volumes:
- "./:/app"
ports:
- "5005:5005"
action_server:
container_name: "action_server"
build:
context: actions
volumes:
- ./actions:/app/actions
- ./data:/app/data
ports:
- 5055:5055
Note: Update in endpoints.yml
action_endpoint:
url: 'http://action_server:5055/webhook'
RUN the docker compose
-
docker-compose up --build
or after the build docker-compose up -d please see all the docker related commands. -
To check the container running or not
docker ps
ordocker ps -a
ordocker-compose ps
etc -
Copy a container from docker to localhost; run the command from terminal (should be in project folder)
docker cp <container ID or name>:"/app" "."
- Inspect the rasa server or action server as per need to see the content
docker exec -u root -t -i actions_server /bin/bash
Note: You will be able to run and execute all this whist if you are working on Window, Mac Or Ubuntu. If you have any issue whilst using this solution please mention me
This is my first ever so long post for any suggestion or solution with such a detail information. I hope it will solve your issue. Good Luck! Bro! Have fun
@nik202 Thank you for taking efforts. I appreciate it much. If you can just take one final doubt, I’ll close this topic by locking the solution. My purpose is to create a docker image having my project (along with action-server) and deploy it to AWS EC2 (sorry, I didn’t tell you this earlier ). Before, you sent me the steps, I was going through this article by rasa → Building a Rasa Assistant in Docker . This doesn’t create a Dockerfile and dockor-compose.yml file which confuses me a lot. Can you help me understand if that article is right for me (I’m asking this because that article is very simple and pretty straightforward, so for a beginner like me, it would be very easy to utilize it.)?
@mangesh Hey! No worries, I already told you as you are using Ubuntu and the tutorial/link you shared using sets of commands, which similar as you told me the youtube video, so you need to remember these sets of commands. On the other hand the solution I suggested, it will automatically run with minimal set of command. The process is same, I told you this in advance. We can talk again later. For, AWS EC2 means they are providing you server nice. It is not related to this post.
@mangesh Check the docker file I suggested and tutorial you will get the comparison.
For example:
$(pwd) → .
/app → /app
rasa/rasa:2.8.0-full → rasa/rasa:latest-full
rasa init → init #in our case we have bot
rasa train → RUN rasa train -c ./config.yml -d ./domain.yml --data ./data --debug
We have eliminate this step
docker network create my-project
. as shown in the link
it will automatically connect with rasa server
I hope you got it
All clear!
@mangesh Note: Keep that in mind the example showing is using 2.8.0 and now both Rasa and Rasa-sdk are 2.8.1, since morning trouble shooting one issue. So, try not use latest-full.
@nik202 Hey Now, I have much much more clarity. Thanks man, your step by step solution is a big help for me.
@mangesh Are you able to run on Ubuntu now?
@mangesh Updated some code, do try it please and we will see tomorrow, have a great day.
@nik202 I’m able to now run the project properly with one docker command. Thank you very much!
@mangesh great!
@mangesh I am also trying to do the same thing…Could you please help me out
pinging @mangesh can you help him out for the same please.Many thanks in advance.
Sure nik! @CAkhil can you describe how should I help you?
@CAkhil do you want me to repost a final and working template to dockerize rasa chatbot?