How can I change rasa x default databases to custom databases?

I am running rasa x for bot development but this creates two db files called tracker.db and rasa.db in the same directory. What do these two different dbs do?

How can I use different (remote) dbs for storing data when running rasa x? How can I used remote SQL databases to power rasa x?

Hi @psds01, the two different dbs are used to store the trackers for all conversations (tracker.db), as well as training data and other information required for to run the rasa X web interface.

Rasa X only supports sqlite when run from the command line. You can connect to remote database if you run rasa X on docker: Deploy to a Server

By default, this uses a containerised PostgreSQL database, but you could in principle connect to remote instances as well. You’d need to modify the tracker_store entry in endpoints.yml:

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}

I hope that helps!

@ricwo, say i run two containers, one for rasa-x and one for rasa-production, can i use two different endpoints.yml?

because i would like the rasa-x tracker store to be postgresql and for rasa-production be able to use redis as a tracker-store ? or can i use redis for both?

You can definitely use Redis for your tracker database by changing the tracker_store section of the yaml config. Check out our docs on Tracker Stores for details on how to configure a Redis tracker store.

Rasa X only works with SQL databases.

Yeah but can I use two tracker store, one for Rasa production running in one container and another endpoints.yml for running on Rasa x and then how do I make Tracker store migrations

I’m not sure I follow - Rasa X doesn’t keep a tracker store, only the Rasa production service does. Would you mind clarifying what you mean?

the Rasa X, does require a database to store conversations? I understood that the postgres for rasa X is used to store conversations because when i run rasa X in local, it creates rasa.db and tracker.db, i am assuming it is SQLite and rasa.db contains login information/rasa x data

In this case, I would like to replace the SQLite with postgres as done in the docker-compose but i would like that the rasa-production container uses Redis as it’s tracker store

Hi again, as you said by default the docker-compose setup already uses PostgreSQL for the rasa X data, so you don’t have to change anything there. You’ll only have to to update the tracker_store section in your endpoints.yml to use Redis as described here. That section does not affect the rasa X database. I hope that helps

okay. got it. I will try that. thanks

Is that possible to connect Rasa X to a mongoDb database to store its conversations? If so, where should I change the database which it uses?

No, Rasa X only support SQL-based databases. You can still use MongoDB for the tracker database in Rasa.

Hi @ricwo, what’s the docker command to use for connecting to my postgres database and what’s password for postgres. I have use the rasa x docker-compose installation.

You can install a software like pgAdmin in your local and connect to your Postgres database. You can find the password of Postgres in the “.env” file located in the root directory of Rasa (default: /etc/rasa). The username is “admin” Also, you should add ports to the docker-compose.yml file: change: db: restart: always image: “bitnami/postgresql:11.11.0” expose: - “5432” environment: POSTGRESQL_USERNAME: “${DB_USER:-admin}” POSTGRESQL_PASSWORD: “${DB_PASSWORD}” POSTGRESQL_DATABASE: “${DB_DATABASE:-rasa}” volumes: - ./db:/bitnami/postgresql

To:

db: restart: always image: “bitnami/postgresql:11.11.0” expose: - “5432” ports: - “5432:5432” environment: POSTGRESQL_USERNAME: “${DB_USER:-admin}” POSTGRESQL_PASSWORD: “${DB_PASSWORD}” POSTGRESQL_DATABASE: “${DB_DATABASE:-rasa}” volumes: - ./db:/bitnami/postgresql

Then you should start docker images again (“sudo docker-compose down” and then “sudo docker-compose up -d”)

Now, you can connect to the Postgres database, congratulations:)

Another approach is connect to the Postgres database from terminal of your server.