Migrating from Rasa Platform

Deployment has changed slightly with the release of Rasa X EE, this page contains information on how to migrate from the old Rasa Platform. Two major things have changed:

  • Rasa Core and NLU are now one package called Rasa, meaning the containers have changed and also it’s possible to train Core on Rasa X EE now
  • Rasa X EE now uses an SQL database, so you’ll have to migrate your MongoDB database

Below is a step by step guide on how to upgrade everything.

Warning

This migration will only work if you have Rasa Platform 0.18.0 or greater installed.

  1. First we’ll create a backup of your whole platform directory, to make sure no data gets lost along the way. E.g. by running:

    $ sudo cp -r /etc/rasaplatform /etc/platform_backup
    
  2. By default the new install script installs the platform under /etc/rasa due to the product rename. So you’ll need to rename your platform directory to /etc/rasa by running:

    $ sudo mv -r /etc/rasaplatform /etc/rasa
    

    Note

    You can skip this step if you didn’t install the platform with the quick install script. However, if you’re not upgrading using this script, you should contact us for additional steps required with manual installation.

  3. Make sure all environment variables from .env are stored under /etc/rasa/credentials as well, otherwise these may get overwritten. Your directory should contain the files:

    • jwt_secret
    • mongo
    • password_salt
    • rabbit
    • token_salt

4. Rename your license file from rasa_platform.yml to rasa-x-ee-license.yml by running:

$ mv rasa_platform.yml rasa-x-ee-license.yml
  1. Download the install script and run it (this will collect the new docker-compose.yml and a few other scripts):

    $ curl -sSL -o install.sh https://storage.googleapis.com/rasa-x-releases/<rasa-x-version>/install.sh
    $ sudo bash ./install.sh
    
  2. Run the database migrations from your existing MongoDB to SQL. This involves a few steps. First go to the migrations folder:

    $ cd scripts/mongo_migration/
    

    The .env file in this directory is linked to the one in /etc/rasa so all credentials should be correct, but double check if everything is right. Next, create a directory for the new database:

    $ sudo mkdir db
    

    If your MongoDB folder (/etc/rasa/mongo by default) or new db folder (/etc/rasa/scripts/mongo_migration/db) are in non standard locations then you will have to adjust these in the volumes sections in docker-compose.yml accordingly.

    You will need to modify the permissions for the db folder, and then you can start the migrations. The reason for this is that our containers no longer run as root.

    $ sudo chmod -R 1001 ./db && sudo chmod -R 750 ./db
    $ sudo docker-compose up -d
    

    You can check the progress by taking a look at the migrator logs:

    $ sudo docker-compose logs migrator
    

    Note

    If you have a lot of conversations, this may take several hours.

    Once the migration has completed, copy over the database folder (/etc/rasa/scripts/mongo_migration/db) to the etc/rasa directory:

    $ sudo cp -rp /etc/rasa/scripts/mongo_migration/db /etc/rasa/db
    
  3. Navigate back to the /etc/rasa directory and update your environments.yml file to match this:

    rasa:
      production:
        url: http://rasa-production:5005
        token: ${RASA_TOKEN}
        db: tracker
      worker:
        url: http://rasa-worker:5005
        token: ${RASA_TOKEN}
        db: tracker
      development:
        url: http://rasa-development:5005
        token: ${RASA_TOKEN}
        db: rasa_development
    
  4. Update your endpoints.yml file to match this:

    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}
    event_broker:
      type: "pika"
      url: ${RABBITMQ_HOST}
      username: ${RABBITMQ_USERNAME}
      password: ${RABBITMQ_PASSWORD}
      queue: ${RABBITMQ_QUEUE}
    action_endpoint:
      url: ${RASA_USER_APP}/webhook
      token:  ""
    
  5. If you were using a development environment in the Rasa Platform and want to continue using it, you’ll need to add a section to the services in your docker-compose.override.yml:

    rasa-development:
      <<: *default-rasa-service
      environment:
        <<: *rasa-credentials
        DB_DATABASE: "rasa_development"
        RASA_MODEL_SERVER: "http://rasa-x:5002/projects/default/models/tags/development"
        RABBITMQ_QUEUE: "rasa_development_events"
    
  6. If you were running a custom app container for your custom actions, you’ll need to update your docker image to run on port 5055. Additionally you’ll need modify the entry in your docker-compose.override.yml and add/change these parameters:

     expose:
      - "5055"
    depends_on:
      - rasa-production
    

    Alternatively, you can also just modify the endpoints.yml to reference the appropriate port your action server is running on.

  7. Now you should be able to start up Rasa X EE by running:

sudo docker-compose up -d

You can log in with your old credentials.

  1. Once you’ve logged in, you’ll need to add your Core configuration to the end of the file in https://your-rasax.com/config.

  2. You will also need to upload your stories from a single file, using the PUT method here.

  3. Now you can train a model by hitting the Train button, which will train a a single Rasa model (consisting of Rasa Core and Rasa NLU). Then promote the model to production and you should be able to talk to your bot.

  4. Optionally, you can perform some cleanup in your /etc/rasa directory in order to save space:

    sudo rm -r /etc/rasa/mongo/
    sudo rm -r /etc/rasa/nlu-projects/
    sudo rm -r /etc/rasa/core-models/