Install Clai 2.0 on Microsoft Windows
The Windows installation is only included with the Enterprise Edition.
This document is for installing Clai 1.2.x and assumes the packages will be installed into directory \app
Locate the installation files in \app
Installation of Rasa and Action Services
Install Python, the Microsoft Visual C runtime and Redir using their respective installers
- Install python 3.7.9
- Install VC_redist.x64.exe
- Install Redis-x64-3.2.100.msi
Note: whilst installing redir, do put it in the app directory and most likely you’ll not need to add a firewall exception unless running in a cluster in which case the exception should be edited to limit who can connect to redis and also enabling a password for access to the redis service.
This document assumes that you have tar available in your Windows environment. If not you should use a tool such as 7-Zip or alternate in its place.
In a command window run as Administrator:
cd \app
tar xf actions-1.0.3.tar.gz
mkdir models
mkdir logs
python -m venv rasa
cd rasa\lib
tar xf ..\..\site-packages-1.0.3.tar.gz
If the intention is to use Spacy for NLU, then also install the relevant language pack, i.e. english.
cd ..\..
rasa\scripts\python -m spacy link en_core_web_md en
Now disable Rasa telemetry
rasa\scripts\python -m rasa telemetry disable
Install the services:
For Clai Server and Actions services:
cd \app
set APP=c:\app
Check the script contents are correct and then run the scripts
svc-server.cmd
svc-actions.cmd
Start the services
Installation of Clai Admin and Mongo services
Install NodeJS and MongoDB using their respective installers
- Install node-v12.21.0-x64.msi
- Install mongodb-windows-x86_64-5.0.4-signed.msi
In a command window run as Administrator:
cd \app
mkdir models
tar xf admin-1.2.x.tar.gz
Install the Clai admin service:
For the Clai Admin Service:
cd \app
set APP=c:\app
set ADMIN_ROOT_URL=http://HOST:8888
Check the script content, correct it and then run the script
svc-admin.cmd
Installation of Nginx proxy and ssl offload
Unzip the file nginx-1..0.zip
cd \app
unzip nginx-1.18.0.zip
Rename the directory to just nginx
ren nginx-1.18.0 nginx
Edit as required then copy the nginx.conf file to nginx\conf\nginx.conf
copy nginx.conf nginx\conf\nginx.conf
For nginx supporting rasa then also copy the file Clients\index.js to nginx\html
copy Clients\index.html nginx\html\index.html
copy Clients\index.js nginx\html\index.js
Completion
Add the necessary rules to the windows firewall for the claisvr and claiadmin ports.
Clean up
You can now delete the following files used as part of the installation or move them to a backup directory:
- python-3.7.9-amd64.exe
- VC_redist.x64.exe
- Redis-x64-3.2.100.msi
- node-v12.21.0-x64.msi
- mongodb-windows-x86_64-4.4.4-signed.msi
- nginx-1.18.0.zip
- admin-1.1.2.tar.gz
- site-packages-2.3.3.cl.5.tar.gz
- svc-server.cmd
- svc-actions.cmd
- svc-admin.cmd
- svc-web.cmd
- nginx.conf
Necessary changes to be considered in Rasa and Admin
To setup services to the clai you have to define various configuaration settings as shown below:
Rasa server
For Rasa server, add the below variables:
- CLAI_ENV : Add service name
- ADMIN_URL : Admin graphql URL
Admin server
For admin server, add the below paths:
- CLAIENVSPATH : path for the file in which services are defined
- CLAIMODELSPATH : path where models will be stored and retrieved after training
- ADMIN_DB_URL : add the mongo db url including the database name
Setting up services
For creating services you have to create
clai_services
folder and create a file calledclaiservice.yaml
and specify credentials, endpoints and instance. Path of the file would be provided in enviornment variable named “CLAIENVSPATH”Once the rasa services are created, then you are able to associate those services to a particular project in clai according to the requirement.
You can create multiple rasa services with unique names and assign them to projects in Clai admin settings.
Service names can be named according to your preferences and it can be configured from one project to other and vice versa.
As Clarity uses CORS you will need to enable CORS within the webchat channel to enable Clarity to connect to the channel as doing so you will enable continued use of the standalone and admin based webchat clients.
Service name should be passed in the endpoints while configuring model server. Endpoints let you define how your Rasa instance communicates with Clai and the actions server.
- the Clai API to query the bot responses (nlg)
- the actions server (action_endpoint)
- the tracker store (tracker_store)
See the below example for the services.
SERVICE : ## name of the service
credentials:
rasa_addons.core.channels.webchat.WebchatInput:
session_persistence: true
base_url: http://CLAIHOST:CLAIPORT
socketio_path: /development/socket.io/
socket_path: /development/socket.io/
cors_allowed_origins:
- http://CLARITYHOST:CLARITYPORT
- http://CLAIHOST:CLAIPORT
endpoints:
models:
url: http://CLAI_HOST:CLAI_PORT/models/SERVICE
wait_time_between_pulls: 100 # [optional](default: 100)
nlg:
type: rasa_addons.core.nlg.GraphQLNaturalLanguageGenerator
url: http://CLAI_HOST:CLAI_PORT/graphql
action_endpoint:
url: http://ACTION_SERVER:ACTION_SERVER_PORT/webhook
tracker_store:
store_type: rasa_addons.core.tracker_stores.botfront.BotfrontTrackerStore
url: http://CLAI_HOST:CLAI_PORT/graphql
instances:
host: http://RASA_HOST:RASA_PORT
All services would be listed in the service page and you can see the available services and their associated project with enviornment details.
You can also add a service with different environments in a projects page such as development, training and production service.
One service can be re-used in many projects for training environment but can’t give same service name for both development and production environments.
You must now restart the rasa service, i.e. rasa-development. Now test by accessing:
- Clarity at http://CLARITYHOST:CLARITYPORT/pmb
- the standalone webchat at http://CLAIHOST:CLAIPORT/webchat
- the Admin webchat within the project in the admin tool at http://CLAIHOST:CLAIPORT
If there is no path added by the client in the “admin > settings > webhooks > upload model” then the model will be stored locally in the path provided inside enviornment variable “CLAIMODELSPATH”
All the models stored in the model server path would be visible in Models page inside admin. You can view/delete models and review their associated projects.
Uninstall Clai for Windows
Uninstall of Rasa and Action Services
In a command window run as Administrator stop the services and then remove them:
net stop claisvr
net stop claiactions
net stop claiweb
cd \app
nssm remove claisvr
nssm remove claiactions
nssm remove claiweb
Remove the installation directory
cd \app
rd /S /Q rasa
rd /S /Q actions
rd /S /Q nginx
Uninstall python 3.7.9 in Apps & Features control.
Uninstall of Admin and Mongo services
In a command window run as Administrator stop the services and then remove them:
net stop claiadmin
net stop claiweb
cd \app
nssm remove claiadmin
nssm remove claiweb
Remove the installation directory
cd \app
rd /S /Q admin
rd /S /Q nginx
Uninstall NodeJS, MongoDB and Redis in Apps & Features control.
Completion
If all components have been removed from the server now delete \app to remove the model and logs directories.
cd \
rd /S /Q \app