Customizing Docker Compose for Rasa X

I’m using official Docker compose file to deploy rasa on a server. But don’t want to use reddis, RabbitMQ. I just want to deploy rasa x on a docker with a mongo Database credentials of which I have added in the endpoint.yml under tracker_store.

Now since I’m using a mongo server for storing all the tracker information I feel I do not need to create two images which are db and db migrations which are present inside the docker-compose file.

But When my images are created for the above scenario and I try to launch rasa x on a local port it throws me an error saying

> rasa-x_1           | Starting Rasa X server... 🚀
> rasa-x_1           | [2021-04-15 10:51:27 +0000] [10] [INFO] Goin' Fast @ http://0.0.0.0:5002
> rasa-x_1           | ERROR:rasax.community.server:(psycopg2.OperationalError) could not translate host name "db" to address: Temporary failure in name resolution
> rasa-x_1           |
> rasa-x_1           | (Background on this error at: http://sqlalche.me/e/13/e3q8)
> rasa-x_1           | Traceback (most recent call last):
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
> rasa-x_1           |     return fn()
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 304, in unique_connection
> rasa-x_1           |     return _ConnectionFairy._checkout(self)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 778, in _checkout
> rasa-x_1           |     fairy = _ConnectionRecord.checkout(pool)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 495, in checkout
> rasa-x_1           |     rec = pool._do_get()
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/impl.py", line 140, in _do_get
> rasa-x_1           |     self._dec_overflow()
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
> rasa-x_1           |     compat.raise_(
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_
> rasa-x_1           |     raise exception
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/impl.py", line 137, in _do_get
> rasa-x_1           |     return self._create_connection()
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
> rasa-x_1           |     return _ConnectionRecord(self)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 440, in __init__
> rasa-x_1           |     self.__connect(first_connect_check=True)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 661, in __connect
> rasa-x_1           |     pool.logger.debug("Error on connect(): %s", e)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
> rasa-x_1           |     compat.raise_(
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_
> rasa-x_1           |     raise exception
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/pool/base.py", line 656, in __connect
> rasa-x_1           |     connection = pool._invoke_creator(self)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/strategies.py", line 114, in connect
> rasa-x_1           |     return dialect.connect(*cargs, **cparams)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 509, in connect
> rasa-x_1           |     return self.dbapi.connect(*cargs, **cparams)
> rasa-x_1           |   File "/usr/local/lib/python3.8/dist-packages/psycopg2/__init__.py", line 127, in connect
> rasa-x_1           |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> rasa-x_1           | psycopg2.OperationalError: could not translate host name "db" to address: Temporary failure in name resolution

This is my Docker-Compose file

version: "3.4"
x-duckling-credentials: &duckling-credentials

  RASA_DUCKLING_HTTP_URL: "http://duckling:8000"

x-rasax-credentials: &rasax-credentials

  RASA_X_HOST: "http://localhost:5002"
  RASA_X_USERNAME: ${RASA_X_USERNAME:-admin}
  RASA_X_PASSWORD: ${RASA_X_PASSWORD:-}
  RASA_X_TOKEN: ${RASA_X_TOKEN}
  JWT_SECRET: ${JWT_SECRET}
  RASA_USER_APP: "http://app:5055"
  RASA_PRODUCTION_HOST: "http://localhost:5005"
  RASA_TOKEN: ${RASA_TOKEN}

x-rasa-credentials: &rasa-credentials
  <<: *rasax-credentials
  <<: *duckling-credentials
  RASA_TOKEN: ${RASA_TOKEN}
  RASA_MODEL_PULL_INTERVAL: 10
  RASA_TELEMETRY_ENABLED: ${RASA_TELEMETRY_ENABLED:-false}

x-rasa-services: &default-rasa-service
  restart: always
  image: "rasa/rasa:${RASA_VERSION}-full"
  volumes:
      - ./.config:/.config

  expose:
    - "5005"

  command: >
    --no-prompt
    --production
    --config-endpoint http://localhost:5002/api/config?token=${RASA_X_TOKEN}
    --port 5005
    --jwt-method HS256
    --jwt-secret ${JWT_SECRET}
    --auth-token '${RASA_TOKEN}'
    --cors "*"
  depends_on:
    - rasa-x

services:

  rasa-x:
    restart: always
    image: "rasa/rasa-x:${RASA_X_VERSION}"
    ports:
      - "5002:5002"
    expose:
      - "5002"
    volumes:
      - .:/app
      - ./logs:/logs
      - ./auth:/app/auth

    environment:
      <<: *rasa-credentials
      SELF_PORT: "5002"
      DB_DATABASE: "${DB_DATABASE:-rasa}"
      RASA_MODEL_DIR: "/app/models"
      PASSWORD_SALT: ${PASSWORD_SALT}
      RASA_X_USER_ANALYTICS: "0"
      SANIC_RESPONSE_TIMEOUT: "3600"

rasa-production:
    <<: *default-rasa-service
    environment:
      <<: *rasa-credentials
      RASA_ENVIRONMENT: "production"
      DB_DATABASE: "tracker"
      MPLCONFIGDIR: "/tmp/.matplotlib"
      RASA_MODEL_SERVER: "http://localhost:5002/api/projects/default/models/tags/production"

app:
    restart: always
    image: "rasa/rasa-x-demo:${RASA_X_DEMO_VERSION}"
    expose:
      - "5055"
    depends_on:
      - rasa-production

I have removed db and db migration images, from docker-compose as I’m saving the tracker details inside a mongo db of which details I have added in tracker_store inside endpoint.yml

hi @anoopshrma ! You are indeed able to use mongodb to store your trackers for Rasa Open Source to manage your assistant sessions. But in addition to the tracker store, Rasa X saves additional information inside of postgres (like your training data, conversation tags, predictions made by the model, NLU evaluations, etc). So you do still need those two containers even if you’re using a different tracker store.