Deploy Rasa
You are viewing documentation for our open source project which is maintained by the community. If you want to get started building assistants with Rasa please check out our latest documentation here.
note
The Rasa Helm Chart is open source and available in the helm-charts repository. Please create an issue in this repository if you discover bugs or have suggestions for improvements.
Installation Requirements
- Check that you have installed the Kubernetes or OpenShift command line interface (CLI). You can check this using the following command:
- Kubernetes
- OpenShift
Copy
kubectl version --short --client
The output should be similar to this
Client Version: v1.19.11
If this command resulted in an error, please install the Kubernetes CLI or the OpenShift CLI depending on the cluster you’re using.
- Make sure that the Kubernetes / OpenShift CLI is correctly connected to your cluster. You can do so by using the following commands:
Kubernetes
- OpenShift
Copy
kubectl version --shortThe output should be similar to this
Client Version: v1.19.11
Server Version: v1.19.10
If you get an error when executing the command, you are not connected to your cluster. To get the command to connect to the cluster please consult your cluster’s admin or the documentation of your cloud provider.
- Make sure you have the Helm CLI installed. To check this, run:
Copy
helm version --short
The output should be similar to this
v3.6.0+g7f2df64
If this command leads to an error, please install the Helm CLI.
In case you are using a version <3.5 of Helm, please update to Helm version >=3.5.
Installation
1. Create Namespace
We recommend installing Rasa in a separate namespace to avoid interfering with existing cluster deployments. To create a new namespace run the following command:
Kubernetes
- OpenShift
Copy
kubectl create namespace <your namespace>
2. Create Values File
Prepare an empty file called rasa-values.yml which will include all your custom configuration for the installation with Helm.
All available values you can find in the Rasa Helm Chart repository.
note
The default configuration of the Rasa chart deploys a Rasa Server, downloads a model, and serves the downloaded model. Visit the Rasa Helm Chart repository to check out more examples of configuration.
3. Loading an initial model
The first time you install Rasa, you may not have a model server available yet, or you may want a lightweight model for testing the deployment. For this purpose, you can choose between training or downloading an initial model. By default, the Rasa chart downloads an example model from GitHub. To use this option, you don't have to change anything.
If you want to define an existing model to download from a URL you define instead, update your rasa-values.yaml with the URL according to the following configuration:
Copy
applicationSettings:
initialModel:"https://github.com/RasaHQ/rasa-x-demo/blob/master/models/model.tar.gz?raw=true"
note
The URL for the initial model download has to point to a tar.gz file and must not require authentication.
If you want to train an initial model you can do this by setting the applicationSettings.trainInitialModel to true. It creates a init container that trains a model based on data located in the /app directory. If the /app directory is empty it creates a new project. You can find an example that shows how to download data files from a git repository and train an initial model in the Rasa Helm Charts examples.
4. Deploy Rasa Assistant
Run the following commands:
Copy
kubectl version --short --client
The output should be similar to this
Client Version: v1.19.11
Copy
# Add the repository which contains the Rasa Helm Chart
helm repo add rasa https://helm.rasa.com
# Deploy Rasa
helm install\
--namespace <your namespace>\
--values rasa-values.yml \
<release name>\
rasa/rasa
note
OpenShift only: If the deployment fails and oc get events returns 1001 is not an allowed group spec.containers[0].securityContext.securityContext.runAsUser, re-run the installation command with the following values:
Copy
postgresql:
volumePermissions:
securityContext:
runAsUser:"auto"
securityContext:
enabled:false
shmVolume:
chmod:
enabled:false
nginx:
image:
name: nginxinc/nginx-unprivileged
port:8080
Then wait until the deployment is ready. If you want to check on its status, the following command will block until the Rasa deployment is ready:
Kubernetes
- OpenShift
Copy
kubectl --namespace <your namespace>\ wait\ --for=condition=available \ --timeout=20m \ --selector app.kubernetes.io/instance=<release name>\ deployment
5. Access Rasa Assistant
By default the Rasa deployment is exposed via the rasa (<release name>) service and accessible only within a Kubernetes cluster. To access Rasa Assistant by using kubectl port-forward, use these commands:
Kubernetes
- OpenShift
Copy
export SERVICE_PORT=$(kubectl get --namespace <your namespace> -o jsonpath="{.spec.ports[0].port}" services <release name>) kubectl port-forward --namespace <your namespace> svc/<release name> ${SERVICE_PORT}:${SERVICE_PORT} &
You can then access the deployment on http://127.0.0.1:${SERVICE_PORT}. The other option is to expose your deployment on NodePort and access it directly.
Prepare configuration that switch the rasa service to
NodePort.Copy
# rasa-values.yaml service: type:"NodePort"Upgrade deployment.
Copy
helm upgrade --namespace <NAMESPACE> --reuse-values -f rasa-values.yaml <RELEASE NAME> rasa/rasaGet the node port and address for the rasa service.
Copy
export NODE_PORT=$(kubectl get --namespace <NAMESPACE> -o jsonpath="{.spec.ports[0].nodePort}" services <RELEASE NAME>) $ curl http://127.0.0.1:${NODE_PORT}
Hello from Rasa: 2.8.7
Visit the Rasa Helm Chart README to learn other ways to expose your deployment.
Next Steps
- Visit the Rasa Helm Chart repository where you can find examples of configuration.