Docker Compose Installation

In this installation method, Rasa X is deployed on a server as a set of Docker containers.

An install script is available for servers that meet the hardware and OS requirements. For other operating systems, you can install Rasa X via Docker Compose manually.

Requirements

Note

Rasa X is intended to be deployed on a server and not to a personal/local machine. Deploying on a server is recommended because Rasa X is designed to stay up continuously, and not to be frequently stopped or restarted.

Hardware & OS Requirements

Here are the minimum and recommended hardware specs and OS requirements:

Install Script

Manual Installation

Operating System

  • Ubuntu 16.04 / 18.04 / 19.10

  • Debian 9 / 10

  • CentOS 7 / 8

  • RHEL 8

a modern Linux or Windows distribution that can run Docker

vCPUs

  • Minimum: 2 vCPUs

  • Recommended: 2-6 vCPUs

RAM

  • Minimum: 4 GB RAM

  • Recommended: 8 GB RAM

Disk Space

  • Recommended: 100 GB disk space available

Port Requirements

When creating the server, make sure the following ports of are open:

Port

Service

Description

22

SSH

SSH access.

80

HTTP

Web application access.

443

HTTPS

Web application over HTTPS access (optional)

Supported Browsers

The web interface aims to support browsers that meet the following criteria:

  • > 0.2% market share

  • not Internet Explorer

  • not Opera Mini


Docker Compose Install Script

Watch the Rasa Masterclass video below to follow along with the install script instructions:

If you have a Rasa Enterprise license, please see the Enterprise instructions where applicable.

1. Download

Download the install script:

  1. Download the install script on the server:

curl -sSL -o install.sh https://storage.googleapis.com/rasa-x-releases/0.30.1/install.sh
  1. Copy your enterprise license to your server:

    scp rasa-x-ee-license.yml example.com:~/rasa-x-ee-license.yml
    

    Make sure the license is in your working directory on the server before proceeding to the next step.

  2. Download the install script on the server:

    curl -sSL -o install.sh https://storage.googleapis.com/rasa-x-releases/0.30.1/install.sh

2. Install

To install all of the files into the default folder, /etc/rasa, run:

sudo bash ./install.sh

You will be prompted to accept the terms and conditions. Read the terms, then hit return to continue.

Note

To choose your own installation folder instead of /etc/rasa, set the RASA_HOME environment variable:

export RASA_HOME=~/rasa/dir
sudo -E bash ./install.sh  # -E will preserve the environment variable you set

Replace /etc/rasa with ${RASA_HOME} in further commands.

3. Start

Start up Rasa X and wait until all containers are running (-d will run Rasa X in the background):

cd /etc/rasa
sudo docker-compose up -d

4. Access

Set your admin password:

Set your admin password with this command:

cd /etc/rasa
sudo python rasa_x_commands.py create --update admin me <PASSWORD>

Create an admin user with a username and a password:

cd /etc/rasa
sudo python rasa_x_commands.py create admin <USER> <PASSWORD>

While using Rasa Enterprise, you can use this command on the server to create a new admin account at any time. See Role-Based Access Control for more information about assigning and configuring user permissions.

Navigate to the hostname or IP where your server is reachable and log in using your newly created password.


Docker Compose Manual Install

We provide template docker-compose files which you can use directly. The Docker images for Rasa X are freely available via Docker Hub. The images for Rasa Enterprise are hosted on a private registry and are accessible with an enterprise license. If you have a Rasa Enterprise license, please see the Enterprise instructions where applicable.

1. Prerequisites

Make sure python3, docker, and docker-compose are installed on your server. Detailed instructions can be found in the Docker documentation.

You should be able to run the following command(s):

python3 --version && docker -v && docker-compose -v
python3 --version
docker -v
docker-compose -v

Make sure that you can run Linux containers:

docker run hello-world:linux

Note that your python version should be above 3.6 to use Rasa and Rasa X.

2. Set Project Directory

Create the project directory and switch to it:

For example, /etc/rasa

mkdir /etc/rasa
cd /etc/rasa

For example, C:\etc\rasa

New-Item C:\etc\rasa -ItemType Directory
Set-Location -Path C:\etc\rasa

Note

File sharing for the drive, in this example the C drive, must be turned on in Docker.

3. Download

Download the Rasa X docker-compose and commands files:

wget -qO docker-compose.yml https://storage.googleapis.com/rasa-x-releases/0.30.1/docker-compose.ce.yml
wget -qO rasa_x_commands.py https://storage.googleapis.com/rasa-x-releases/0.30.1/rasa_x_commands.py
Invoke-WebRequest -OutFile docker-compose.yml -Uri https://storage.googleapis.com/rasa-x-releases/0.30.1/docker-compose.ce.yml
Invoke-WebRequest -OutFile rasa_x_commands.py -Uri https://storage.googleapis.com/rasa-x-releases/0.30.1/rasa_x_commands.py
wget -qO docker-compose.yml https://storage.googleapis.com/rasa-x-releases/0.30.1/docker-compose.ee.yml
wget -qO rasa_x_commands.py https://storage.googleapis.com/rasa-x-releases/0.30.1/rasa_x_commands.py
Invoke-WebRequest -OutFile docker-compose.yml -Uri https://storage.googleapis.com/rasa-x-releases/0.30.1/docker-compose.ee.yml
Invoke-WebRequest -OutFile rasa_x_commands.py -Uri https://storage.googleapis.com/rasa-x-releases/0.30.1/rasa_x_commands.py

Create the authentication file to download the Rasa X containers from a private Docker registry.:

  1. Create a file gcr-auth.json in your project directory that contains the JSON of the docker_registry_license key from your rasa-x-ee-license.yml file.

    Make sure to copy the entire contents of the docker_registry_license key.

    The contents of gcr-auth.json should look like this:

    {
    "type": "service_account",
    "project_id": "rasa-platform",
    "private_key_id": "sdferw234qadst423qafdgxhw",
    "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvfwrt423qwadsfghtzw0BAQEFAASCBKgwggSkAgEAAoIBAQCgt338FkWbW13dghtzew4easdf5wAi15jrA9t4uOk8dghrtze4weasfgdhtAFZNfrLgvr2\nPBTu1lAJDLo136ZGTdMKi+/TuRqrIMg/sr8q0Ungish8v6t5Jb4gsjBi9StytCT4\nhWXDL3qeadfsgeDOudl6c3iMzylBws+VffrFfaZWjDpGtxmlYwIUa2e\noNSe7BYLnY9tDrX3zrP/wu/6FPbbGkBjguDG1l3Kx7l1wmiPtK5lIhjt+k7Oyx/u\nd6+gvfs+7RX9wUxnZT/tLggybYdsr8BA1Pqr0hDmhdDl7tjXVTmGLG+1/+lXVGFc\nqKEg+uLXAgMBAAECggEAESzwRK0Cp62LgBjInk+jvTmMI4lYP/XTnfk0TNwyiLxd\nT7mkw/TzkSVRifZ37lBQ6BS6BiqBJherh1N4xI+DF9HUN/wHR93QTyu7p8umlcxC\nlPV0KE4b5ZMfWvRG4y236cRGly9urcBNGoFzFHl8pd2iS5DMqZOYpSXY+qvkXTKE\nUOm5mVSs4S4Qa9cHL+jWXCvY0789fG1GrT+L3Fn+StKacgQuBnN1krYFYBSjCAh8\nsnSdjkvGguw/6OApPHd8HqkHtjU0PD67uU5QIm5N1bmz9KT4s9Pm+WbCinEstIiN\nIfln5ikmHcMAiIS0gzSnZavsY21PsDHBkD8SUO7CTQKBgQDgMPhx0TsB/oVH/SnU\nt3oTME+tfAKI69tozX02jHj6DY/vDpI1hXNmb4oMOos5+3ulborHqnso9za1RgV7\nm2N04QQVfzYEuZzJzXL11SHvBYVjHkXYy6HR5GhnPmwA+CzrDNy2/oYxlaqH7TBA\nR+f7IHToIPKGCVrhCJztlAgzIwKBgQC3hQNclIQ5Iw0gm9Rr8zAP/YoRJdiUSYtv\nNBmav+dTTSkPh51Bomj/J4Rrg8OLvHG5U79pmzbQdIFGYGKlR0l4/QepKpbaGm7x\nM/gRp/GXu9sN8LgI+h+FskCYi4cuqDjQ9L2S0gwMre4witmeVSIiBxLWxS7mvkZX\nWRW58ml2vQKBgBozPuW2SQobn6HhIUFdy+NwMu+YXYd44ORnl2mHkx/N8/NBJa8h\nkHH5OQ3izaCSFkooGAnrj4cjFP6sVzmx2DaxkVOd0UdOFdezreqy5MtVPthtkkYa\nzieEZPsj3WVjm4RAtY6hQjeLQSmve4MXpDHCAkeaih1F/Jvt8MEHGso3AoGBAJez\nTioTYpFQliNkbN2nMw2kyaKPJE6/1JDiAmBXTcMgP1blBWsh86UnZ2DwlI5IAcHu\npoWHlnIOPGaOejyhhuyKTPDbkcNMonSkPuVpbF2/Hb6SQ664A6KizJ7Mh7xbtkuU\nY7igBPHePMzHmkg1m3eBXWNHsBNxKfg+XaVN6zwJAoGBAN6VhGMmyDcn0GqkkP6d\nrSsQ0Ig7L4PnU633oYWoGWa8q/XYiFbcACMFynMbrmHG+/0c3Iwt32bi3th60Cwb\nT66yqmv4MaT72+EfQHxiLxnUxhqSpBXM0eoXbyvDg97Zp/slsYvGGLjONmmretlE\nsjAsuAH4Iz1XdfdenzGnyBZH\n-----END PRIVATE KEY-----\n",
    "client_email": "company@rasa-platform.iam.gserviceaccount.com",
    "client_id": "114123456713428149",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://accounts.google.com/o/oauth2/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/company%40rasa-platform.iam.gserviceaccount.com"
    }
    
  2. Log in to the docker registry:

    sudo docker login  -u _json_key -p "$(cat /etc/rasa/gcr-auth.json)" https://gcr.io
    
    (Get-Content C:\etc\rasa\gcr-auth.json) | docker login  -u _json_key --password-stdin https://gcr.io
    

    which should return Login Succeeded.

