Skip to content

MONGO_OPTIONS stopped working #12802

Closed
Closed

Description

@geekgonecrazy

With 0.72.0 it seems that MONGO_OPTIONS stopped working.

The file that loads this environment variable was last touched here: #12595

The environment variable is normally loaded here:
https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-cors/server/cors.js#L18

Suspicion is change to module has effected the order this code is executed in. This needs to be executed very early in start up.

This seems very likely would effect other functionality in this file

Activity

  1. added this to the 0.72.1 milestone on Dec 3, 2018
  2. steerben commented on Dec 4, 2018

    @steerben
    Contributor

    I will test if this solves the issue.

    Though I would challenge if the cors.js file is the correct place to set such a crucial database connection option. For me it seems that it worked kinda unintentionally all the time, given the file the function call is placed in.

    This should be one of the first things when initialising meteor.

  3. micfung commented on Feb 5, 2019

    @micfung

    sorry guys, the error still exists on 0.74.1
    On mongo side, the error is no SSL certificate provided by peer; connection rejected
    On rocketchat side, the error is MongoNetworkError: connection x to xxx:27017 closed
    I tried so many times to upgrade from 0.71.1 to 0.72 and 0.74.1, but still cannot connect to mongo
    The MONGO_OPTIONS works well on 0.71.1

  4. geekgonecrazy commented on Feb 7, 2019

    @geekgonecrazy
    ContributorAuthor
  5. MarcosSpessatto commented on Feb 11, 2019

    @MarcosSpessatto
    Contributor

    @micfung can you please provide the content of your env variable MONGO_OPTIONS? Investigating your error, I found this link that is from this topic, I don't know if the problem can be something like that, @geekgonecrazy what do you think?

  6. micfung commented on Feb 15, 2019

    @micfung

    @MarcosSpessatto My MONGO-OPTIONS in .bashrc

    export PEM=$(cat /opt/mongodb/mongodb.pem | awk '{printf "%s\\n",$0} END {print ""}')
    export CA=$(cat /opt/mongodb/ca.pem  | awk '{printf "%s\\n",$0} END {print ""}')
    export MONGO_OPTIONS="{\"sslCA\":[\"${CA}\"], \"sslCert\":\"${PEM}\",\"sslKey\":\"${PEM}\"}"
    

    i will take a look the link you give me. FYR. i can connect mongo from my rocketchat server using cli

  7. micfung commented on Feb 15, 2019

    @micfung

    the command i use to connect mongo from my rocketchat server

    sudo mongo --ssl -sslCAFile /opt/mongodb/ca.pem --sslPEMKeyFile /opt/mongodb/mongodb.pem --host xxx.xxx.xx -u admin -p xxx --authenticationDatabase 'rocketchat'
    
  8. modified the milestones: 0.72.1, 1.1.0 on Apr 6, 2019
  9. modified the milestones: 1.1.0, 1.3.0 on Jul 10, 2019
  10. modified the milestones: 1.3.0, 1.4.0 on Jul 25, 2019
  11. modified the milestones: 2.0.0, 2.2.0 on Oct 13, 2019
  12. modified the milestones: 2.2.0, 4.1.0 on Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions