-
Notifications
You must be signed in to change notification settings - Fork 22
Deploy a Xatkit bot behind a reverse proxy
In this article we detail how to configure and deploy a Xatkit bot behind a reverse proxy. We use our GreetingsBot example and we configure our web server to make its test page accessible at /greetingsbot/admin
.
Note that our GreetingsBot bot is running on
localhost:5000
, you can adapt the port numbers to your use case if needed.
- Install nginx
sudo apt get install nginx
- Disable the default config
sudo rm /etc/nginx/sites-enabled/default
- Create a new configuration
sudo touch /etc/nginx/sites-available/xatkit.conf
Note that the
sites-available
directory (and thesites-enabled
one used later in the article) are Debian conventions, you may need to adapt to your specific operating system.
- Configure the proxy
server {
listen 80 default_server;
location /greetingsbot/admin {
proxy_pass http://localhost:5000/admin;
}
location /greetingsbot/server {
proxy_pass http://localhost:5001/socket.io;
}
}
Our configuration defines two locations: the first one is the page where the bot can be accessed (similarly to http://localhost:5000
when running a bot locally), and the second one point to the socket.io server that receives the user messages from the web component.
Note that the second location is not required when the deployed bot does not use the web component (e.g. Slack bots)
- Enable the new configuration
ln -s /etc/nginx/sites-available/xatkit.conf /etc/nginx/sites-enabled/xatkit.conf
- Restart nginx
sudo systemctl restart nginx
The deployed bot needs to know its public URL to properly render the /admin
page. We can set it in the .properties
file of the bot:
xatkit.server.public_url = <your base URL>/greetingsbot
xatkit.react.public_url = <your base URL>/greetingsbot/server
The server public URL is required to specify the location of the javascript/css files to use, and the react public URL contains the URL used by the web component to connect to the socket.io server.
**Warning **the
xatkit.server.public_url
value should not include/admin
. See this issue for more information.
Restart your bot, and access it at <your base URL>/greetingsbot/admin
!
- Getting Started
- Configuring your bot
- Integrating an Intent Recognition Provider
- Adding a bot to your website
- Deploying on Slack
- Basic concepts
- Intents and Entities
- States, Transitions, and Context
- Default and Local Fallbacks
- Core Library