Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport deploy docs changes #10957

Merged
merged 22 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/docs/deploy/deploy-action-server.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
id: deploy-action-server
sidebar_label: "Deploy Action Server"
title: "Deploy Action Server"
description: Deploy and connect to your custom action server
abstract: This page shows you where to find how to deploy Rasa Action Server and how to build a custom Docker image.
---
<!-- this file is version specific, do not use `@site/...` syntax -->
import variables from './../variables.json';

## a. Deploy Action Server

Visit the [Rasa Action Server docs](https://rasa.com/docs/action-server/deploy-action-server#a-installation) to learn how to [build an Action Server image](https://rasa.com/docs/action-server/deploy-action-server#building-an-action-server-image) and how to deploy an Action Server using Helm.

## b. Connect Rasa Action Server with Rasa Open Source deployment

Visit the [Connect Rasa Action Server with Rasa Open Source deployment](https://rasa.com/docs/action-server/deploy-action-server#b-connect-rasa-action-server-with-rasa-open-source-deployment) section to learn how to connect a Rasa Action Server deployment with Rasa Open Source deployment.
18 changes: 18 additions & 0 deletions docs/docs/deploy/deploy-rasa-x.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
id: deploy-rasa-x
sidebar_label: "Deploy Rasa X"
title: "Deploy Rasa X"
description: "Deploying Rasa X to improve your Rasa assistant"
abstract: This page shows you where to find out how to deploy Rasa X and forward events to it from your Rasa Open Source deployment. The third and final step in deploying your Rasa assistant.
---
<!-- this file is version specific, do not use `@site/...` syntax -->
import variables from './../variables.json';

## a. Deploy Rasa X

Visit the [Installation Guide for Rasa X](https://rasa.com/docs/rasa-x/installation-and-setup/installation-guide) where you can learn about available installation methods and
how to deploy Rasa X by following one of them.

## b. Connect Rasa Open Source deployment to Rasa X

Visit the [Connect Rasa Open Source deployment](https://rasa.com/docs/rasa-x/installation-and-setup/deploy#2-connect-rasa-open-source-deployment-the-rasa-helm-chart) section to learn how to connect your Rasa Assistant to Rasa X deployment.
263 changes: 263 additions & 0 deletions docs/docs/deploy/deploy-rasa.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
---
id: deploy-rasa
sidebar_label: "Deploy Rasa Open Source"
title: "Deploy Rasa Open Source"
description: Deploy a Rasa assistant on Kubernetes/Openshift using Helm
abstract: This page explains how to deploy Rasa Open Source using Helm.
---
<!-- this file is version specific, do not use `@site/...` syntax -->
import variables from './../variables.json';

:::note
The Rasa Helm chart is open source and available in the
[helm-charts repository](https://github.com/rasahq/helm-charts).
Please
[create an issue](https://github.com/RasaHQ/helm-charts/issues/new) in this
repository if you discover bugs or have suggestions for improvements.

:::


## Installation Requirements

1. Check that you have installed the Kubernetes or OpenShift command line
interface (CLI). You can check this using the following command:

<Tabs groupId="kubernetes-dist" values={[{"label": "Kubernetes", "value": "kubernetes"}, {"label": "OpenShift", "value": "openshift"}]} defaultValue="kubernetes">
<TabItem value="kubernetes">

```bash
kubectl version --short --client

# The output should be similar to this
# Client Version: v1.19.11
```

</TabItem>
<TabItem value="openshift">

```bash
oc version --client

# The output should be similar to this
# Client Version: 4.7.13
```

</TabItem>
</Tabs>

If this command resulted in an error, please install the
[Kubernetes CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/) or the
[OpenShift CLI](https://docs.openshift.com/container-platform/4.7/cli_reference/openshift_cli/getting-started-cli.html#installing-openshift-cli)
depending on the cluster you’re using.

2. Make sure that the Kubernetes / OpenShift CLI is correctly connected to
your cluster. You can do so by using the following commands:

<Tabs groupId="kubernetes-dist" values={[{"label": "Kubernetes", "value": "kubernetes"}, {"label": "OpenShift", "value": "openshift"}]} defaultValue="kubernetes">
<TabItem value="kubernetes">

```bash
kubectl version --short

# The output should be similar to this
# Client Version: v1.19.11
# Server Version: v1.19.10
```

</TabItem>
<TabItem value="openshift">

```bash
oc version

# The output should be similar to this
# Client Version: 4.7.13
# Kubernetes Version: v1.20.0+df9c838
```

</TabItem>
</Tabs>

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.

3. Make sure you have the [Helm CLI](https://helm.sh/docs/intro/install/)
installed. To check this, run:

```bash
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](https://helm.sh/docs/intro/install/).

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 Open Source in a separate
[namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/)
to avoid interfering with existing cluster deployments. To create a new namespace
run the following command:

<Tabs groupId="kubernetes-dist" values={[{"label": "Kubernetes", "value": "kubernetes"}, {"label": "OpenShift", "value": "openshift"}]} defaultValue="kubernetes">
<TabItem value="kubernetes">

```bash
kubectl create namespace <your namespace>
```

</TabItem>
<TabItem value="openshift">

```bash
oc create namespace <your namespace>
```

</TabItem>
</Tabs>

### 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](https://github.com/RasaHQ/helm-charts/tree/main/charts/rasa#values).

:::note
The default configuration of the Rasa chart deploys a Rasa Open Source Server, downloads a model, and serves the downloaded model.
Visit [the Rasa helm chart repository](https://github.com/RasaHQ/helm-charts/tree/main/charts/rasa#quick-start) 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 an 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:

```yaml
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](https://github.com/RasaHQ/helm-charts/blob/main/examples/rasa/train-model-helmfile.yaml).

### 4. Deploy Rasa Open Source Assistant

Run the following commands:

```bash
# Add the repository which contains the Rasa Helm chart
helm repo add rasa https://helm.rasa.com

# Deploy Rasa Open Source
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:

```yaml
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:

<Tabs groupId="kubernetes-dist" values={[{"label": "Kubernetes", "value": "kubernetes"}, {"label": "OpenShift", "value": "openshift"}]} defaultValue="kubernetes">
<TabItem value="kubernetes">

```bash
kubectl --namespace <your namespace> \
wait \
--for=condition=available \
--timeout=20m \
--selector app.kubernetes.io/instance=<release name> \
deployment
```

</TabItem>
<TabItem value="openshift">

```bash
oc --namespace <your namespace> \
wait \
--for=condition=available \
--timeout=20m \
--selector app.kubernetes.io/instance=<release name> \
deployment
```

</TabItem>
</Tabs>

:::


### 5. Access Rasa Open Source Assistant

By default the Rasa deployment is exposed via the `rasa` (`<release name>`) service and accessible only within a Kubernetes cluster. You can get
the IP address using this command:

<Tabs groupId="kubernetes-dist" values={[{"label": "Kubernetes", "value": "kubernetes"}, {"label": "OpenShift", "value": "openshift"}]} defaultValue="kubernetes">
<TabItem value="kubernetes">

```bash
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} &
```

</TabItem>
<TabItem value="openshift">

```bash
export SERVICE_PORT=$(oc get --namespace <your namespace> -o jsonpath="{.spec.ports[0].port}" services <release name>)
oc port-forward --namespace <your namespace> svc/<release name> ${SERVICE_PORT}:${SERVICE_PORT} &
```

</TabItem>
</Tabs>

You can then access the deployment on `http://127.0.0.1:${SERVICE_PORT}`

Visit [the Rasa helm chart README](https://github.com/RasaHQ/helm-charts/tree/main/charts/rasa#exposing-the-rasa-deployment-to-the-public) to learn other ways to expose your deployment.

## Next Steps

- Visit [the Rasa helm chart repository](https://github.com/RasaHQ/helm-charts/tree/main/charts/rasa) where you can find examples of configuration
- Visit [the Rasa X docs](https://rasa.com/docs/rasa-x/) and learn how to [integrate your Rasa Open Source deployment with Rasa X](https://rasa.com/docs/rasa-x/installation-and-setup/deploy#2-connect-rasa-open-source-deployment-the-rasa-helm-chart).
54 changes: 54 additions & 0 deletions docs/docs/deploy/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
id: introduction
sidebar_label: Introduction
title: Deploying a Rasa Assistant
description: How to deploy your Rasa Assistant with Kubernetes/Openshift
abstract: This section explains when and how to deploy an assistant built with Rasa.
It will allow you to make your assistant available to users and set you up with a production-ready environment.
---
<!-- this file is version specific, do not use `@site/...` syntax -->
import variables from './../variables.json';

:::note
Are you unfamiliar with Docker, Kubernetes and Helm? Check out "[Understanding Rasa Deployments](https://www.youtube.com/watch?v=aAs_RS0ueEw&list=PL75e0qA87dlHmfmu7oPPYA22fmc6GJ2aW)" on our [YouTube channel](https://www.youtube.com/channel/UCJ0V6493mLvqdiVwOKWBODQ).
:::

## When to Deploy Your Assistant

The best time to deploy your assistant and make it available to test users is once it can handle the most
important happy paths or is what we call a [minimum viable assistant](../glossary.mdx). Then you can use incoming
conversations to inform further development of your assistant.

Connecting your deployed assistant to Rasa X makes it easy to share your assistant
with test users via the [share your assistant feature in
Rasa X](https://rasa.com/docs/rasa-x/user-guide/share-assistant#share-your-bot).
Then, when you're ready to make your assistant available via one or more [Messaging and Voice Channels](../messaging-and-voice-channels.mdx),
you can add them to your existing deployment set up.
See the [Rasa X Installation Guide](https://rasa.com/docs/rasa-x/installation-and-setup/installation-guide/) to learn how to deploy Rasa X and connect it to your Rasa Open Source deployment.


## Recommended Deployment Method
The [Rasa Helm chart](https://github.com/RasaHQ/helm-charts/tree/main/charts/rasa) is the production ready method to deploy
your assistant on a Kubernetes or Openshift cluster. For details, see the [deployment instructions](./deploy-rasa.mdx).

### Cluster Requirements

To install the Rasa Helm chart, you need an existing
[Kubernetes cluster](https://kubernetes.io/) or [OpenShift cluster](https://www.openshift.com/).
If you don't have one yet, you can get a managed cluster from a cloud provider like:
* [Google Cloud](https://cloud.google.com/kubernetes-engine),
* [DigitalOcean](https://www.digitalocean.com/products/kubernetes/),
* [Microsoft Azure](https://azure.microsoft.com/en-us/services/kubernetes-service/), or
* [Amazon EKS](https://aws.amazon.com/eks/).

If you are looking for a lightweight, non-production cluster that can run on a single machine, check out the instructions for using [Rasa Ephemeral Installer (REI)](../rei/deploy.mdx). REI will help you set up a local Kubernetes cluster on which you can deploy your assistant using the Rasa Helm chart.

## Alternative Deployment Methods

The following deployment methods are not suited to a production deployment, but can be useful for development and testing:

* [Running an assistant locally on the command line](../command-line-interface.mdx#rasa-run)

* [Developing an assistant in a Docker container](../docker/building-in-docker.mdx)

* [Deploying an assistant with Docker Compose](../docker/deploying-in-docker-compose.mdx)
5 changes: 2 additions & 3 deletions docs/docs/docker/building-in-docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import variables from '../variables.json';

If you don't have a Rasa project yet, you can build one in Docker without having to install Rasa Open Source
on your local machine. If you already have a model you're satisfied with, see
[Deploying Your Rasa Assistant](../how-to-deploy.mdx) to learn how to deploy your model.
[Deploying a Rasa Assistant](../deploy/introduction.mdx) to learn how to deploy your model.

## Installing Docker

Expand Down Expand Up @@ -261,5 +261,4 @@ docker rm action-server

Work on your bot until you have a minimum viable assistant that can handle your happy paths. After
that, you'll want to deploy your model to get feedback from real test users. To do so, you can deploy the
model you created with Rasa X via one of our [recommended deployment methods](../how-to-deploy.mdx#recommended-deployment-methods).
Or, you can do a [Rasa-only deployment in Docker Compose](./deploying-in-docker-compose.mdx).
model you created via one of our [recommended deployment methods](../deploy/introduction.mdx#recommended-deployment-method).
5 changes: 1 addition & 4 deletions docs/docs/docker/deploying-in-docker-compose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ description: Use Docker Compose to deploy a Rasa Open Source assistant
<!-- this file is version specific, do not use `@site/...` syntax -->
import variables from '../variables.json';

If you would like to deploy your assistant without Rasa X, you can do so by deploying it in Docker Compose.
To deploy Rasa X and your assistant together, see the [Recommended Deployment Methods](../how-to-deploy.mdx#recommended-deployment-methods).

## Installing Docker

If you're not sure if you have Docker installed, you can check by running:
Expand Down Expand Up @@ -71,7 +68,7 @@ Each container is declared as a `service` within the `docker-compose.yml`.
The first service is the `rasa` service, which runs your Rasa server.

To add the action server, add the image of your action server code. To learn how to deploy
an action server image, see [Building an Action Server Image](../how-to-deploy.mdx#building-an-action-server-image).
an action server image, see [Building an Action Server Image](https://rasa.com/docs/action-server/deploy-action-server#building-an-action-server-image).

<pre><code parentName="pre" className="language-yaml">
{`version: '3.0'
Expand Down
Loading