Jake Klassen
Jake Klassen

Reputation: 111

How can I connect to MongoDB on a Dokku host?

I have an Ubuntu 16.04 droplet running on Digital Ocean. I am running MongoDB 3.2.10 as a service, and dokku 0.7.2 running a node.js application.

How can I connect to the MongoDB service running on the host outside the app container? I would like to do this without exposing the MongoDB service publicly if possible.

Upvotes: 0

Views: 958

Answers (1)

Affix
Affix

Reputation: 11

Your best bet in my opinion would be to setup a Private IP on your mongoDB Droplet and Your Dokku host and do some routing or port forwarding from the dokku host to the mongoDB Host.

Ideally though you could backup the mongoDB and restore it to a dokku managed mongo instance.

Install the Plugin

# dokku plugin:install https://github.com/dokku/dokku-mongo

Import your DB

# dokku mongo:import database < database.dump.tar

Link to your App

# dokku mongo:link app database

Upvotes: 1

Related Questions