Tutor k8s deployment mongodb password

When is set mongodb user and password with tutor config save command it will add “@” to my password in k8s deployments.yml . for example when i set my external mongodb password

$ tutor config save --set MONGODB_PASSWORD="abc"

and then i check $(tutor config printroot)/env/k8s/deployments.yml i will see

apiVersion: apps/v1
kind: Deployment
metadata:
  name: forum
  labels:
    app.kubernetes.io/name: forum
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: forum
  template:
    metadata:
      labels:
        app.kubernetes.io/name: forum
    spec:
      containers:
        - name: forum
          image: docker.io/overhangio/openedx-forum:11.2.11
          ports:
            - containerPort: 4567
          env:
            - name: SEARCH_SERVER
              value: "http://elasticsearch:9200"
            - name: MONGODB_AUTH
              value: "user:abc@"

Why this happened ?
And when i run tutor k8s quickstart i will get an error in forum-job

Mongo::Auth::Unauthorized: User user is not authorized to access cs_comments_service.

1 Like

The MONGODB_AUTH variable is actually different from MONGODB_PASSWORD. It is defined such that the mongodb url that the forum connects to is “mongodb://$MONGODB_AUTH$MONGODB_HOST:$MONGODB_PORT/cs_comments_service” (Source: https://github.com/overhangio/tutor/blob/master/tutor/templates/build/forum/bin/docker-entrypoint.sh)

The actual error is pretty clear:

It looks like “user” does not have access to the “cs_comments_service” collection. Are you quite sure that you are able to authenticate with this user and access this collection?

2 Likes

Thanks a lot @regis ,
You helped me to resolve this issue. But actually i want to use our mongoDB cluster as a shared database for multiple openedx organization (multi site) , so i lunched two different edx org with tutor on different namespaces in kuberntes cluster and configure different mongo database name for each edx org, but both needs to have cs_comments_service database and it is hard coded as you mentioned before . Is there any config that i can use to set for different (mongo cs_comments_service database name) edx ORGs ?

@imantaba you are absolutely right that it is currently not possible to manually define the forum database name to anything different from cs_comments_service. This is an issue. Would you like to open a PR to address this, or let one of the @developers do it?

EDIT: I created a corresponding issue here The Mongodb database name of the forums is hardcoded and cannot be modified · Issue #449 · overhangio/tutor · GitHub

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.