4. Configure

Docker Environment File

Create the docker environment file .env in your project directory with the following content (choosing a RASA_VERSION compatible with your RASA_X_VERSION - see the Compatibility Matrix):

RASA_X_VERSION=<rasa_x_version>
RASA_VERSION=<rasa_version>
RASA_TOKEN=<random_string>
RASA_X_TOKEN=<random_string>
PASSWORD_SALT=<random_string>
JWT_SECRET=<random_string>
RABBITMQ_PASSWORD=<random_string>
DB_PASSWORD=<random_string>
REDIS_PASSWORD=<random_string>

For <random_string> please use a distinct, randomly generated, secure character sequence for each variable. A convenient way of generating random strings is using openssl:

openssl rand -base64 16

For more information about these environment variables and others used by Rasa X, see Environment Variables.

Note

The PASSWORD_SALT is used to hash passwords. If you change this variable after setting it, you will have to create new logins for each of your users.

Credentials

Create a credentials file credentials.yml in your project directory containing:

rasa:
   url: ${RASA_X_HOST}/api

These are the credentials used for messaging with the bot via the Rasa X UI. You can also add credentials for other messaging and voice channels such as your custom connector or the REST input channel.

Endpoints

Create an endpoints file endpoints.yml in your project directory containing:

models:
   url: ${RASA_MODEL_SERVER}
   token: ${RASA_X_TOKEN}
   wait_time_between_pulls: ${RASA_MODEL_PULL_INTERVAL}
tracker_store:
   type: sql
   dialect: "postgresql"
   url: ${DB_HOST}
   port: ${DB_PORT}
   username: ${DB_USER}
   password: ${DB_PASSWORD}
   db: ${DB_DATABASE}
   login_db: ${DB_LOGIN_DB}
lock_store:
   type: "redis"
   url: ${REDIS_HOST}
   port: ${REDIS_PORT}
   password: ${REDIS_PASSWORD}
   db: ${REDIS_DB}
event_broker:
   type: "pika"
   url: ${RABBITMQ_HOST}
   username: ${RABBITMQ_USERNAME}
   password: ${RABBITMQ_PASSWORD}
   queue: ${RABBITMQ_QUEUE}
