dokku-mongodb-plugin icon indicating copy to clipboard operation
dokku-mongodb-plugin copied to clipboard

Can't make a remote connection

Open stephenreid321 opened this issue 10 years ago • 7 comments

I can't seem to create a connection from a remote machine to MONGO_URL.

I guess there may be some Mongo setting that is preventing remote connections? Could this be changed?

stephenreid321 avatar Jun 24 '14 15:06 stephenreid321

Which MONGO_URL are you referring to? what is set inside your dokku app?

And by remote machine, do you mean something other than the app or the dokku host?

jeffutter avatar Jun 24 '14 16:06 jeffutter

Yes, the one from doing 'dokku config appname'.

And yes, that's what I mean by 'remote machine' (it's my Macbook). I want to browse the mongo database with the lovely robomongo (http://robomongo.org/).

stephenreid321 avatar Jun 24 '14 21:06 stephenreid321

+1 to this. I'm having the same issue. I noticed that when I run "dokku config " the "MONGODB_HOST" IP is different from my droplet IP. Also noticed that I can ping the "MONGODB_HOST" IP from the droplet but not from my laptop.

I'm trying to run "mongorestore" from my laptop to push a db backup onto mongo running on my droplet. Since mongo actually runs outside of the docker VM it should have nothing to do with my dokku app... correct? Using my droplet's IP and the default port 27017 causes a failed connection attempt. :/

ghost avatar Jun 27 '14 10:06 ghost

Got my mongorestore to work using the droplet's IP (not the MONGODB_HOST IP) and port 49156. This port may be different on your mongo instance. On your droplet run "dokku mongodb:console". It will display a port number that you can use externally.

I'm still not sure why port 27017 doesn't work. When I run "sudo docker ps -a" I see the following line which makes it look like port fwding is setup on 27017 to the mongo db:

92e2777cb4fa jeffutter/mongodb:latest /usr/bin/mongod --db 10 hours ago Up 2 minutes 0.0.0.0:49156->27017/tcp dokku-mongodb

ghost avatar Jun 27 '14 19:06 ghost

the docker ps -a there is showing that docker is forwarding port 49156 on the host to 27017 on the mongodb container.

jeffutter avatar Jul 08 '14 17:07 jeffutter

I managed to connect it to robomongo, you need the host ip, mongo docker container port and the admin password that can be found on your dokku host here: /home/dokku/.mongodb/admin_pw

jamescw avatar Aug 06 '14 12:08 jamescw

I have the same problem and I tried to resolve following the comments without success.

under dokku mongodb:info zombts zombts the terminal report me:

echo "       Host: mongodb"
echo "       Port: 27017"
echo "       User: zombts"
echo "       Password: PWD"
echo "       Database: zombts"
echo
echo "       MONGODB_URL=mongodb://zombts:PWD@mongodb:27017/zombts"

Obviously the Host is wrong, but why print mongodb instead of the IP of the host? On the other hand, I know the IP, so how I can connect with the container?

If I print the containers with docker ps -a:

root@zombeats:/home# docker ps -a
CONTAINER ID        IMAGE                             COMMAND                CREATED             STATUS                  PORTS               NAMES
9bb043653336        dokku/zombts:deployed             "/start"               6 days ago          Up 6 days               5000/tcp            app_zombts_1426962032_16369
36d26bb052aa        busybox:buildroot-2014.02         "true"                 6 days ago          Exited (0) 6 days ago                       cache_data_zombts
9b98ea49b3b0        ayufan/dokku-alt-mongodb:latest   "/usr/bin/start_mong   6 days ago          Up 6 days               27017/tcp           mongodb_single_container
d2a5dcadd44a        dokku/kikobeats-blog:deployed     "/start"               7 days ago          Up 7 days               5000/tcp            app_kikobeats-blog_1426940104_29078
01c804801ca6        ayufan/dokku-alt-mariadb:latest   "/usr/bin/start_mari   7 days ago          Up 7 days               3306/tcp            mariadb_single_container
8eeb59abbd54        busybox:buildroot-2014.02         "true"                 7 days ago          Exited (0) 7 days ago                       cache_data_kikobeats-blog

EDIT: I running the command using docker exec. After this I inspect the container using docker inspect 9b98ea49b3b0 | grep IPAddress to check what IP Adress has being exposing and voilá!:

"IPAddress": "172.17.0.11"

Private address is not possible to resolve, so basically is necessary expose the correct IP of the machine

Kikobeats avatar Mar 28 '15 12:03 Kikobeats