Ok, this is mainly the config files and some commands but for apache2, ngingx and certbot you need to find specific installation guides
first initialize rasa docker in subfolder where you want chatbot A to be
docker run -it --rm --user 1003 -v $(pwd):/app rasa/rasa:2.2.0-full init --no-prompt
now your folder should look like this
[paulii@vetbot-v4 /amva TUOTANTO]$ ls -l
total 108
drwxr-xr-x 3 paulii root 4096 May 20 16:39 actions
-rw-r--r-- 1 paulii root 1267 Oct 28 11:27 config.yml
-rw-r--r-- 1 paulii root 1083 May 20 18:24 credentials.yml
drwxr-xr-x 2 paulii root 4096 Oct 28 11:55 data
-rw-r--r-- 1 paulii root 79196 May 20 16:51 domain.yml
-rw-r--r-- 1 paulii root 1411 Dec 17 2020 endpoints.yml
drwxr-xr-x 2 paulii root 4096 Oct 28 11:41 models
drwxr-xr-x 2 paulii root 4096 May 20 16:39 tests
When you make changes to config files you need train it, use this command
docker run -it --rm --user 1003 -v $(pwd):/app rasa/rasa:2.2.0-full train --debug
When you have made all your bots, then we need to make this
docker-compose.yml
version: '3.0'
services:
amva:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5011:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/amva/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
aspa:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5005:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/aspa/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
hyvment:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5015:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/hyvment/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
ittuki:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5012:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/ittuki/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
sakky:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5006:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/sakky/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
vetbot:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5008:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/vetbot/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
vetbot:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5008:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/vetbot/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
laakebot:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5010:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/laakebot/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
syobot:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5009:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/syobot/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
esihoks:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5016:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/esihoks/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
pilleribot:
image: rasa/rasa:2.2.0-full
restart: always
ports:
- 5013:5005
volumes:
- /home/paulii/rasa2Prod/rasaProd/IIpilleribot/:/app
command:
- run
- -m
- models
- --enable-api
- --cors
- "*"
- --debug
and it is located here
[paulii@vetbot-v4 /rasaProd TUOTANTO]$ ls -l
total 56
drwxrwxr-x 6 paulii paulii 4096 Oct 27 16:23 IIpilleribot
drwxrwxr-x 6 paulii paulii 4096 Oct 28 11:27 amva
drwxrwxr-x 6 paulii paulii 4096 Aug 13 16:49 aspa
-rw-rw-r-- 1 paulii paulii 2976 Oct 27 09:47 docker-compose.yml
drwxrwxr-x 6 paulii paulii 4096 Sep 16 13:23 esari
drwxrwxr-x 6 paulii paulii 4096 Oct 29 17:16 esihoks
drwxrwxr-x 6 paulii paulii 4096 Oct 29 14:45 hyvment
drwxrwxr-x 7 paulii paulii 4096 Oct 8 10:11 ittuki
drwxrwxr-x 6 paulii paulii 4096 Aug 13 16:52 laakebot
drwxrwxr-x 6 paulii paulii 4096 Oct 11 09:35 pilleribot
drwxrwxr-x 6 paulii paulii 4096 Oct 29 17:08 sakky
drwxrwxr-x 6 paulii paulii 4096 Aug 5 09:53 syobot
drwxrwxr-x 6 paulii paulii 4096 Jun 3 12:30 talhal
drwxrwxr-x 6 paulii paulii 4096 May 19 16:04 vetbot
use following command to check that all bots are up and running
docker ps -a
Then you need install Apache2. Here are the needed configfiles
directory
/etc/apache2/sites-available
and virtualhost config
<VirtualHost *:444>
ServerAdmin webmaster@localhost
ServerName ammabotti1.omnia.fi
ServerAlias www.ammabotti1.omnia.fi
DocumentRoot /var/www/html/amva
<Directory /var/www/html/amva>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</Directory>
### following three lines are for CORS support
#Header add Access-Control-Allow-Origin "*"
#Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
#Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
then you need to have actual chatbot widget I use Botfront webchat as chatbot frontend. Here is what is needed
Directory
/var/www/html
There each virtualhost needs to have own folder
[paulii@vetbot-v4 /html TUOTANTO]$ ls -l
total 44
drwxr-xr-x 2 root root 4096 Oct 27 15:55 amva
drwxr-xr-x 2 root root 4096 Oct 27 15:15 aspa
drwxr-xr-x 2 root root 4096 Oct 27 15:55 esihoks
drwxr-xr-x 2 root root 4096 Oct 29 12:26 hyvment
drwxr-xr-x 2 root root 4096 Oct 27 15:16 ittuki
drwxr-xr-x 2 root root 4096 Oct 27 15:56 laakebot
drwxr-xr-x 2 root root 4096 Oct 27 15:56 pilleribot
drwxr-xr-x 2 root root 4096 Oct 27 15:57 sakky
drwxr-xr-x 2 root root 4096 Oct 27 15:57 syobot
drwxr-xr-x 2 root root 4096 Oct 27 15:57 talhal
drwxr-xr-x 2 root root 4096 Oct 27 15:58 vetbot
and then in each subfolder you need to have two files
index.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.12/lib/index.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="webchat"></div>
<script>
WebChat.default.init({
showFullScreenButton: true,
selector: "#webchat",
initPayload: "/tervetuloa",
customData: {"language": "fi"}, // arbitrary custom data. Stay minimal as this will be added to the socket
//socketUrl: "http://ammabotti1.omnia.fi:5011",
socketUrl: "https://ammabotti1.omnia.fi",
socketPath: "/socket.io/",
embedded: false,
title: "Alma botti",
subtitle: "Ammatinvalinta botti",
inputTextFieldHint: "Hae ammattia...",
profileAvatar: "robot_icon.png",
params: {"storage": "session"} // can be set to "local" or "session". details in storage section.
})
</script>
</body>
</html>
and style.css
:root {
--color: #11a6b8;
--white: #ffffff;
}
.rw-conversation-container .rw-header {
background-color: var(--color);
}
.rw-conversation-container .rw-client {
background-color: var(--color);
}
.rw-conversation-container .rw-close-button {
background-color: var(--color);
}
.rw-conversation-container .rw-reply {
background-color: var(--color);
}
.rw-launcher{
background-color: var(--color);
}
.rw-conversation-container .rw-replies {
display:block
}
After that reload Apache2 and bots are woking in HTTP mode.
Now the last step, make Nginx reverse proxy with SSL. Install Nginx normally.
Go to
/etc/nginx/sites-available
and here is example config. BUT here is tricky part, this is final config, in order this you need to make first basic reverse-proxy config, then run Certbot for Nginx, which adds automatically certbot sections to config file, which will be then Reverse-proxy with SSL
[paulii@vetbot-v4 /sites-available TUOTANTO]$ cat tuotantoProxy
server {
server_name ammabotti1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/amva/;
location / {
proxy_pass http://ammabotti1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://ammabotti1.omnia.fi:5011/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
access_log /var/log/nginx/testibot1.fi_access.log;
error_log /var/log/nginx/testibot1.fi_error.log;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name aspabotti1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/aspa/;
location / {
proxy_pass http://aspabotti1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://aspabotti1.omnia.fi:5005/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name hyvinvointi.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/hyvment/;
location / {
proxy_pass http://hyvinvointi.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://hyvinvointi.omnia.fi:5015/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name esihoks.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/esihoks/;
location / {
proxy_pass http://esihoks.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://esihoks.omnia.fi:5016/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name vetbot2.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/pilleribot/;
location / {
proxy_pass http://vetbot2.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://vetbot2.omnia.fi:5013/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name sakkybotti1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/sakkky/;
location / {
proxy_pass http://sakkybotti1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://sakkybotti1.omnia.fi:5006/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name syobotti1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/syobot/;
location / {
proxy_pass http://syobotti1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://syobotti1.omnia.fi:5009/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name talhalbotti1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/talhal/;
location / {
proxy_pass http://talhalbotti1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://talhalbotti1.omnia.fi:5007/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name vetbot1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/vetbot/;
location / {
proxy_pass http://vetbot1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://vetbot1.omnia.fi:5008/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name laakebotti1.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/laakebot/;
location / {
proxy_pass http://laakebotti1.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://laakebotti1.omnia.fi:5010/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
server_name ittukibot.omnia.fi;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/html/ittuki/;
location / {
proxy_pass http://ittukibot.omnia.fi:444;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
location /socket.io/ {
proxy_pass http://ittukibot.omnia.fi:5012/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/aspabotti1.omnia.fi/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/aspabotti1.omnia.fi/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = ammabotti1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name ammabotti1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = aspabotti1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name aspabotti1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = esihoks.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name esihoks.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = hyvinvointi.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name hyvinvointi.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = ittukibot.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name ittukibot.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = laakebotti1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name laakebotti1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = sakkybotti1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name sakkybotti1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = syobotti1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name syobotti1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = talhalbotti1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name talhalbotti1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = vetbot1.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name vetbot1.omnia.fi;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = vetbot2.omnia.fi) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name vetbot2.omnia.fi;
listen 80;
return 404; # managed by Certbot
}