dokku / dokku-mongo

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

how to connect mongodb in client machine #75

Closed LabN36 closed 7 years ago

LabN36 commented 7 years ago

Hi, I'm running dokku server(dokku verison0.5.6) and setup dokku-mongo(mongo version 3.2.9) on dokku

these are the steps that i followed

  1. sudo dokku plugin:install https://github.com/dokku/dokku-mongo.git mongo
  2. dokku mongo:create mydatabasename
  3. dokku mongo:link mydatabasename mydokkuappname
  4. mongo:expose mydokkuappname (after running this i got something like this 27017->11588 27018->286286 , two more ports like this)
  5. when i run this command mongo:connect mydatabasename i got succssfully connected to mongo shell and able to perform mongo operations :+1:

after all this steps i run dokku mongo:info mydatabasename from this i got mongo_url

now i want to connect this mongo from my client machine or from anywhere with a link just like mlab.com(Dbaas) is providing a link

  1. is it possible, i think yes. if yes then please guide me how to do it
  2. do i need some ssh thing
  3. do i need other username & password than this what i got from mongo_url = mongod://username:password@mydokkuapplicationname:27017/mydatabasename

please guide me how do connect and highlight on all above three points

Thanks, A dokku+mongo noob

LabN36 commented 7 years ago

Hey, I've finally resolved my issue this is how i connected to mongo server

I've run this command on my pc(installed mongo 3.2) mongo 199.124.1.2:12128/dbname -u dbusername -p dbpassword                    1             2           3                                   4                     5

Explanation for those who are struggling

  1. you server static IP address
  2. you exposed port no (any in one of the four user B when A->B)
  3. your databasename this is what you enter while you run this command dokku mongo:create dbname
  4. & 5. you will get this when running dokku mongo:info