HOW 2 DEPLOY RASA CHATBOT WITH HEROKU | FREE FOR LIFETIME | DOCKER

DEPLOY RASA CHATBOT WITH HEROKU | INNOVATE YOURSELF
0
0

OVERVIEW

In this blog, you will learn,
1. How to set up the rasa chatbot into the docker container with Heroku
2. Installation of Heroku
3. How to deploy Rasa chatbot with Heroku app and make it active on the live server FREE FOR LIFETIME
4. How to connect to the rasa chatbot through the Live API generated with the Heroku app

In our previous blogs and videos on building a chatbot and deployment of Rasa chatbot to live server, you must have seen that if you want to deploy chatbot live on the server then you need a VM instance and hosting where you can host your chatbot and also you must be paying some amount for it like $50 per instance per month. But what if I say that you dont even have to pay this amount for deploying the chatbot on to the live server. Surprised… 😀

In our today’s blog you will learn about a very interesting and a great platform that won’t charge you any cost for the deployment of Rasa chatbot to the live server, i.e., Heroku.

set up the rasa chatbot into the docker container with Heroku

To deploy the rasa chatbot with heroku you must have a rasa project with you. In that case either you create a new one or use the existing project. If you are creating a new project then checkout our previous blog for creating a new rasa project.

Now you have a rasa project with you. Go to the project directory where you have your rasa project and open the terminal for the current location. Here create a Dockerfile with the given command,

nano Dockerfile

now add the given commands inside the Dockerfile and save it.

FROM ubuntu:18.04
ENTRYPOINT []
RUN apt-get update && apt-get install -y python3 python3-pip && python3 -m pip install --no-cache --upgrade pip && pip3 install --no-cache rasa==1.10.8 --use-feature=2020-resolver
ADD . /app/
RUN chmod +x /app/start_services.sh
CMD /app/start_services.sh

Note: Before you start with the further steps, make sure that you have docker installed and running on your system.

Now create another file on the current directory with the given command.

nano start_services.sh

add the given code in it and save it.

cd app/
# Start rasa server with nlu model
rasa run --model models --enable-api --cors "*" --debug \
          -p $PORT

Now we’ll initialize a git repo so that our project will be stored on to git repo and just like we did while deploying the rasa chatbot to GCP with git repo. Now let initialize the git repo for the deployment of rasa chatbot with heroku. Write the given commands in the terminal on the current location,

git init
git add . 
git commit -m "Initialize the project"

Installation of Heroku

Now you have to login to the heroku account through CLI for that you have to first install heroku on your system as shown below.

sudo snap install --classic heroku

With this command heroku will be installed on your system.

Now login to the heroku with the given command,

heroku login

if this command doesn't work for you then use this,

/snap/bin/heroku login
  • heroku login CHATBOT WITH HEROKU
  • ask login CHATBOT WITH HEROKU
  • logged in CHATBOT WITH HEROKU

Also check this video for more clarification,

How to deploy Rasa chatbot with Heroku app

Now create an app on your heroku account with the given command,

/snap/bin/heroku create innovateyourself
app created CHATBOT WITH HEROKU

Now use the next command for the container login to update all the dependencies inside the container that you specified for deploying the rasa chatbot with heroku,

/snap/bin/heroku container:login
DEPLOY RASA CHATBOT WITH HEROKU

Now push the current project to the git repo for the final deployment of rasa chatbot with heroku.

/snap/bin/heroku container:push web
/snap/bin/heroku container:release web
  • be5d9c43 3797 4737 a566 5a91d1bc1747 CHATBOT WITH HEROKU
  • release CHATBOT WITH HEROKU

Now create a new script on the current directory to verify that your rasa project is live and running with the generated url.

nano main.py

and add the given code to it.

import requests
url = 'http://innovateyourself.herokuapp.com/webhooks/rest/webhook' ##change rasablog with your app name
myobj = {
"message": "hi",
"sender": "Ashish",
}
x = requests.post(url, json = myobj)
print(x.text)

Now save the script and run it.

python3 main.py
  • run output CHATBOT WITH HEROKU
  • code CHATBOT WITH HEROKU

Now you can see that your bot is working as per the project that you have on your git repository which we just deployed on heroku app.

For any doubts or queries related to the DEPLOYMENT OF RASA CHATBOT WITH HEROKU APP feel free to leave a comment below in the comment section. Also, do comment your valuable feedback to appreciate us. For any further information or queries, you can also WhatsApp me at +91 8209829808.

Stay tuned and happy learning.

2 thoughts on “HOW 2 DEPLOY RASA CHATBOT WITH HEROKU | FREE FOR LIFETIME | DOCKER

Leave a Reply