dokku-mongodb-plugin
dokku-mongodb-plugin copied to clipboard
auth failed
Hey, first of all: Awesome plugin! Thanks man for doing the great work.
I'm using this on a fresh ec2 instance. After installing the plugin and trying to
dokku mongodb:console, I get the following error:
$ dokku mongodb:console
MongoDB shell version: 2.6.1
connecting to: localhost:49154/test
2014-05-18T22:01:48.583+0000 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210
exception: login failed
It's Ubuntu 14.04. Do you have a clue, why auth fails? A workaround would be enough for me!
Thanks!
First, can you verrify that /home/dokku/.mongodb/admin_pw exists and has some contents (should be a random string)
Yep, it exists with a random String. I created a new instance and tried it again, it still fails. I still get the following console output:
$ dokku mongodb:list
exception: login failed
Btw, when I tried installation the first time, the following happend:
$ sudo dokku plugins-install
gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com
gpg: key 7F0CEB10: public key "Richard Kreuter <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
exception: connect failed
exception: connect failed
exception: connect failed
exception: connect failed
exception: connect failed
exception: connect failed
The second time worked and installed all dependencies.
Can you also check that the docker MongoDB container is running?
— Sent from Mailbox
On Tue, May 20, 2014 at 3:49 AM, Tim Suchanek [email protected] wrote:
Yep, it exists with a random String. I created a new instance and tried it again, it still fails. I still get the following console output:
$ dokku mongodb:list exception: login failedBtw, when I tried installation the first time, the following happend:
$ sudo dokku plugins-install gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com gpg: key 7F0CEB10: public key "Richard Kreuter <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) exception: connect failed exception: connect failed exception: connect failed exception: connect failed exception: connect failed exception: connect failedThe second time worked and installed all dependencies.
Reply to this email directly or view it on GitHub: https://github.com/jeffutter/dokku-mongodb-plugin/issues/31#issuecomment-43600810
I'm seeing the same auth fail message and also saw the same exception: connect failed errors on the first dokku plugins-install run.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
$ dokku version
v0.2.3
$ ( cd /var/lib/dokku/plugins/mongodb/; git log -n1 )
commit f37dfd9acbec71b87a5b1c31f66c26cc9b4668ec
Author: Jeffery Utter <[email protected]>
Date: Fri May 16 12:17:38 2014 -0500
no more errors because of GLOB
$ dokku mongodb:status
MongoDB container running with ID: ee533812bad3
$ docker ps | grep mongo
ee533812bad3 jeffutter/mongodb:latest /usr/bin/mongod --db 15 minutes ago Up 7 minutes 0.0.0.0:49155->27017/tcp dokku-mongodb
$ dokku mongodb:console
MongoDB shell version: 2.6.1
connecting to: localhost:49155/test
2014-05-20T12:08:42.320+0000 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210
exception: login failed
$ cat /home/dokku/.mongodb/admin_pw
[REDACTED]yRlF2Y3YxYz0K
$ docker logs ee5 | tail
2014-05-20T12:06:06.982+0000 [conn2] Failed to authenticate admin@admin with mechanism MONGODB-CR: AuthenticationFailed UserNotFound Could not find user admin@admin
2014-05-20T12:06:06.987+0000 [conn2] end connection 172.17.42.1:59057 (0 connections now open)
2014-05-20T12:07:01.722+0000 [initandlisten] connection accepted from 172.17.42.1:59059 #3 (1 connection now open)
2014-05-20T12:07:01.726+0000 [conn3] authenticate db: admin { authenticate: 1, nonce: "xxx", user: "admin", key: "xxx" }
2014-05-20T12:07:01.727+0000 [conn3] Failed to authenticate admin@admin with mechanism MONGODB-CR: AuthenticationFailed UserNotFound Could not find user admin@admin
2014-05-20T12:07:01.769+0000 [conn3] end connection 172.17.42.1:59059 (0 connections now open)
2014-05-20T12:08:42.314+0000 [initandlisten] connection accepted from 172.17.42.1:59061 #4 (1 connection now open)
2014-05-20T12:08:42.317+0000 [conn4] authenticate db: admin { authenticate: 1, nonce: "xxx", user: "admin", key: "xxx" }
2014-05-20T12:08:42.318+0000 [conn4] Failed to authenticate admin@admin with mechanism MONGODB-CR: AuthenticationFailed UserNotFound Could not find user admin@admin
2014-05-20T12:08:42.323+0000 [conn4] end connection 172.17.42.1:59061 (0 connections now open)
Edit: I think the problem is on my end - mongdb startup failed during the first plugins-install due to disk space, and subsequent plugins-install runs skip the admin user creation because "$DOKKU_ROOT/.mongodb exists.
I will try removing "$DOKKU_ROOT/.mongodb and running plugins-install again.
@iskandar thanks. Please report back. Also, are you running on aws?
Yep, the container is running:
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
af20baa0bc43 jeffutter/mongodb:latest /usr/bin/mongod --db 4 hours ago Up 4 hours 0.0.0.0:49153->27017/tcp happy_sammet
Now I also removed /home/dokku/.mongodb and reran plugins-install, killed the old mongodb container, the new one runs, but still "login failed".
Here's how I got this to work on an EC2 instance with a small (8GB) root volume.
Before you do this:
- mount a decently-sized EBS volume at
/mnt/largeor equivalent - kill any running docker containers
- Remove
$DOKKU_ROOT/.mongodb(be careful if you have real data in there!) - Move
$DOKKU_ROOTto a larger volume:sudo mv /home/dokku /mnt/large/dokku - Symlink from larger volume back to
/home/dokku:sudo ln -s /mnt/large/dokku /home/dokku - Re-run
dokku plugins-install - Reboot instance or restart services manually
@timsuchanek are you running on a small instance? Can you check your disk space and see if @iskandar 's solution works for you?
— Sent from Mailbox
On Tue, May 20, 2014 at 8:34 AM, Iskandar Najmuddin [email protected] wrote:
Here's how I got this to work on an EC2 instance with a small (8GB) root volume. Before you do this:
- mount a decently-sized EBS volume at
/mnt/largeor equivalent- kill any running docker containers
- Remove
$DOKKU_ROOT/.mongodb(be careful if you have real data in there!)- Move
$DOKKU_ROOTto a larger volume:sudo mv /home/dokku /mnt/large/dokku- Symlink from larger volume back to
/home/dokku:sudo ln -s /mnt/large/dokku /home/dokku- Re-run
dokku plugins-install5. Reboot instance or restart services manually
Reply to this email directly or view it on GitHub: https://github.com/jeffutter/dokku-mongodb-plugin/issues/31#issuecomment-43625716
@iskandar Thanks for the instructions!
I'm using a 30gb EBS volume, 70% is free. It's a t1.micro instance.
So I didn't put it into another volume, because it should work with this space.
But everytime, I delete $DOKKU_ROOT/.mongodb, kill the running containers and rerun sudo dokku plugins-install, the first time there is exception: connect failed. The second time I execute sudo dokku plugins-install it installs everything and the container runs. I also rebooted several times.
I checked the ports settings, 22 and 80 are open ingoing, outgoing everything is open.
Do you have to execute dokku with sudo? For me it doesn't work without sudo. Maybe that's the problem. But I really just have a fresh Ubuntu 14.04 and executed the install script like described in the dokku docs:
wget -qO- https://raw.github.com/progrium/dokku/v0.2.3/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash` before
UPDATE: I looked into the ENV file of the app. There is the following content:
export MONGODB_DATABASE="dev_mydomain.de-production"
export MONGODB_HOST="172.17.0.2"
export MONGODB_PORT="49155"
export MONGODB_USERNAME="dev.mydomain.de"
export MONGODB_PASSWORD=""
export MONGO_URL="mongodb://dev.mydomain.de:@172.17.0.2:27017/dev_mydomain.de-production"
(I'm using the dev. subdomain of my domain)
Maybe try adding some logging around https://github.com/jeffutter/dokku-mongodb-plugin/blob/master/install#L46 - otherwise, I'm out of ideas, sorry!
Hey, good idea! I'm not a shell pro, can you tell me how to add some logging at that point? Yeah, meanwhile I now create my own mongodb docker image and inject it by hand... Thanks!
Btw: Isn't the docker container just available locally to the host machine? Then disabling the credentials shouldn't be a problem. What do you think?
Isn't the docker container just available locally to the host machine?
Not over the loopback interface (127.0.0.1), which is what the Localhost Exception looks for.
Ok. I at least found a work-around. (Using the newest dokku/docker)
I'm still not sure, why the problems occured for me and not for you, but I saw, that the docker container didn't run correctly. With using docker logs and this cute trick: http://stackoverflow.com/questions/22338509/attaching-process-to-docker-libcontainer-container
I saw two problems I had to fix to get it running:
-
The container couldn't start, db-path /data/db not found. Having /tmp/mongo as a path for the run command here, but in the Dockerfile /data is being created, makes no sense to me. I decided for
/data, because it's the mongo default. To fix it, I added amkdir -p "$DOKKU_ROOT/.mongodb/data"in https://github.com/jeffutter/dokku-mongodb-plugin/blob/master/install#L25
-
I think the 200 seconds, the do while loop from line 42 in the same file gives mongo, weren't enough for my slow micro instance, which needed a lot of time for the initial
mongodrun, especially to allocate all the disk space.
So I executed the command from line 46 by hand. Works fine now! I think, I will look for a better solution, maybe increasing the waiting time, so the excecution by hand is not needed anymore. But it works fine now and I'm really happy!
Thanks for your support, @jeffutter and @iskandar .
I really wanted to get this working :-)
Good workaround, glad I could help a little :)
I've just pushed up a few changes that may address these type of issues. A new crop of problems arose when mongodb move to version 2.6 ... There could have been problems creating the admin user. More likely though, it seems the way i was disabling the mongodb server from starting on the host no longer workes with 2.6. I've found a workaround (there are now mongo-org-shell packages that don't even include the server on the host). Please try the latest mast and let me know if it solves problems for anyone.
I'm still getting these same errors... any ideas what I can do? @timsuchanek's solution isn't working for me
@pandringa are these issues new for you or have you had problems with them from the beginning?
This is the first time I’ve tried your plugin, and the error showed up twice in a row.
However, I ended up just deleting and making a new DigitalOcean droplet and that seemed to fix the problem, so maybe it was something weird with my server.
I had the same issue. Running as crazy commands: apt-get update/upgrade, reboot and reinstalling the whole plugin helped!
This is driving me nuts! Works great from the mongo shell. Fails when connecting through mongoid.yml.
Can you share your mongoid.yml?
Had the same issue on DigitalOcean (20GB Disk, so large enough) with the provided Dokku app (0.2.3).
I suspect this issue is related to https://github.com/progrium/dokku/issues/564#issuecomment-5416475 (Docker containers unable to access the network). The other issue I fixed (temporarily) is "BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly" with export LC_ALL=C.
After eliminating these two snags the plugin installed correctly in a fresh DigitalOcean droplet.