Hi all, I’m new to Rasa and Docker. I have created a bot that asks user information and it stores in the database and also it fetches details from the database. I’m using postgresql for database. I want to deploy my rasa project in docker. Could anyone explain more in detail how to do that. thanks in advance. @jonathanpwheat
@Shan Are you using window, mac or Ubuntu.
@Shan Do you have any prior docker experience?
@Shan Install docker desktop, create the rasa project in VS code. Check the rasa docker image.
@nik202 I don’t have. Anyway I try that and get back to you.
@Shan I will encourage please do some basic, beginner course or tutorial on docker, at least to know what are the process and commands and syntax used and for what process, else it will be very complex for you. This is only my suggestion, take it or leave it. Good Luck!
COPY . /chatbot
RUN pip install -r requirements.txt
COPY ./actions /app/actions
this is my dockerfile is this correct? and I have a doubt what are libraries I should add in requirements.txt file.
@Shan No, you need to create the docker-compose file for the rasa. @Shan If you are using action.py for custom action and you using some outside libraries then you need to add that in requirenments.txt else you will see the error in logs you can add that. @Shan check this thread for your reference only Error starting action server on Docker - #5 by BELIEVEIT @Shan If further issue do let us know.
@nik202 how can I contact you privately.
@nik202 okay.do let me know when you are free
Hi @nik202. Could you explain more step by step instructions. Should I create a docker image before docker-compose?
what I understood for deployment from blogs and docker videos and tried like this.
First step: I have to create a docker image contains project source and requirements.
FROM rasa/rasa COPY . /chatbot WORKDIR /chatbot RUN pip install -r requirements.txt USER root COPY ./actions /app/actions USER 1001
pyaml flask requests spacy rasa-nlu rasa-core rasa-core-sdk
Second step: Create Docker-compose.yml
version: "3.0" services: rasa: image: rasa/rasa:2.6.3-full ports: - 5005:5005 volumes: - ./:/app command: - run - -m - models - --enable-api - --cors - "*" - --debug action_server: image: rasa/rasa_core_sdk:latest ports: - 5055:5055 volumes: - ./actions:/app/actions command: - rasa - run - actions
could you tell me right flow for deployment.
this is my new Dockerfile
COPY . /Bot
COPY ./actions /app/actions
CMD [“init” ]
I ran this command “docker build --tag bot .” it creates an image and I opened image in docker desktop and ran but it shows this error.
UserWarning: The model at ‘models’ could not be loaded. Error: <class ‘rasa.nlu.model.UnsupportedModelError’>: The model version is trained using Rasa Open Source 2.6.3 and is not compatible with your current installation (2.8.0). This means that you either need to retrain your model or revert back to the Rasa version that trained the model to ensure that the versions match up again.
I tried with docker-compose.yml and ran this command " docker-compose up"
- action-server action-server:
but it shows this error
rasa-server | /opt/venv/lib/python3.8/site-packages/rasa/shared/utils/io.py:97: UserWarning: The model at 'models' could not be loaded. Error: <class 'rasa.nlu.model.UnsupportedModelError'>: The model version is trained using Rasa Open Source 2.6.3 and is not compatible with your current installation (2.8.0). This means that you either need to retrain your model or revert back to the Rasa version that trained the model to ensure that the versions match up again.
rasa-server | /opt/venv/lib/python3.8/site-packages/rasa/shared/utils/io.py:97: UserWarning: Agent could not be loaded with the provided configuration. Load default agent without any model.
rasa-action-server | import psycopg2
rasa-action-server | ModuleNotFoundError: No module named 'psycopg2'
@Shan check Dockerfiles for rasa and rasa-sdk, how in that we have train the model, used requirement.txt ok you doing in right direction.
- you previous model is trained based on rasa 2.6.3 and your image is latest, rather train the model. with latest or change the image to 2.6.3 from latest ok?
- in action.py you used psycopg rather delete this import or add psycopg2 in requirement file.
I hope it make sense now.
I updated my rasa version to latest and then I ran the command docker build --tag bot . and I ran rasa shell it works but not able to connect action server.
I’m no Docker pro, and interestingly don’t use it at all now, but I did write up a pretty super basic tutorial over a year ago about getting rasa setup with Docker. You can take a look here - Using Docker with Rasa for development - DEV Community
Probably doesn’t follow best practices and versions may be old, but there might be a tid-bit in there that may help figure out why you can’t talk to the action sever.
@Shan change the action-server or whatever you had mentioned in docker file in endpoint.yml from localhost → action-server. Build and try.