Deploy bot on Heroku - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum
Deploy bot on Heroku
post by SimbaM on Sep 18, 2019
Hi there
I am trying to deploy my bot on heroku using a docker. When I release
Since Heroku dynamically generates the port number for the app, I used the $PORT variable. The problem is for some reason, the port number generated comes with a preceding backslash and this caused the app to fail. Any ideas on how I can fix this??
This is my dockerfile
FROM chatbotv3
ENV PORT 5005
WORKDIR /app
COPY ./ ./
CMD ["run", "-p", "5005:$PORT", "-m", "models","--credentials", "credentials.yml", "--enable-api", "--log-file", "out.log", "--endpoints", "endpoints.yml"]
EXPOSE 5005
And this is the command what the app attempts to run before it fails
2019-09-19T01:33:42.182999+00:00 heroku[web.1]: Starting process with command `run -p 5005:\5427 -m models --credentials credentials.yml --enable-api --log-file out.log --endpoints endpoints.yml`
post by SimbaM on Oct 3, 2019
Solved it by using sed to remove the preceding backslash
So the cmd ended up being:
CMD $(echo "rasa run -p $PORT -m models --credentials credentials.yml --enable-api --log-file out.log --endpoints endpoints.yml" | sed 's/=//')
post by cityhunter25197 on Feb 18, 2020
hi, can you help me step by step deploying rasa to heroku?
post by SimbaM on Mar 1, 2020
Hey cityhunter25197
Apologies for the late response. I dont have the detailed steps but the steps you find on this link are just as good --> Container Registry & Runtime (Docker Deploys) | Heroku Dev Center
One thing that you will need to take note of is that in the dockerfile… coz of the issue that I mentioned above you will need to change the CMD command. Below is an example of a dockerfile that I used to run the action server at one time
FROM rasa/rasa:latest-full
WORKDIR /app
ADD . .
ENTRYPOINT []
EXPOSE 5005
CMD $(echo "rasa run actions -p $PORT --debug" | sed 's/=//')
Hope this helps…
post by cityhunter25197 on Mar 2, 2020
Hi Simba.
I’m totally new in this field.
Can you show me all your root file and dockerfile? and what type of <process-type> should I use in this command
heroku container:push <process-type>
I’m confused between your dockerfile in the first comment and the last one you reply to me. I use Rasa Open Source (not Rasa X) and my folder just like this
data
models
__init__.py
actions.py
config.yml
credentials.yml
domain.yml
endpoints.yml
requirements.txt
I really need your help !
post by SimbaM on Mar 2, 2020
Hey! I am happy to help but I think its worth taking a few steps back to look at the bigger picture. Tell me… why is it u want to run yo bot on heroku… reason why i am asking is… after playing around with it for quite a bit… I gathered its not the best of platforms to run your bot from. In fact, from the sound of it… it seems you already have a basic bot that provides some of your key responses (also known as happy paths) you would rather look for another cloud service provider and set yo bot up and run it from there.
Check out this Rasa Master Class, it will walk you through what u need to do to have it up and running step by step.
Let me know…
post by cityhunter25197 on Mar 2, 2020
Thank you. I have built a simple bot and used ngrok to make it available for everyone who visits my website (to complete my thesis in school). But I can’t always use ngrok. (turn on my computer). So I want to deploy my bot to a cloud server. I think heroku is a good choice.
I have deployed it following your help but I got some errors in CMD command. This is my dockerfile
FROM rasa/rasa:latest-full
ENV PORT 5005
WORKDIR /app
COPY ./ ./
EXPOSE 5005
CMD $(echo "rasa run -p $PORT -m models --credentials credentials.yml --enable-api --log-file out.log --endpoints endpoints.yml" | sed 's/=//')
post by cityhunter25197 on Mar 2, 2020
Yes. I have successfully deployed actions server separately to heroku. Currently, in my endpoint.yml
action_endpoint:
url: "https://****.herokuapp.com/webhook"
post by cityhunter25197 on Mar 2, 2020
I think the I have the problem with $PORT. my dockerfile is on comment above. I usually run rasa on local with this command
rasa run -m models --enable-api --cors "*" --debug
post by cityhunter25197 on Mar 3, 2020
I got this error https://imgur.com/a/idjxswK
post by cityhunter25197 on Mar 3, 2020
Starting process with command run -p 5005:\5427 -m models --credentials credentials.yml --enable-api --log-file out.log --endpoints endpoints.yml
post by ramaneswaran on Apr 14, 2020
Can you please tell me, what is in the __init__.py file?
post by _sanjay_r on Apr 22, 2020
Hey @cityhunter25197,
Did you manage to deploy the bot to heroku ??
post by ahnineamine on May 7, 2020
did anybody find the solution for this please, I have the same issue!
here my dockerfile
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.9.5 && pip install spacy==2.1.9 && pip install https://github.com/explosion/spacy-models/releases/download/fr_core_news_md-2.1.0/fr_core_news_md-2.1.0.tar.gz && python3 -m spacy link fr_core_news_md fr
RUN pip3 install gunicorn
ENV LANG C.UTF-8
ADD . /app/
WORKDIR /app
CMD rasa run --model models --enable-api --cors "*" --debug -p $PORT
post by yassine.lamarti on Jun 11, 2020
Hello @SimbaM, Can you help me, why they used :
FROM chatbotv3
I didn’t find any chatbotv3 repo in hub.docker.com
When I use :
FROM rasa/rasa:1.10.2-full WORKDIR /app COPY . /app EXPOSE 5005 CMD ["run", "--cors", "*", "--debug"] Heroku give me this error:
post by SimbaM on Jun 23, 2020
Steps to create bot using docker and deploy on heroku
- Create a docker image using a dockerfile with the text below and the command: docker build -t chat_bot:v1 .
FROM rasa/rasa:1.10.3-full
USER root
RUN apt-get update -qq
WORKDIR /app
ADD . .
ENTRYPOINT []
USER 1001
CMD $(echo "rasa run -p $PORT -m models --credentials credentials.yml --enable-api --log-file out.log --endpoints endpoints.yml" | sed 's/=//')
Create a project using the new image using the command: docker run -v /c/Temp/bot:/app chat_bot:v1 rasa init --no-prompt
At this point you can make changes to your bot (add stories\intents etc) and to run and train the bot after making the changes you can train the bot using the command: docker run -v /c/Temp/bot:/app chat_bot:v1 rasa train --domain domain.yml --data data --out models
To see your bot in action, use the command: docker run -it -v /c/Temp/bot:/app chat_bot:v1 rasa shell
Now lets deploy to heroku. Assuming you already have a heroku acc and the cli installed)
a. heroku login b. heroku container:login c. heroku create d. heroku container:push web --app xxxxxxxxx e. heroku container:release web --app xxxxxxxxx f. heroku logs --tail --app xxxxxxxxx
This is it… let me know if you have any questions
Cheers
post by ahnineamine on Jun 23, 2020
thanks a lot @SimbaM.
Actually since then, I’ve used AWS instead of Heroku, and it works just fine. I see what you mean by “reservations” and I completly agree. Heroku is meant for light Microservices not for deploying bots. Working with EC2 gives you much more control and flexibility, plus its way easier to deploy your Docker images from there.
post by yassine.lamarti on Jul 13, 2020
Hello @SimbaM, Thank you for your help. But I see that the size’s error is not solved.
post by analyticalgagan on Jul 19, 2020
Hello ahnineamine