##### License Terms

For the use of Rasa X the [Rasa X License Terms](https://storage.googleapis.com/rasa-x-releases/rasa_x_ce_license_agreement.pdf) apply.
For the use of Rasa Enterprise the [Rasa Enterprise License Terms](https://storage.googleapis.com/rasa-x-releases/rasa_x_ee_license_agreement.pdf) apply.

##### Warning

This installation method is deprecated and will be removed with Rasa X 1.1 release.

## MacOS and Linux Installation

You can install Rasa X on your local machine with:

```bash
pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple
```

##### Installing Edge vs. Stable

The above command will install the stable version of Rasa X. To install the latest edge version, use:

```bash
pip3 install rasa-x --pre --extra-index-url https://pypi.rasa.com/simple
```

## Run

From your Rasa assistant's project directory, start it with

```bash
rasa x
```

This should open a browser tab to `http://localhost:5002`.

## Windows Installation

### Prerequisites

- [WLS 2 (Windows Subsystem for Linux)](https://docs.microsoft.com/en-us/windows/wsl/)
- Docker with WSL2 backend

##### Note

To configure Docker with WSL2 backend, please follow [this](https://docs.docker.com/docker-for-windows/wsl/) guide.

WSL 2 provides a Linux shell on Windows. You can use either PowerShell or Linux Shell to launch Rasa X local mode.

##### Note

The Docker solution only supports Windows with WSL2 enabled. For Windows Server and Windows desktop which don't support WSL2, please check out other installation methods.

## Run using Docker

From your Rasa assistant's project directory, start Rasa X with

- Linux
- Windows PowerShell

```bash
docker run --rm -v $(pwd):/app -p 5002:5002 --entrypoint rasa rasa/rasa-x:latest x
```

This should give you a URL to Rasa X. Copy the URL and open it with your browser.

## Configure Settings

By default, Rasa X will auto-generate a password for you that will be available in the logs. You can set a specific password for Rasa X via the `RASA_X_PASSWORD` environment variable. For example:

```bash
export RASA_X_PASSWORD="my-secure-password"
rasa x
```

The following arguments can also be used to adapt the server settings:

```bash
usage: rasa x [-h] [-v] [-vv] [--quiet] [-m MODEL] [--data DATA [DATA ...]]
              [-c CONFIG] [-d DOMAIN] [--no-prompt] [--production]
              [--rasa-x-port RASA_X_PORT] [--config-endpoint CONFIG_ENDPOINT]
              [--log-file LOG_FILE] [--endpoints ENDPOINTS] [-p PORT]
              [-t AUTH_TOKEN] [--cors [CORS [CORS ...]]] [--enable-api]
              [--response-timeout RESPONSE_TIMEOUT]
              [--remote-storage REMOTE_STORAGE]
              [--ssl-certificate SSL_CERTIFICATE] [--ssl-keyfile SSL_KEYFILE]
              [--ssl-ca-file SSL_CA_FILE] [--ssl-password SSL_PASSWORD]
              [--credentials CREDENTIALS] [--connector CONNECTOR]
              [--jwt-secret JWT_SECRET] [--jwt-method JWT_METHOD]
```

optional arguments:

-h, --help           show this help message and exit

-m MODEL, --model MODEL
  Path to a trained Rasa model. If a directory is specified, it will use the latest model in this directory. (default: models)

--data DATA [DATA ...]
  Paths to the files or directories containing stories and Rasa NLU data. (default: data)

-c CONFIG, --config CONFIG
  The policy and NLU pipeline configuration of your bot. (default: config.yml)

-d DOMAIN, --domain DOMAIN
  Domain specification. This can be a single YAML file, or a directory that contains several files with domain specifications in it. (default: domain.yml)

--no-prompt          Automatic yes or default options to prompts and oppressed warnings. (default: False)

--production          Run Rasa X in a production environment. (default: False)

--rasa-x-port RASA_X_PORT
  Port to run the Rasa X server at. (default: 5002)

--config-endpoint CONFIG_ENDPOINT
  Rasa X endpoint URL from which to pull the runtime config. This URL typically contains the Rasa X token for authentication. Example:
  `https://example.com/api/config?token=my_rasa_x_token` (default: None)

--log-file LOG_FILE
  Store logs in specified file. (default: None)

--endpoints ENDPOINTS
  Configuration file for the model server and the connectors as a yml file. (default: endpoints.yml)

Python Logging Options:

-v, --verbose        Be verbose. Sets logging level to INFO. (default: None)

-vv, --debug         Print lots of debugging statements. Sets logging level to DEBUG. (default: None)

--quiet              Be quiet! Sets logging level to WARNING. (default: None)

Server Settings:

-p PORT, --port PORT
  Port to run the server at. (default: 5005)

-t AUTH_TOKEN, --auth-token AUTH_TOKEN
  Enable token based authentication. Requests need to provide the token to be accepted. (default: None)

--cors [CORS [CORS ...]]
  Enable CORS for the passed origin. Use * to whitelist all origins. (default: None)

--enable-api         Start the web server API in addition to the input channel. (default: False)

--response-timeout RESPONSE_TIMEOUT
  Maximum time a response can take to process (sec). (default: 3600)

--remote-storage REMOTE_STORAGE
  Set the remote location where your Rasa model is stored, e.g. on AWS. (default: None)

--ssl-certificate SSL_CERTIFICATE
  Set the SSL Certificate to create a TLS secured server. (default: None)

--ssl-keyfile SSL_KEYFILE
  Set the SSL Keyfile to create a TLS secured server. (default: None)

--ssl-ca-file SSL_CA_FILE
  If your SSL certificate needs to be verified, you can specify the CA file using this parameter. (default: None)

--ssl-password SSL_PASSWORD
  If your ssl-keyfile is protected by a password, you can specify it using this paramer. (default: None)

Channels:

--credentials CREDENTIALS
  Authentication credentials for the connector as a yml file. (default: None)

--connector CONNECTOR
  Service to connect to. (default: None)

JWT Authentication:

--jwt-secret JWT_SECRET
  Public key for asymmetric JWT methods or shared secret for symmetric methods. Please also make sure to use --jwt-method to select the method of the signature, otherwise this argument will be ignored. Note that this key is meant for securing the HTTP API. (default: None)

--jwt-method JWT_METHOD
  Method used for the signature of the JWT authentication payload. (default: HS256)

## Share your bot in local mode

In order to [share your bot](https://legacy-docs-enterprise.rasa.com/docs/rasa-enterprise/1.0.x/user-guide/share-assistant#share-your-bot) you’ll need to make your locally running Rasa X server available to external traffic. You can do this using [ngrok](https://ngrok.com/product).

You can [download and install](https://ngrok.com/download) ngrok for free. Once it is installed, open a new terminal window and run:

```bash
ngrok http 5002
```

This will create a public HTTPS url for your locally running Rasa X server, given that it is running at the default port (if not, change the command above).

You should see something like this:

```bash
Session Status online
Session Expires 7 hours, 59 minutes
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4041
Forwarding http://831897ef2f98.ngrok.io -> http://localhost:5002
Forwarding https://831897ef2f98.ngrok.io -> http://localhost:5002
Connections ttl opn rt1 rt5 p50 p90
000.000.00000000
```

To share your bot, replace the `http://localhost:5002` portion of your Share your Bot link with the https forwarding address from ngrok. Your link should then look something like this: `https://831897ef2f98.ngrok.io/guest/conversations/production/29fbd34c2a06481f`.
