# Installation

This page contains detailed instructions for installing Rasa X in a scalable cluster environment using OpenShift or Kubernetes (K8S).

Rasa X is available as a [Helm Chart](https://helm.sh/) for a cluster setup. If you are not using Helm in your cluster, you can still use the following instructions to generate the Kubernetes or OpenShift object configurations via the Helm command-line interface and install those configurations manually.

## Installation

### 1. Create Namespace

We recommend installing Rasa X 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:

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

### 2. Create Values File

Prepare an empty file called `values.yml` which will include all your custom configuration for the installation with Helm.

### 3. Configure Credentials

To configure the credentials, copy the section below into the `values.yml` file and replace each `<safe credential>` marker with a different alphanumeric string. Please use safe credentials to avoid data breaches.

```yaml
# rasax specific settings
rasax:
  initialUser:
    username: "<username>"
    password: "<safe credential>"
    passwordSalt: "<safe credential>"
    token: "<safe credential>"
    jwtSecret: "<safe credential>"
rasa:
  token: "<safe credential>"
rabbitmq:
  auth:
    password: "<safe credential>"
global:
  postgresql:
    postgresqlPassword: "<safe credential>"
  redis:
    password: "<safe credential>"
```

### 4. Specify Rasa X and Rasa Open Source Versions

You can install the latest stable Rasa X version and the latest Rasa Open Source version by specifying the following in your `values.yml`:

```yaml
# rasax specific settings
rasax:
  tag: "1.0.4"
rasa:
  tag: "2.8.31-full"
```

To install the latest edge release of Rasa X instead, set the `latest` tag for Rasa X:

```yaml
# rasax specific settings
rasax:
  tag: "latest"
rasa:
  tag: "2.8.31-full"
```

You can also choose any compatible Rasa X and Rasa Open Source versions according to the [Compatibility Matrix](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/changelog/compatibility-matrix).

### 5. **Optional**: Configure Custom Action Server

See [these instructions](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/customize#adding-a-custom-action-server) to configure a custom action server.

### 6. Deploy Rasa X

Run the following commands:

```bash
# Add the repository which contains the Rasa X Helm chart
helm repo add rasa-x https://rasahq.github.io/rasa-x-helm

# Deploy Rasa X
helm install \
  --generate-name \
  --namespace <your namespace> \
  --values values.yml \
  rasa-x/rasa-x
```

Then wait until the deployment is ready. If you want to check on its status, the following command will block until the Rasa X deployment is ready:

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

### 7. Access Rasa X

By default the Rasa X deployment is exposed via the `nginx` service. You can get the IP address using this command:

```bash
kubectl --namespace <your namespace> \
  get service \
  -l app.kubernetes.io/component=nginx \
  -o jsonpath="{.status.loadBalancer.ingress[0].ip}"
```

You can then access the deployment on `http://<ip>:8000`

### 8. **Optional**: Activate Rasa Enterprise

Rasa X can be upgraded to **Rasa Enterprise** by uploading a valid license. To learn how to do this, please visit the [Product Activation](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/enterprise/activation) section.

## Reference

### Accessing Secrets

This section describes how to retrieve secrets from your running deployment. You have the option to retrieve the following secrets:

| description | default secret name |
| --- | --- |
| PostgreSQL database password | `postgresql` |
| Redis lock store and cache password | `redis` |
| RabbitMQ event broker password | `rabbit` |

Run the following command, replacing `<secret name>` with one of the values in the table, and `<your namespace>` and `<your release name>` with your namespace and the name of your release:

```bash
secret=<secret name>
namespace=<your namespace>
release_name=<your release name>

kubectl --namespace ${namespace} \
  get secret ${release_name}-${secret} -o yaml | \
  awk -F ': ' '/password/{print $2}' | base64 -d
```

### Accessing Logs

This section describes how to get logs from the running containers.

1. Get the name of the [pod](https://kubernetes.io/docs/concepts/workloads/pods/pod/) which you want to get the logs of.

```bash
   kubectl --namespace <your namespace> \
     get pods
   ```

2. To get the logs of the container run:

```bash
   kubectl --namespace <your namespace> \
     logs <name of the pod>
   ```

### Using Helm to Generate Object Configurations

If you don’t want or cannot use Helm to install Rasa X in your cluster, you can still use Helm to generate the Kubernetes / OpenShift resource files.

1. Follow the [installation instructions](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/install/helm-chart-installation/installation/#installation) until the deployment part.

2. Run the following command to generate the Kubernetes / OpenShift resource files and write them in a file `rasa-x-deployment.yml`:

```bash
   helm repo add rasa-x https://rasahq.github.io/rasa-x-helm
   helm repo update
   helm template \
     --namespace <your namespace> \
     --values values.yml \
     <your release name> \
     rasa-x/rasa-x > rasa-x-deployment.yml
   ```

3. You can then deploy these manually by running:

```bash
   kubectl --namespace <your namespace> \
     create -f rasa-x-deployment.yml
   ```

## Next Steps

- [Connect a Custom Action Server](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/customize#adding-a-custom-action-server) if you are using custom actions.
- [Set up Integrated Version Control](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/deploy#integrated-version-control) to connect your Rasa X instance to a remote Git repository.
- [Deploy your assistant](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/deploy#how-to-deploy) using Rasa X.
- [Configure SSL](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/installation-and-setup/customize#using-https) if you’d like to run your Rasa X server on HTTPS.
