How to deploy Rasa on server? - Rasa Open Source - Rasa Community Forum
How to deploy Rasa on server?
post by datistiquo on Aug 6, 2018
Hey,
I want to make my bot available for few people who have access to a server. How do I manage such things? I have no experience with servers. I am interested in the basic way to do that. So that you know how less I know about that: How do users use then this bot from there local machine (like via a webpage?)? I have a GUI which they can address.
Thanks!
post by NikhilBansal21 on Aug 7, 2018
Are you using your bot as a server? If yes then you can setup server either through Azure or AWS services and there you can clone your bot code. I have taken Windows OS for the server (Azure) you can opt for Linux also. From there you have to run your bot on a port and from your Azure / AWS console you have to open that port so that it can be accessed publicly by any app as a URL. It is by far the most easy way to access your bot apart from using it as localhost. You can also use ngrok if you want to host your bot locally on your machine; it will host your bot from your local repository itself (best for testing alternative for localhost). If you have a GUI then it is better you go for HTTP server here. I am also using my bot on a custom GUI and it works well by using it as a bot server!
post by datistiquo on Aug 7, 2018
Sorry, I try to understand your reply. What do you mean bot as a server? I don’t want to run a local server. At the moment I use ngrok for this. But with that, you cannot do a real server for public access?
From there you have to run your bot on a port and from your Azure / AWS console you have to open that port so that it can be accessed publicly by any app as a URL.
So I do effectively the same on the server as on my local machine when using ngrok, i.e., opening a port etc. So the whole time the bot is running a console needs to be open?
How can I open a port and choose a specific URL such that other users can access from their local machine?
What requirements are there on the server? Why do I have to use Azure or AWS?
post by NikhilBansal21 on Aug 8, 2018
I guess you did not go through the link to the docs which I provided; that is why you are not getting bot as a server part! As concerned with Azure and AWS these are some common instances when we talk about hosting our application. If you know any other service you can opt for that. As talked about ngrok, yes you will need to leave it open all the time, but not in the case of a server where the machine you will opt for should not be shut down. You can go through docs for whichever service you are opting for as to how you can open a port. As of my case for Azure this can help: link.
For requirements, you have to set up all the bot’s dependencies like Python, pip, rasa-nlu/core, spacy, etc., for running scripts! If you need any help can ask!
post by datistiquo on Aug 8, 2018
Thanks! So, as I understand correctly, you just need to open a port irrespective of the kind of server? How are multiple users then handled? What do I have to change for that?
I have my NLU and Core but I am really not familiar with server knowledge and it just blows up my mind. I don’t know how these two components have to interact with a server such that things work…
Are you using this as a synonym for bot as a server? here.
So, is this already ready for real production?
post by NikhilBansal21 on Aug 8, 2018
hi, let’s break your query into parts for better understanding both for you and me.
For core multiple user requests are handled like this:
POST /conversations/(str: sender_id)/parse
curl -XPOST localhost:5005/conversations/default/parse -d '{"query":"hello there"}' | python -mjson.tool
Here, in place of default, you will have to add a user id which your GUI will assign for any user who will login to your bot for distinguishing between multiple users.
You have to go through docs as after training your NLU + dialogue (core) model, you can run your bot using rasa’s HTTP server command:
python -m rasa_core.server -d examples/babi/models/policy/current -u examples/babi/models/nlu/current_py2 -o out.log
Here path for NLU & core models is set up for making your bot work; it will be the same way done for server as done in local!
post by datistiquo on Aug 8, 2018
Thank you! I appreciate your help. But I am rather confused about this HTTP server bot. It looks like I have to manually create the dialogue via those endpoints. So, it seems you have to do some work to handle your bot via this server?
To start a conversation, send a POST request to the /conversation/<sender_id>/parse endpoint. <sender_id> is the conversation id (e.g., default if you just have one user, or the Facebook user ID or any other identifier).
I am confused about those curl commands. This seems like manual work.
Is there maybe any toy example? I am a little off when I read this:
If started as a HTTP server, Rasa Core will not handle output or input channels for you. That means you need to retrieve messages from the input channel (e.g., Facebook Messenger) and send messages to the users on your end.
Maybe you can give me some instructions on what I have to do for a test on a server given my core model (in Python) with trained dialogues and my GUI!
post by NikhilBansal21 on Aug 10, 2018
You can run the URL on a browser; curl basically is for that purpose only.
My GUI uses socket.io and from there I got a user ID which I passed onto my rasa bot.
For handling input and output channels means input and output for the bot. Here I have passed a user query to rasa like this:
http://localhost:5005/conversations/rasa-itsm/parse?q=hello
And for the bot’s reply, I used to get a JSON response from which I used to map the intent associated with the user query and for that particular intent block, I used to send a response from my Node app itself, you can do it using your actions.py file for that but I had a predefined architecture for my native app which is also working for Dialogflow.
I hope you get some clarity from this; if any more queries, ask!
post by datistiquo on Aug 10, 2018
I do roughly understand the points, but not the mechanisms of how they are connected! As I read your last post there is a lot of stuff I have to do besides having my bot! But no one can tell me how I do that?
For handling input and output channels means input and output for the bot. Here, I have passed a user query to rasa like this
http://localhost:5005/conversations/rasa-itsm/parse?q=hello.
Like this one. Ok, yes. And how does this help me? What and where do I have to write this in what kind of code?
I hope you get some clarity from this if any more queries can ask.
post by mohan on Apr 12, 2019
@datistiquo I’m running the bot on the server and getting this URL http://localhost:5005. I want to change localhost to server IP… How can I do that?
post by soundaraj on May 27, 2019
I am also getting this doubt.
post by mohan on May 27, 2019
@soundaraj we need to use the public IP of the server… If you don’t know, just go to the server and type what is my IP… you will find the public IP. Then open the particular port by setting inbound and outbound rules. If your server is in a corporate network, ask them to open the port from their end also.