dokku / dokku-mongo

a mongo plugin for dokku
MIT License
174 stars 32 forks source link

Authentication problem #38

Closed Newbas closed 8 years ago

Newbas commented 8 years ago

Hey Guys,

First of all thank you for your work, it help a lot.

I am trying to use this plugin on Digital Ocean server, and setup mongodb it works, and my application Scala Play! + Ractive Mongo connects to database, but could not do any thing.

I got this error in Mongo logs

Failed to authenticate perch@perch with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document.

As i search, problem because user created wrongly and now i need to recreate user. The thing is that i am new to doker and dokku, and i trying to find out how to connect to db, because if i connect with use of telnet through your plugin i can not do anything with user.

Thanks.

josegonzalez commented 8 years ago

How are you connecting to the mongo instance?

Newbas commented 8 years ago

From application I use Env variable MONGO_URL, and i log It on server it is mongodb://perch:3c4c5f28126aa6565ec5d973ad29b0dc@dokku-mongo-perch:27017/perch.

Throught dokku mongo:connect perch i just connect to it, but i cant edit users, i get message that i dont have rights.

josegonzalez commented 8 years ago

Yeah, the user you get access to in that MONGO_URL is not the admin user. The password for that is in a ROOTPASSWORD file in the SERVICE_ROOT directory as noted here. User is admin.

@Flink do you think we should expose these root passwords in some other fashion?

Newbas commented 8 years ago

Yes it is for mongo:connect,

but within application i see this Failed to authenticate perch@perch with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document

And after i see Unauthorized not authorized on perch to execute command { insert: "events", documents: [ {...}]}

Checking mongo driver also.

Newbas commented 8 years ago

On localhost with manually setuped mongo driver works fine.

The thing to mention i got this error only within app, when connected with dokku mongo:connect i can create collection and add documents.

josegonzalez commented 8 years ago

Can you provide a sample application that has this issue?

Newbas commented 8 years ago

Here is application https://github.com/Newbas/mongotest Index page tries to insert new document into collection.

Newbas commented 8 years ago

Sorry, it looks like i found the problem and it is with app. I will test a little bit more and update.

Newbas commented 8 years ago

Yes sorry now i have same issue with local manual installation. Sorry for taking your time, and thank you for your responses.

pynixwang commented 6 years ago

when mongo name same as app name(such as admin) will cause "Authentication failed", maybe dokku connect to your app container, not your mongo container.

pynixwang commented 6 years ago

and when name exsits, mongo:create will not print info. just "wait container to be ready."

josegonzalez commented 6 years ago

@pynixwang mind filing a new issue for your errors?