action_endpoint:
   url: ${RASA_USER_APP}/webhook
   token: ""

If you want to know more about the environment variables used here, see Environment Variables.

Deployment Environments

Create an environments file at environments.yml in your project directory containing:

rasa:
   production:
      url: http://rasa-production:5005
      token: ${RASA_TOKEN}
   worker:
      url: http://rasa-worker:5005
      token: ${RASA_TOKEN}

If you are using Rasa Enterprise, you can also add further environments as described in Deployment Environments.

Mounted Directories

Create a few empty folders that we will mount into the containers:

mkdir /etc/rasa/auth
mkdir /etc/rasa/certs
mkdir /etc/rasa/credentials
mkdir /etc/rasa/models
mkdir /etc/rasa/logs
mkdir /etc/rasa/terms
mkdir /etc/rasa/db
New-Item -ItemType Directory C:\etc\rasa\auth
New-Item -ItemType Directory C:\etc\rasa\certs
New-Item -ItemType Directory C:\etc\rasa\credentials
New-Item -ItemType Directory C:\etc\rasa\models
New-Item -ItemType Directory C:\etc\rasa\logs
New-Item -ItemType Directory C:\etc\rasa\terms

Note

On Windows, you do not create a local directory for Postgres database persistence. Instead, you will define a docker volume in a docker-compose.override.yml.

Terms

Read the Rasa Enterprise terms or Rasa X terms. To agree to the terms, create an agreement file in the terms folder:

touch /etc/rasa/terms/agree.txt
New-Item -ItemType file C:\etc\rasa\terms\agree.txt

Permissions on Mounted Directories

Set group and permissions of the mounted directories:

The Rasa containers are following Docker’s best practices and are not running as root user. Hence, please make sure that the root group has read and write access to the following directories and their content:

  • /etc/rasa/credentials.yml

  • /etc/rasa/endpoints.yml

  • /etc/rasa/environments.yml

  • /etc/rasa/auth

  • /etc/rasa/certs

  • /etc/rasa/credentials

  • /etc/rasa/models

  • /etc/rasa/logs

  • /etc/rasa/terms

To set the permissions and group for everything in /etc/rasa you can use this command, but make sure to correct it for the /etc/rasa/db directory as described in the next step:

sudo chgrp -R root /etc/rasa/* && sudo chmod -R 770 /etc/rasa/*

If you are mounting different or extra directories, please adapt their permissions accordingly.

You can skip this step on Windows

Postgres Database Storage

Configure persistent Postgres database storage

On Linux, a local directory is used for persistent Postgres database storage.

You must set the correct owner and permissions of the database persistence directory using this command:

sudo chown -R 1001 /etc/rasa/db && sudo chmod -R 750 /etc/rasa/db

On Windows, a docker volume is used for persistent Postgres database storage.

To avoid your changes in the docker-compose file being overwritten with the next update, you should not apply your changes to docker-compose.yml. Instead, create a new file called docker-compose.override.yml and apply your changes there. Docker will automatically take that file into account and override any attributes in docker-compose.yml with changes from the override file.

The content of docker-compose.override.yml in your project directory:

version: "3.4"

services:
db:
   volumes:
      - db-volume:/bitnami/postgresql

volumes:
db-volume:
   name: db-volume

(Optional) Custom Action Server

If you are using custom actions, make sure to follow the instructions to connect a custom action server.

If you don’t want to configure custom actions yet, make sure to add this variable to your .env to use the demo app image:

RASA_X_DEMO_VERSION=<rasa_x_version>

5. Start

Start up Rasa X and wait until all containers are running (-d will run Rasa X in the background):

sudo docker-compose up -d
docker-compose up -d

6. Access

Set your admin password with this command from your project directory:

sudo python rasa_x_commands.py create --update admin me <PASSWORD>
python rasa_x_commands.py create --update admin me <PASSWORD>
sudo python rasa_x_commands.py create admin <USER> <PASSWORD>
python rasa_x_commands.py create admin <USER> <PASSWORD>

While using Rasa Enterprise, you can use this command on the server to create a new admin account at any time. See Role-Based Access Control for more information about assigning and configuring user permissions.

Navigate to the hostname or IP where your server is reachable and log in using your newly created password.

Next Steps