Configuring Databases¶
This page lists the compatible database versions for Rasa X and provides instructions on how to set up Rasa X to use Oracle as the database.
Compatible versions¶
Rasa X is officially compatible with the following databases:
PostgreSQL
Oracle >= 11.0
By default, Rasa X comes with a PostgreSQL container that is used as the database, however this can be configured to use an on-premise database or your own cloud provided database etc. Please check out the Environment Variables for how to configure Rasa X to use a non-default PostgreSQL database.
Oracle¶
Using Oracle as your Rasa X database instead of PostgreSQL requires some additional setup, which we’ll go over here.
Database Setup¶
In your Oracle database, create an empty database called rasa
and configure a user/password
that has access to it. You can also use a database with a different name, as long as it
is empty and you specify this in the DB_DATABASE
environment variable (read more
here).
Rasa X Configuration¶
Note
To use Oracle for the tracker store, please see the Rasa Open Source docs.
Next you have to extend the Rasa X image to include the necessary drivers and clients. First download
the Oracle Instant Client from here,
rename it to oracle.rpm
and store it in the directory from where you’ll be building the Docker image.
Copy the following into a file called Dockerfile
:
# if using community edition, please replace with rasa-x-ce FROM gcr.io/rasa-platform/rasa-x-ee:0.28.6 # Switch to root user to install packages USER root RUN apt-get update -qq && apt-get install -y --no-install-recommends alien libaio1 && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Copy in oracle instaclient # https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html COPY oracle.rpm oracle.rpm # Install the Python wrapper library for the Oracle drivers RUN pip install cx-Oracle # Install Oracle client libraries RUN alien -i oracle.rpm USER 1001
Then build the Docker image:
docker build . -t rasa/rasa-x:0.28.6-oracle
You can now use this image instead of the standard one, by replacing it in your
docker-compose.override.yml
file.
You will also have to configure the following environment variables for Rasa X
in order to connect to the database:
DB_USER="<user>" # username used for authentication
DB_PASSWORD="<password>" # password used for authentication
DB_DATABASE= "rasa" # path to your db
DB_DRIVER="oracle+cx_oracle"
DB_PORT="<port of db>" # Port of your SQL server
DB_HOST="<host of db>" # host of your Oracle server
DB_QUERY="<query>" # optional dictionary to be added as a query string to the connection URL
Alternatively, you can also directly pass the database connection URL to the container, by defining the DB_URL
variable:
DB_URL="oracle+cx_oracle://user:password@your.database.com:<port>/<database name>"