Issues with Botfront Rasa App while deploying with docker

I am having issues with running a rasa chatbot flask app in docker. I have used botfront script in index.html to make a flask app that will give a GUI for my rasa chatbot. The chatbot I am trying to implement right now is just the basic rasa init chatbot. I am facing some issues when running the docker-compose up command.

Goal

To run rasa flask app via docker.

Current Issue

The app server is shown as running, but it is not visible on the mentioned address.

Error

Starting rasa-chat-app … done

Starting rasa-chatbot-server … done

Attaching to rasa-chat-app, rasa-chatbot-server

rasa-chat-app | * Serving Flask app ‘app’ (lazy loading)

rasa-chat-app | * Environment: production

rasa-chat-app | WARNING: This is a development server. Do not use it in a production deployment.

rasa-chat-app | Use a production WSGI server instead.

rasa-chat-app | * Debug mode: on

rasa-chat-app | * Running on all addresses.

rasa-chat-app | WARNING: This is a development server. Do not use it in a production deployment.

rasa-chat-app | * Running on http://172.18.0.3:8000/ (Press CTRL+C to quit)

rasa-chat-app | * Restarting with stat

rasa-chat-app | * Debugger is active!

rasa-chat-app | * Debugger PIN: 143-584-386

rasa-chatbot-server | Matplotlib created a temporary config/cache directory at /tmp/matplotlib-e9aqxszg because the default path (/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.

rasa-chatbot-server | 2021-07-06 07:37:38 WARNING rasa.utils.common - Failed to write global config. Error: [Errno 13] Permission denied: ‘/.config’. Skipping.

rasa-chatbot-server | 2021-07-06 07:37:38 INFO root - Starting Rasa server on http://localhost:5005

rasa-chatbot-server | 2021-07-06 07:37:38 INFO rasa.model - Loading model models/20210425-161726.tar.gz…

rasa-chatbot-server | 2021-07-06 07:37:50 INFO root - Rasa server is up and running.

rasa-chat-app | 172.18.0.1 - - [06/Jul/2021 08:19:51] “GET / HTTP/1.1” 200 -

rasa-chat-app | 172.18.0.1 - - [06/Jul/2021 08:19:51] “GET /favicon.ico HTTP/1.1” 404 -

Files

Docker-compose file

version: '2' services:   rasa-flask:
    image: rasa-chatbot:latest
    build:
      context: .
      dockerfile: Dockerfile
    container_name: rasa-chat-app
    volumes: 
      - .:/rasa_app
    ports:
      - 5000:5000
    command: python3 app.py   rasa-server:
    image: rasa/rasa:2.1.2-full
    container_name: rasa-chatbot-server
    volumes: 
      - .:/app
    ports:
      - 5005:5005
    command: run -m models --enable-api --cors "*"

DockerFile

FROM tensorflow/tensorflow:2.2.0
RUN mkdir -p /rasa_app
WORKDIR /rasa_app
COPY . /rasa_app
RUN python -m pip install -U pip
RUN pip3 install -r requirements.txt
#RUN pip3 install --user rasa-nlu==0.14.0
#RUN pip3 install --user rasa-core==0.13.2
RUN python -m spacy download en
RUN pip3 install --user rasa==2.1.2
RUN pip3 install --user sanic==19.9.0

Flask App file

from flask import Flask  
from flask import render_template




# creates a Flask application, named app
app = Flask(__name__, static_url_path='/static')

# a route to display our html page gotten from [react-chat-widget](https://github.com/mrbot-ai/rasa-webchat)
@app.route("/")
def index():  
    return render_template('index.html')

# run the application
if __name__ == "__main__":  
    app.run(host="0.0.0.0", port="8000", debug=True)

HTML file

<!doctype html>
<html>
<head>
</head>
<body>
    <script>!(function () {
  let e = document.createElement("script"),
    t = document.head || document.getElementsByTagName("head")[0];
  (e.src =
    "https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.0/lib/index.js"),
    // Replace 1.x.x with the version that you want
    (e.async = !0),
    (e.onload = () => {
      window.WebChat.default(
        {
          customData: { language: "en" },
          socketUrl: "http://localhost:5005",
          // add other props here
        },
        null
      );
    }),
    t.insertBefore(e, t.firstChild);
})();
</script>
</body>
</html>

@Jainil-Gosalia Heya! Few questions for you If you don’t mind? The same process are you able to run locally using RASA+Rasa actions server+ Botfront(rasawebchat)+Flask without docker image or docker-compose? Thanks

Hi @nik202 I am able to run it in locally but my UI is chatroom.

hi @Jainil-Gosalia were you able to run the flask in docker?

Hello all, I have since resolved this issue. It was a rasa webchat version issue. I changed

"https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.0/lib/index.js"

in html file to

"https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.2/lib/index.js"

and it works fine. Thank you for all the help!

@Jainil-Gosalia are you sure this is right code with right version or this code work for which rasa version? Please see this GitHub - botfront/rasa-webchat: A feature-rich chat widget for Rasa and Botfront

"https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.2/lib/index.js"

Note: Ver: 0.11.2 is my concern

As, I never seen this type of version, or I can confirm with botfront team. If its a typo error please update with the right version please. Thanks.

Hey @nik202,

I have seen the link you have sent me and there are only 2 versions for it shown there, I am not sure why that is the case.

I was experimenting with different versions for rasa-webchat I found on this link. I am not sure about your question, but I think there is a version for rasa-webchat on the link I mentioned above.

Hope this helps!

@Jainil-Gosalia Hi. I know about botfront version and the suggested link but I can’t see this version any where which you had mention and it can create a lot of issue and doubt to other users.

"https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.2/lib/index.js"

I have seen the link you have sent me and there are only 2 versions for it shown there, I am not sure why that is the case.

Version 1.0.0 will be used for less than 2.x rasa version Version 1.0.1 will be used for greater than 2.x rasa version

It mention clearly on github link and your suggested link.

I hope this will help you, to get you more clarity.