Using External Database with sslmode=required

Hello there, I am fairly new to Rasa and I am trying to install Rasa X using the Helm charts on Kubernetes. I would like to connect Rasa X to an external postgres database and this external db requires using the sslmode=required flag.

I couldn’t find the possibility to set it in the values.yml file.

Unfortunately without it, the db-migration-service fails with the following error:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user “mybot” FATAL: no pg_hba.conf entry for host “ip.address.here”, user “mybot”, database “mydb”, SSL off

Any help is appreciated :slight_smile:

Thank you!

@renata I not work much on Rasa X and Kubernetes. But try install pip install psycopg2 in your environment, hope it will help. I using Docker to run the Rasa Open Source and its containers have different ip.address inside container, so please inspect the pods.

1 Like

Maybe it helps somebody else… I managed to set up the connection to the external PostgreSQL database for both Rasa X and the tracker store using SSL by…

adding the whole connection string (including the query param sslmode=required) as the additional env variable DB_URL

rasax:
    extraEnvs: 
    - name: DB_URL
      valueFrom:
        secretKeyRef:
            name: "rasa-x-pg-secret"
            key: "dbUrl"
dbMigrationService:
    extraEnvs: 
    - name: DB_URL
      valueFrom:
        secretKeyRef:
            name: "rasa-x-pg-secret"
            key: "dbUrl"
eventService:
    extraEnvs: 
    - name: DB_URL
      valueFrom:
        secretKeyRef:
            name: "rasa-x-pg-secret"
            key: "dbUrl"

and modifying the ConfigMap holding the rasa-configuration-files:

tracker_store:
  type: sql
  dialect: "postgresql"
  url: db_host
  port: 12345
  username: username
  password: sqlpassword
  db: rasa
  login_db: rasa
  query:
    sslmode: require

Thanks for the tip… At the end I managed to set the configs right…

How did you manage to define the path for your ssl certificate used by your postgresql instance in your tracker store configuration?