RocketChat / helm-charts

Repository for RocketChat helm charts
36 stars 67 forks source link

Error initializing MongoDB (failed to add role clusterMonitor to user) #119

Open ccoors opened 9 months ago

ccoors commented 9 months ago

Hi,

I experience some issues deploying the helm chart v6.4.4 in a test environment. The user_set_role_clusterMonitor.sh generated in mongodb-init-configmap.yaml appears to cause some issues.

Log from the pod:

mongodb 18:55:26.66 INFO  ==> ** Starting MongoDB setup **                                                                                                                                                        
mongodb 18:55:26.67 INFO  ==> Validating settings in MONGODB_* env vars...                                                                                                                                        
mongodb 18:55:26.70 INFO  ==> Initializing MongoDB...                                                                                                                                                             
mongodb 18:55:26.73 INFO  ==> Enabling authentication...                                                                                                                                                          
mongodb 18:55:26.73 INFO  ==> Deploying MongoDB with persisted data...                                                                                                                                            
mongodb 18:55:26.75 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d ...                                                                                                                    
mongodb 18:55:29.16 INFO  ==> attempting to add clusterMonitor role to user rocketchat                                                                                                                            
/docker-entrypoint-initdb.d/..2023_10_27_18_55_25.1951182286/user_set_role_clusterMonitor.sh: line 39: ((: ...: syntax error: operand expected (error token is "...")                                             
mongodb 18:55:30.70 ERROR ==> failed to add role clusterMonitor to user "rocketchat"; Error: admin>                                                                                                               
admin> ... ... ... ... ... ... ... ... { ok: 1 }                                                                                                                                                                  
admin>                                                                                                                                                                                                            
admin>                                                                                                                                                                                                            
mongodb 18:55:30.71 INFO  ==> Stopping MongoDB...

This is the relevant configuration from my values.yaml:

mongodb:
  enabled: true
  auth:
    rootPassword: rocketchatroot
    usernames:
      - rocketchat
    passwords:
      - rocketchat
    databases:
      - rocketchat

  architecture: standalone

  persistence:
    enabled: true
    accessMode: ReadWriteOnce
    size: 8Gi

  volumePermissions: { enabled: true }

The issue appears to be in the parsing of the stdout output of mongodb_execute_print_output - unfortunately both my awk- and MongoDB-knowledge isn't too great, otherwise I would have prepared a PR instead of this issue. Is there no better way to detect success?