New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB configuration #364

Closed
gosiqueira opened this Issue Mar 17, 2015 · 8 comments

Comments

Projects
None yet
3 participants
@gosiqueira
Copy link

gosiqueira commented Mar 17, 2015

I'm trying to install Let's Chat and I'm having trouble to configure mongodb properly for its authentication. Made a search on web and checked files trying to find where this can be configured but failed. How can I configure a mongodb connection using the fields username and passwrod for authentication?

@hhaidar

This comment has been minimized.

Copy link
Member

hhaidar commented Mar 17, 2015

Something like this should work:

database:
  uri: mongodb://username:password@localhost/letschat

See: http://docs.mongodb.org/manual/reference/connection-string/

@hhaidar

This comment has been minimized.

Copy link
Member

hhaidar commented Mar 18, 2015

@gustavosiqueira94 did you end up getting it to work?

@hardez

This comment has been minimized.

Copy link

hardez commented Apr 30, 2015

I'm also having trouble connecting to MongoDB. My Hoster sets up a special instance for every user with an own user pw and port.
So I changed

database:
  uri: mongodb://localhost/letschat

to

database:
  uri: mongodb://username:PW@localhost:port/letschat

but it allways throws auth problems.
If I start the Mongo instance without authentication and change the setup.yaml to

database:
  uri: mongodb://localhost:port/letschat

the connection works. But I really don't want to run a Mongo instance without auth on a shared host.

I also tried to create a new user and password especially for Lets Chat but that also don't worked.
Any ideas?

@hhaidar

This comment has been minimized.

Copy link
Member

hhaidar commented May 1, 2015

@hardez are you able to connect to mongo via command line?

Something like mongo -u <username> -p <password>

@hardez

This comment has been minimized.

Copy link

hardez commented May 1, 2015

yes, that works perfect. With both users.

@hardez

This comment has been minimized.

Copy link

hardez commented May 1, 2015

Ok I tried again, it only works if I connect to the admin DB but even with the mongoadmin user I can't directly connect to the letschat DB. But I can switch to the letschat DB from the mongo cli after I connected to the admin DB.

@hardez

This comment has been minimized.

Copy link

hardez commented May 1, 2015

OK, I got the solution.
You have to add ?authSource=admin to the Mongo URI

database:
  uri: mongodb://username:PW@localhost:port/letschat?authSource=admin
@hhaidar

This comment has been minimized.

Copy link
Member

hhaidar commented May 1, 2015

@hardez ah nice job!

@hhaidar hhaidar closed this May 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment